ORCA: Optimization-based framework for Robotic Control Applications
Public Types | Public Member Functions | List of all members
orca::common::ConfigurableOrcaObject Class Reference

Represents a set of parameters that can be loaded from a YAML file. More...

#include <ConfigurableOrcaObject.h>

+ Inheritance diagram for orca::common::ConfigurableOrcaObject:
+ Collaboration diagram for orca::common::ConfigurableOrcaObject:

Public Types

using Ptr = std::shared_ptr< ConfigurableOrcaObject >
 
using ParamMap = std::map< std::string, ParameterBase *>
 

Public Member Functions

 ConfigurableOrcaObject (const std::string &config_name)
 
virtual ~ConfigurableOrcaObject ()
 
template<class T >
void addParameter (const std::string &param_name, Parameter< T > *param, ParamPolicy policy=ParamPolicy::Required, std::function< void()> on_loading_success=0)
 Returns true if all params added with have been set. More...
 
template<class T >
void addParameter (const std::string &param_name, T &param, ParamPolicy policy=ParamPolicy::Required, std::function< void()> on_loading_success=0)
 
ParameterBasegetParameter (const std::string &param_name)
 Returns a param via its name. More...
 
void printParameters () const
 Print all parameters to std::cout. More...
 
bool configureFromFile (const std::string &yaml_url)
 Configure the task from YAML/JSON file. It must contain all the required parameters. More...
 
bool configureFromString (const std::string &yaml_str)
 Configure the task from YAML/JSON string. It must contain all the required parameters. More...
 
bool isConfigured () const
 
const ParamMapgetParameters () const
 
void onConfigureSuccess (std::function< void()> f)
 
- Public Member Functions inherited from orca::common::OrcaObject
 OrcaObject (const std::string &name)
 
virtual ~OrcaObject ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 

Detailed Description

Represents a set of parameters that can be loaded from a YAML file.

Member Typedef Documentation

◆ ParamMap

◆ Ptr

Constructor & Destructor Documentation

◆ ConfigurableOrcaObject()

ConfigurableOrcaObject::ConfigurableOrcaObject ( const std::string &  config_name)

◆ ~ConfigurableOrcaObject()

ConfigurableOrcaObject::~ConfigurableOrcaObject ( )
virtual

Member Function Documentation

◆ addParameter() [1/2]

template<class T >
void orca::common::ConfigurableOrcaObject::addParameter ( const std::string &  param_name,
Parameter< T > *  param,
ParamPolicy  policy = ParamPolicy::Required,
std::function< void()>  on_loading_success = 0 
)
inline

Returns true if all params added with have been set.

Returns
true is all the required parameters are loaded properly

◆ addParameter() [2/2]

template<class T >
void orca::common::ConfigurableOrcaObject::addParameter ( const std::string &  param_name,
T &  param,
ParamPolicy  policy = ParamPolicy::Required,
std::function< void()>  on_loading_success = 0 
)
inline

◆ configureFromFile()

bool ConfigurableOrcaObject::configureFromFile ( const std::string &  yaml_url)

Configure the task from YAML/JSON file. It must contain all the required parameters.

Returns
true is all the required parameters are loaded properly

◆ configureFromString()

bool ConfigurableOrcaObject::configureFromString ( const std::string &  yaml_str)

Configure the task from YAML/JSON string. It must contain all the required parameters.

Returns
true is all the required parameters are loaded properly

◆ getParameter()

ParameterBase * ConfigurableOrcaObject::getParameter ( const std::string &  param_name)

Returns a param via its name.

Parameters
param_nameThe name of the param (might not exist)
Returns
orca::common::ParameterBase* The param pointer, nullptr if if does not exists

◆ getParameters()

const ConfigurableOrcaObject::ParamMap & ConfigurableOrcaObject::getParameters ( ) const

◆ isConfigured()

bool ConfigurableOrcaObject::isConfigured ( ) const

◆ onConfigureSuccess()

void ConfigurableOrcaObject::onConfigureSuccess ( std::function< void()>  f)

◆ printParameters()

void ConfigurableOrcaObject::printParameters ( ) const

Print all parameters to std::cout.


The documentation for this class was generated from the following files: