21 #ifndef TASKINTERFACE_HPP 22 #define TASKINTERFACE_HPP 46 virtual bool run ( Data& d ) = 0;
48 if ( next_ )
delete next_;
79 if ( t == NULL )
return *
this;
83 }
else return ( *next_ ) ( t );
86 if ( t == NULL )
return *
this;
90 }
else return ( *next_ ) ( t );
134 ,
"TaskFunctor not properly initialized with a task and a data objects" ) ) {
TaskFunctor(TaskFunctor< Data > const &tf)
TaskInterface()
Constructor.
bool chainrun(Data &d)
Implements chain of responsability. Calls run method and, if there is another task, call its run method too.
Templated (hybrid) Interface for Task classes.
Simple functor that accepts an interface and pointer to the data object in which it will have to run ...
TaskFunctor(TaskInterface< Data > *ti, Data *d)
TaskInterface & appendTask(TaskInterface *t)
Appends a task class. If there is no task, append here, otherwise delegate in next task...
virtual bool run(Data &d)=0
#define USER_CHECK(exp, comment)
Tests whether exp is true. If not, comment is printed and program ends.
TaskInterface * getTask()
Return appended task.