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

Callback multiplexer. More...

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

Inheritance diagram for roboptim::callback::Multiplexer< S >:
roboptim::SolverCallback< S >

List of all members.

Public Types

typedef SolverCallback< S > parent_t
 Parent type.
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 SolverCallback< S > solverCallback_t
 Solver callback type.
typedef boost::shared_ptr
< solverCallback_t
solverCallbackPtr_t
 Pointer to a callback.
typedef std::vector
< solverCallbackPtr_t
solverCallbacks_t
 Type of a vector of callbacks.

Public Member Functions

 Multiplexer (solver_t &solver)
 Default constructor containing no callback.
 Multiplexer (solver_t &solver, const solverCallbacks_t &callbacks)
 Constructor filling the vector of callbacks.
virtual ~Multiplexer ()
 Virtual destructor.
solverCallbacks_tcallbacks ()
 Return the vector of callbacks.
const solverCallbacks_tcallbacks () const
 Return the vector of callbacks.
virtual std::ostream & print (std::ostream &o) const
 Display the callback on the specified output stream.

Protected Member Functions

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

template<typename S >
typedef SolverCallback<S> roboptim::callback::Multiplexer< S >::parent_t

Parent type.

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

Type of the problem.

Reimplemented from roboptim::SolverCallback< S >.

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

Type of the solver.

Reimplemented from roboptim::SolverCallback< S >.

template<typename S >
typedef SolverCallback<S> roboptim::callback::Multiplexer< S >::solverCallback_t

Solver callback type.

template<typename S >
typedef boost::shared_ptr<solverCallback_t> roboptim::callback::Multiplexer< S >::solverCallbackPtr_t

Pointer to a callback.

template<typename S >
typedef std::vector<solverCallbackPtr_t> roboptim::callback::Multiplexer< S >::solverCallbacks_t

Type of a vector of callbacks.

Type of the state of the solver.

Reimplemented from roboptim::SolverCallback< S >.


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 solverCallbacks_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().

Return the vector of callbacks.

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

Return the vector of callbacks.

Returns:
vector of callbacks.
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 >
std::ostream & roboptim::callback::Multiplexer< S >::print ( std::ostream &  o) const [virtual]

Display the callback on the specified output stream.

Parameters:
ooutput stream used for display.
Returns:
output stream.

Reimplemented from roboptim::SolverCallback< S >.

References roboptim::decindent(), roboptim::iendl(), and roboptim::incindent().

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 Defines