|
mc_rtc
2.14.0
|
#include <mc_control/fsm/StateFactory.h>


Classes | |
| struct | StateConfiguration |
Public Member Functions | |
| StateFactory (const std::vector< std::string > &paths, const std::vector< std::string > &files, bool verbose) | |
| void | load_libraries (const std::vector< std::string > &paths) |
| void | load_files (const std::vector< std::string > &files) |
| void | load (const std::map< std::string, mc_rtc::Configuration > &states) |
| void | load (const std::string &name, const std::string &base, const mc_rtc::Configuration &config) |
| StatePtr | create (const std::string &state, Controller &ctl, const mc_rtc::Configuration &config) |
| StatePtr | create (const std::string &state, Controller &ctl) |
| StatePtr | create (const std::string &state, const mc_rtc::Configuration &config) |
| StatePtr | create (const std::string &state) |
| bool | hasState (const std::string &state) const |
| const std::vector< std::string > & | states () const |
| bool | load_with_loader (const std::string &state) |
| template<typename RetT , typename... Args> | |
| void | register_object (const std::string &name, std::function< RetT *(const Args &...)> callback) |
| const StateConfiguration & | configuration (const std::string &state) const |
Public Member Functions inherited from mc_rtc::ObjectLoader< State > | |
| ObjectLoader (const std::string &class_name, const std::vector< std::string > &paths, bool verbose, Loader::callback_t cb=Loader::default_cb) | |
| ~ObjectLoader () | |
| bool | has_object (const std::string &name) const |
| std::vector< std::string > | objects () const |
| void | load_libraries (const std::vector< std::string > &paths, Loader::callback_t cb=Loader::default_cb) |
| void | clear () |
| void | set_verbosity (bool verbose) |
| void | register_object (const std::string &name, std::function< RetT *(const Args &...)> callback) |
| std::shared_ptr< State > | create_object (const std::string &name, Args... args) |
| std::string | get_object_runtime_directory (const std::string &name) const noexcept |
| unique_ptr | create_unique_object (const std::string &name, Args... args) |
Additional Inherited Members | |
Public Types inherited from mc_rtc::ObjectLoader< State > | |
| using | unique_ptr = std::unique_ptr< State, ObjectDeleter > |
Protected Member Functions inherited from mc_rtc::ObjectLoader< State > | |
| State * | create (const std::string &name, Args... args) |
| State * | create_from_handles (const std::string &name, Args... args) |
| State * | create_from_callbacks (const std::string &name, Args... args) |
Protected Attributes inherited from mc_rtc::ObjectLoader< State > | |
| std::string | class_name |
| bool | verbose |
| Loader::handle_map_t | handles_ |
| mc_rtc::DataStore | callbacks_ |
| std::unordered_map< std::string, ObjectDeleter > | deleters_ |
Creates State objects based on name and configuration entries.
Also maintains a list of available states.
| mc_control::fsm::StateFactory::StateFactory | ( | const std::vector< std::string > & | paths, |
| const std::vector< std::string > & | files, | ||
| bool | verbose | ||
| ) |
Constructor
| paths | List of paths to load states libraries from |
| states | List of states files (json/yaml) to read states from |
\bool verbose If true, output some warning information
|
inline |
Returns the configuration of a specific state
| StatePtr mc_control::fsm::StateFactory::create | ( | const std::string & | state | ) |
Creates a state but does not start it
This is meant for tools working with the FSM
| StatePtr mc_control::fsm::StateFactory::create | ( | const std::string & | state, |
| const mc_rtc::Configuration & | config | ||
| ) |
Creates a and configures a state but does not start it
This is meant for tools working with the FSM
| StatePtr mc_control::fsm::StateFactory::create | ( | const std::string & | state, |
| Controller & | ctl | ||
| ) |
Creates a state without extra configuration
| StatePtr mc_control::fsm::StateFactory::create | ( | const std::string & | state, |
| Controller & | ctl, | ||
| const mc_rtc::Configuration & | config | ||
| ) |
Creates a state given its name, the owning controller and configuration
The state must have been loaded previously (either as a library or through a state file. Otherwise the returned pointer is nullptr.
| bool mc_control::fsm::StateFactory::hasState | ( | const std::string & | state | ) | const |
Query existence of a state
| void mc_control::fsm::StateFactory::load | ( | const std::map< std::string, mc_rtc::Configuration > & | states | ) |
Load from an mc_rtc::Configuration entry
| void mc_control::fsm::StateFactory::load | ( | const std::string & | name, |
| const std::string & | base, | ||
| const mc_rtc::Configuration & | config | ||
| ) |
Load one state from a configuration entry
Can be used to build a state programatically
| name | Name of the new state provided by this configuration |
| base | Name of the state upon which this state should be based |
| config | New parameters' values |
| void mc_control::fsm::StateFactory::load_files | ( | const std::vector< std::string > & | files | ) |
Load more states files
| void mc_control::fsm::StateFactory::load_libraries | ( | const std::vector< std::string > & | paths | ) |
Load more states libraries
| bool mc_control::fsm::StateFactory::load_with_loader | ( | const std::string & | state | ) |
Load state using a loader state, returns true if a state was loaded
|
inline |
Register a new loading function
| name | Name that will be used to create new instance |
| callback | Callback that will be used to create the object |
| RetT | Must be derived from T |
| LoaderException | if the object is already registered |
| const std::vector<std::string>& mc_control::fsm::StateFactory::states | ( | ) | const |
Returns the list of loaded states