roboptim::SolverFactory< T > Class Template Reference
Optimization problems

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

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

## Public Types

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

## Public Member Functions

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

## 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

  T | solver 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
| ) |  |
throw | ( | std::runtime_error
| ) |  |

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

  solver | solver name (for instance ``cfsqp'')
  problem | problem that will be solved

References getSizeOfProblem().

template<typename T >

roboptim::SolverFactory< T >::~SolverFactory | ( |  | ) |
throw | ( |
| ) |  |

Unload the plug-in and free the instantiated solver.

## Member Function Documentation

template<typename T >

SolverFactory< T >::solver_t & roboptim::SolverFactory< T >::operator() | ( |  | ) |
throw | ( |
| ) |  |

Retrieve a reference on the solver.

Returns
  reference on a solver