Functor class for interfacing algorithms. More...
Public Member Functions | |
functor () | |
Default constructor. More... | |
template<typename F > | |
functor (F f) | |
Copy constructor. More... | |
void | init (const properties::ptr &settings, const properties::ptr &statistics) |
Initializes the settings and statistics fields. More... | |
const revkit::properties::ptr & | settings () const |
Returns a smart pointer to the settings. More... | |
const revkit::properties::ptr & | statistics () const |
Returns a smart pointer to the statistics. More... | |
Functor class for interfacing algorithms.
When interfacing an algorithm, we wanna encapsulate the settings and the statistics. That is, a user can still provide settings from outside, but another algorithm can change settings of a functor as well. Therewith, this class extends the boost::function object by adding methods to access the corresponding settings and statistics data from the respective algorithm.
|
inline |
Default constructor.
Calls the constructor of the base class.
|
inline |
Copy constructor.
This copy constructor allows for example, the assignment of other boost::function objects or even boost::bind or boost::lambda expressions. Note, that the settings and statistics are not set with this constructor, but have to be assigned explicitly using init().
f | Object to be assigned |
|
inline |
Initializes the settings and statistics fields.
This method is usually called by the functor creation function to assign the settings and statistics data, e.g. in swop_func:
In this example, the settings and statistics objects are given as parameters to the swop function in the boost::bind expression, so that they are available when calling the algorithm. Further they are passed to the functor explicitly via init() to make them available using the functor, e.g. in other algorithms.
settings | Settings properties |
statistics | Statistics properties |
|
inline |
Returns a smart pointer to the settings.
This smart pointer can be empty, if init() was never called.
|
inline |
Returns a smart pointer to the statistics.
This smart pointer can be empty, if init() was never called.