roboptim::callback::Multiplexer< S > Class Template Reference

Callback multiplexer. More...

#include <roboptim/core/callback/multiplexer.hh>

List of all members.

Public Types

typedef S solver_t
 Type of the solver.
typedef solver_t::problem_t problem_t
 Type of the problem.
typedef SolverState< problem_tsolverState_t
 Type of the state of the solver.
typedef solver_t::callback_t callback_t
 Callback function type.
typedef std::vector< callback_tcallbacks_t
 Type of a vector of callbacks.

Public Member Functions

 Multiplexer (solver_t &solver)
 Default constructor containing no callback.
 Multiplexer (solver_t &solver, const callbacks_t &callbacks)
 Constructor filling the vector of callbacks.
virtual ~Multiplexer ()
 Virtual destructor.
callbacks_tcallbacks ()
 Return the vector of callbacks.
const callbacks_tcallbacks () const
 Return the vector of callbacks.

Protected Member Functions

void perIterationCallback (const problem_t &pb, solverState_t &state)
 Meta-callback calling multiple callbacks.
virtual void perIterationCallbackUnsafe (const problem_t &pb, solverState_t &state)
 Meta-callback calling multiple callbacks.
void attach ()
 Register the multiplexer with the solver.
void unregister ()
 Unregister the multiplexer from the solver.

Detailed Description

template<typename S>
class roboptim::callback::Multiplexer< S >

Callback multiplexer.

This class turns multiple callback functions into one. Note that callbacks are processed in the order of the vector of functions provided. Beware of conflicts between multiple callbacks.

Template Parameters:
Ssolver type.

Member Typedef Documentation

Callback function type.

template<typename S >
typedef std::vector<callback_t> roboptim::callback::Multiplexer< S >::callbacks_t

Type of a vector of callbacks.

template<typename S >
typedef solver_t::problem_t roboptim::callback::Multiplexer< S >::problem_t

Type of the problem.

template<typename S >
typedef S roboptim::callback::Multiplexer< S >::solver_t

Type of the solver.

Type of the state of the solver.


Constructor & Destructor Documentation

template<typename S >
roboptim::callback::Multiplexer< S >::Multiplexer ( solver_t solver) [explicit]

Default constructor containing no callback.

Parameters:
solversolver the multiplexer will attach to.

References roboptim::callback::Multiplexer< S >::attach().

template<typename S >
roboptim::callback::Multiplexer< S >::Multiplexer ( solver_t solver,
const callbacks_t callbacks 
) [explicit]

Constructor filling the vector of callbacks.

Parameters:
solversolver the multiplexer will attach to.
callbacksa vector of callbacks.

References roboptim::callback::Multiplexer< S >::attach().

template<typename S >
roboptim::callback::Multiplexer< S >::~Multiplexer ( ) [virtual]

Virtual destructor.


Member Function Documentation

template<typename S >
void roboptim::callback::Multiplexer< S >::attach ( ) [protected]

Register the multiplexer with the solver.

References roboptim::bind().

Referenced by roboptim::callback::Multiplexer< S >::Multiplexer().

template<typename S >
Multiplexer< S >::callbacks_t & roboptim::callback::Multiplexer< S >::callbacks ( )

Return the vector of callbacks.

Returns:
vector of callbacks.
template<typename S >
const Multiplexer< S >::callbacks_t & roboptim::callback::Multiplexer< S >::callbacks ( ) const

Return the vector of callbacks.

Returns:
vector of callbacks.
template<typename S >
void roboptim::callback::Multiplexer< S >::perIterationCallback ( const problem_t pb,
solverState_t state 
) [protected]

Meta-callback calling multiple callbacks.

Parameters:
pbproblem.
statesolver state.
template<typename S >
void roboptim::callback::Multiplexer< S >::perIterationCallbackUnsafe ( const problem_t pb,
solverState_t state 
) [protected, virtual]

Meta-callback calling multiple callbacks.

Unsafe version that can throw exceptions.

Parameters:
pbproblem.
statesolver state.
template<typename S >
void roboptim::callback::Multiplexer< S >::unregister ( ) [protected]

Unregister the multiplexer from the solver.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines