All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
roboptim::SolverFactory< S > Class Template Reference

Define a solver factory that instanciate the plug-ins. More...

#include <roboptim/core/solver-factory.hh>

Public Types

typedef S solver_t
 Solver type. More...
 
typedef solver_t::problem_t problem_t
 Problem type. More...
 

Public Member Functions

 SolverFactory (std::string solver, const problem_t &problem)
 Instantiate a factory and load the plug-in. More...
 
 ~SolverFactory ()
 Unload the plug-in and free the instantiated solver. More...
 
solver_toperator() ()
 Retrieve a reference on the solver. More...
 

Detailed Description

template<typename S>
class roboptim::SolverFactory< S >

Define a solver factory that instanciate the plug-ins.

The solver factory has to be used to instantiate solvers which are packaged as roboptim-core plug-ins.

This class uses libltdl to handle plug-ins. This lightweight library is provided with GNU Libtool and wraps OS specific behavior into a uniform interface.

Warning
The solver lifetime is bound to the factory lifetime, when the factory goes out of scope, the solver is destroyed too.
Template Parameters
Ssolver type
Precondition
S has to be a subtype of Solver<T>.

Member Typedef Documentation

template<typename S>
typedef solver_t::problem_t roboptim::SolverFactory< S >::problem_t

Problem type.

template<typename S>
typedef S roboptim::SolverFactory< S >::solver_t

Solver type.

Constructor & Destructor Documentation

template<typename S >
roboptim::SolverFactory< S >::SolverFactory ( std::string  solver,
const problem_t problem 
)
explicit

Instantiate a factory and load the plug-in.

The constructor search for the plug-in and load it. If the wanted plug-in can not be found, an exception is thrown.

Parameters
solversolver name (for instance ``cfsqp'')
problemproblem that will be solved
Exceptions
std::runtime_error

References roboptim::demangle(), getSizeOfProblem(), and getTypeIdOfConstraintsList().

template<typename S >
roboptim::SolverFactory< S >::~SolverFactory ( )

Unload the plug-in and free the instantiated solver.

Member Function Documentation

template<typename S >
SolverFactory< S >::solver_t & roboptim::SolverFactory< S >::operator() ( )

Retrieve a reference on the solver.

Returns
reference on a solver