Callback multiplexer. More...
#include <roboptim/core/callback/multiplexer.hh>
Public Types | |
typedef SolverCallback< S > | parent_t |
Parent type. More... | |
typedef S | solver_t |
Type of the solver. More... | |
typedef solver_t::problem_t | problem_t |
Type of the problem. More... | |
typedef SolverState< problem_t > | solverState_t |
Type of the state of the solver. More... | |
typedef SolverCallback< S > | solverCallback_t |
Solver callback type. More... | |
typedef boost::shared_ptr < solverCallback_t > | solverCallbackPtr_t |
Pointer to a callback. More... | |
typedef std::vector < solverCallbackPtr_t > | solverCallbacks_t |
Type of a vector of callbacks. More... | |
Public Types inherited from roboptim::SolverCallback< S > | |
typedef S | solver_t |
Solver type. More... | |
typedef solver_t::problem_t | problem_t |
Solver problem type. More... | |
typedef solver_t::callback_t | callback_t |
Per-iteration callback type. More... | |
typedef solver_t::solverState_t | solverState_t |
State of the solver. More... | |
Public Member Functions | |
Multiplexer (solver_t &solver) | |
Default constructor containing no callback. More... | |
Multiplexer (solver_t &solver, const solverCallbacks_t &callbacks) | |
Constructor filling the vector of callbacks. More... | |
virtual | ~Multiplexer () |
Virtual destructor. More... | |
solverCallbacks_t & | callbacks () |
Return the vector of callbacks. More... | |
const solverCallbacks_t & | callbacks () const |
Return the vector of callbacks. More... | |
virtual std::ostream & | print (std::ostream &o) const |
Display the callback on the specified output stream. More... | |
Public Member Functions inherited from roboptim::SolverCallback< S > | |
SolverCallback (const std::string &name="unnamed callback") | |
Solver callback constructor. More... | |
virtual | ~SolverCallback () |
Destructor. More... | |
const std::string & | name () const |
Return the name of the callback. More... | |
callback_t | callback () |
Callback function. More... | |
void | operator() (const problem_t &pb, solverState_t &state) |
Evaluate the callback. More... | |
Protected Member Functions | |
virtual void | perIterationCallbackUnsafe (const problem_t &pb, solverState_t &state) |
Meta-callback calling multiple callbacks. More... | |
void | attach () |
Register the multiplexer with the solver. More... | |
void | unregister () |
Unregister the multiplexer from the solver. More... | |
Protected Member Functions inherited from roboptim::SolverCallback< S > | |
virtual void | perIterationCallback (const problem_t &pb, solverState_t &state) |
Wrapper around the callback function that catch exceptions. More... | |
virtual void | perIterationCallbackUnsafe (const problem_t &pb, solverState_t &state)=0 |
The actual callback function. More... | |
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.
S | solver type. |
typedef SolverCallback<S> roboptim::callback::Multiplexer< S >::parent_t |
Parent type.
typedef solver_t::problem_t roboptim::callback::Multiplexer< S >::problem_t |
Type of the problem.
typedef S roboptim::callback::Multiplexer< S >::solver_t |
Type of the solver.
typedef SolverCallback<S> roboptim::callback::Multiplexer< S >::solverCallback_t |
Solver callback type.
typedef boost::shared_ptr<solverCallback_t> roboptim::callback::Multiplexer< S >::solverCallbackPtr_t |
Pointer to a callback.
typedef std::vector<solverCallbackPtr_t> roboptim::callback::Multiplexer< S >::solverCallbacks_t |
Type of a vector of callbacks.
typedef SolverState<problem_t> roboptim::callback::Multiplexer< S >::solverState_t |
Type of the state of the solver.
|
explicit |
Default constructor containing no callback.
solver | solver the multiplexer will attach to. |
References roboptim::callback::Multiplexer< S >::attach().
|
explicit |
Constructor filling the vector of callbacks.
solver | solver the multiplexer will attach to. |
callbacks | a vector of callbacks. |
References roboptim::callback::Multiplexer< S >::attach().
|
virtual |
Virtual destructor.
|
protected |
Register the multiplexer with the solver.
References roboptim::bind().
Referenced by roboptim::callback::Multiplexer< S >::Multiplexer().
Multiplexer< S >::solverCallbacks_t & roboptim::callback::Multiplexer< S >::callbacks | ( | ) |
Return the vector of callbacks.
const Multiplexer< S >::solverCallbacks_t & roboptim::callback::Multiplexer< S >::callbacks | ( | ) | const |
Return the vector of callbacks.
|
protectedvirtual |
Meta-callback calling multiple callbacks.
Unsafe version that can throw exceptions.
pb | problem. |
state | solver state. |
|
virtual |
Display the callback on the specified output stream.
o | output stream used for display. |
Reimplemented from roboptim::SolverCallback< S >.
References roboptim::decindent(), roboptim::iendl(), and roboptim::incindent().
|
protected |
Unregister the multiplexer from the solver.