#include <mc_solver/GenericLoader.h>
|
static Handle | register_load_function (const std::string &type, load_fun fn) |
|
static void | unregister_load_function (const std::string &type) |
|
static T_ptr | load (mc_solver::QPSolver &solver, const std::string &file) |
|
static T_ptr | load (mc_solver::QPSolver &solver, const char *file) |
|
static T_ptr | load (mc_solver::QPSolver &solver, const mc_rtc::Configuration &config) |
|
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0> |
static std::shared_ptr< U > | load (mc_solver::QPSolver &solver, const std::string &file) |
|
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0> |
static std::shared_ptr< U > | load (mc_solver::QPSolver &solver, const char *file) |
|
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0> |
static std::shared_ptr< U > | load (mc_solver::QPSolver &solver, const mc_rtc::Configuration &config) |
|
template<typename Derived, typename T>
struct mc_solver::GenericLoader< Derived, T >
Retrieve an object using a JSON configuration object and a solver instance
Other objects can register new types that can be loaded through such an interface. If you are writing a new mc_tasks::MetaTask or mc_solver::ConstraintSet you will probably register through mc_tasks::MetaTaskLoader and mc_solver::ConstraintSetLoader respectively.
The CRTP is used to provide an ODR-resilient storage here.
◆ load_fun
template<typename Derived , typename T >
A function that is able to load a T object through a solver instance and JSON configuration
◆ storage_t
template<typename Derived , typename T >
Storage type, actual storage location is returned by Derived::storage()
◆ T_ptr
template<typename Derived , typename T >
◆ load() [1/6]
template<typename Derived , typename T >
Load an object from a file (C-style string)
- Parameters
-
solver | Solver to create the object for |
file | File to load the object from |
- Exceptions
-
If | the file does not exist or the loaded JSON object does not represent a known object |
◆ load() [2/6]
template<typename Derived , typename T >
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0>
Retrieve a more precise object's type from a file (C-style string)
◆ load() [3/6]
template<typename Derived , typename T >
Load an object from an mc_rtc::Configuration object
- Parameters
-
solver | Solver to create the object for |
config | Configuration to load the object from |
- Exceptions
-
If | the loaded JSON object does not represent a known object |
◆ load() [4/6]
template<typename Derived , typename T >
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0>
Retrieve a more precise object's type from a Configuration entry
◆ load() [5/6]
template<typename Derived , typename T >
Load an object from a file
- Parameters
-
solver | Solver to create the object for |
file | File to load the object from |
- Exceptions
-
If | the file does not exist or the loaded JSON object does not represent a known object |
◆ load() [6/6]
template<typename Derived , typename T >
template<typename U , typename std::enable_if<(!std::is_same< U, T >::value) &&std::is_base_of< T, U >::value, int >::type = 0>
Retrieve a more precise object's type from a file
◆ register_load_function()
template<typename Derived , typename T >
Register a new loading function
- Parameters
-
type | Type of the object this function handles. It should match the "type" entry of the expected JSON objects |
fn | Function that will be registered |
◆ unregister_load_function()
template<typename Derived , typename T >
Remove a registered loading function
This is mostly called automatically by the handle returned by register_load_function
- Parameters
-
type | Type of the object to un-register |
The documentation for this struct was generated from the following file: