#include <rtt/RunnableInterface.hpp>

Applications should always use this class instead of the OS version.
The getActivity() method is guaranteed to return a valid task pointer during initialize(), step() or loop() and finalize(). This allows the RunnableInterface to query the task's period(icity) and ThreadInterface. Consequently, initialize() knows whether step() or loop() will be called ( depending on ActivityInterface::isPeriodic() ).
Definition at line 60 of file RunnableInterface.hpp.
Public Member Functions | |
| ~RunnableInterface () | |
| Checks if this is still in a task and if so, issues a critical warning. | |
| ActivityInterface * | getActivity () const |
| virtual void | setActivity (ActivityInterface *task) |
| virtual bool | initialize ()=0 |
| The method that will be called before the first periodical execution of step() ( or non periodical execution of loop() ), when the thread is started. | |
| virtual void | step ()=0 |
| The method that will be periodically executed when this class is run in a periodic thread. | |
| virtual void | loop () |
| The method that will be executed once when this class is run in a non periodic thread. | |
| virtual bool | breakLoop () |
| This method is called by the framework to break out of the loop() method. | |
| virtual void | finalize ()=0 |
| The method that will be called after the last periodical execution of step() ( or non periodical execution of loop() ), when the RunnableInterface is stopped. | |
| ThreadInterface * | getThread () const |
| Get the thread this object is run in. | |
| virtual void | setThread (ThreadInterface *t) |
| Set the thread this object will be run in. | |
| ActivityInterface* getActivity | ( | ) | const [inline] |
Query for the task this interface is run in.
Zero denotes that no task is present to run it, and hence no detailed information is available.
| virtual void setActivity | ( | ActivityInterface * | task | ) | [virtual] |
Set the task this interface is run in.
A Zero means no task is running it.
| task | The ActivityInterface running this interface. |
| void loop | ( | ) | [virtual, inherited] |
The method that will be executed once when this class is run in a non periodic thread.
The default implementation calls step() once.
Reimplemented in Timer.
Definition at line 60 of file RunnableInterface.cpp.
References RunnableInterface::step().
Referenced by SlaveActivity::execute(), SingleThread::loop(), and NonPeriodicActivity::loop().
| bool breakLoop | ( | ) | [virtual, inherited] |
This method is called by the framework to break out of the loop() method.
Reimplement this method to signal loop() to return and return true on success. When this method is not reimplemented by you, it will always return false, denoting that the loop can not be broken. If breakLoop() returns true, the caller will wait until loop() returns.
Reimplemented in EventProcessor, ExecutionEngine, and Timer.
Definition at line 62 of file RunnableInterface.cpp.
Referenced by SingleThread::breakLoop(), NonPeriodicActivity::breakLoop(), and SlaveActivity::stop().
| ThreadInterface * getThread | ( | ) | const [inherited] |
Get the thread this object is run in.
Definition at line 69 of file RunnableInterface.cpp.
Referenced by Timer::initialize().
1.5.3