roboptim::SolverFactory< T > Class Template Reference

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

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

List of all members.

Public Types

typedef T solver_t
 Solver type.
typedef T::problem_t problem_t
 Problem type.

Public Member Functions

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

Detailed Description

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

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:
Tsolver type
Precondition:
T has to be a subtype of Solver<F,C>.

Member Typedef Documentation

template<typename T>
typedef T::problem_t roboptim::SolverFactory< T >::problem_t

Problem type.

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

Solver type.


Constructor & Destructor Documentation

template<typename T >
roboptim::SolverFactory< T >::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 T >
roboptim::SolverFactory< T >::~SolverFactory ( )

Unload the plug-in and free the instantiated solver.


Member Function Documentation

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

Retrieve a reference on the solver.

Returns:
reference on a solver
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines