List of all members | Public Member Functions
functor< T > Class Template Reference

Functor class for interfacing algorithms. More...

Inheritance diagram for functor< T >:

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::ptrsettings () const
 Returns a smart pointer to the settings. More...
 
const revkit::properties::ptrstatistics () const
 Returns a smart pointer to the statistics. More...
 

Detailed Description

template<typename T>
class revkit::functor< T >

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.

Author
RevKit
Since
1.0

Constructor & Destructor Documentation

functor ( )
inline

Default constructor.

Calls the constructor of the base class.

Author
RevKit
Since
1.0
functor ( f)
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().

Parameters
fObject to be assigned
Author
RevKit
Since
1.0

Member Function Documentation

void init ( const properties::ptr settings,
const properties::ptr statistics 
)
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:

typedef functor<bool(circuit&, const binary_truth_table&)> truth_table_synthesis_func;
...
truth_table_synthesis_func swop_func( properties::ptr settings, properties::ptr statistics )
{
truth_table_synthesis_func f = boost::bind( swop, _1, settings, statistics );
f.init( settings, statistics );
return f;
}

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.

Parameters
settingsSettings properties
statisticsStatistics properties
Author
RevKit
Since
1.0
const revkit::properties::ptr& settings ( ) const
inline

Returns a smart pointer to the settings.

This smart pointer can be empty, if init() was never called.

Returns
A smart pointer to the settings
const revkit::properties::ptr& statistics ( ) const
inline

Returns a smart pointer to the statistics.

This smart pointer can be empty, if init() was never called.

Returns
A smart pointer to the statistics

The documentation for this class was generated from the following file:

Generated on Tue Apr 16 2013 08:12:02 for RevKit by doxygen 1.8.3.1