#include <rtt/SlaveActivity.hpp>

The SlaveActivity can only be started if the master is active or if no master is present. If a master is used, this activity takes periodicity over from the master. If no master is present, use one of the alternative constructors to make a periodic slave or a non periodic slave.
Definition at line 75 of file SlaveActivity.hpp.
Public Member Functions | |
| SlaveActivity (ActivityInterface *master, RunnableInterface *run=0) | |
| Create an activity which is the slave of master. | |
| SlaveActivity (double period, RunnableInterface *run=0) | |
| Create an activity which is periodic. | |
| SlaveActivity (RunnableInterface *run=0) | |
| Create an activity for which trigger() will not be periodically called. | |
| ~SlaveActivity () | |
| Cleanup and notify the RunnableInterface that we are gone. | |
| Seconds | getPeriod () const |
| Get the periodicity of this activity in Seconds. | |
| OS::ThreadInterface * | thread () |
| Returns a pointer to the thread which will run this activity. | |
| bool | initialize () |
| void | step () |
| void | loop () |
| bool | breakLoop () |
| void | finalize () |
| bool | start () |
| Start this slave. | |
| bool | stop () |
| Stop the activity This will stop the activity by removing it from the 'run-queue' of a thread or call RunnableInterface::breakLoop(). | |
| bool | isRunning () const |
| Query if the activity is initialized and executing. | |
| bool | run (RunnableInterface *_r) |
| Run exclusively this RunnableInterface. | |
| bool | isPeriodic () const |
| Inspect if this activity is periodic. | |
| bool | isActive () const |
| Query if the activity is started. | |
| bool | execute () |
| Execute this activity such that it executes a step or loop of the RunnableInterface. | |
| bool | trigger () |
| Trigger that work has to be done. | |
| SlaveActivity | ( | ActivityInterface * | master, | |
| RunnableInterface * | run = 0 | |||
| ) |
Create an activity which is the slave of master.
| master | The activity which will execute this activity. | |
| run | Run this instance. |
Definition at line 44 of file SlaveActivity.cpp.
| SlaveActivity | ( | double | period, | |
| RunnableInterface * | run = 0 | |||
| ) |
Create an activity which is periodic.
If period == 0.0, this constructor is equivalent to the one below for non periodic activities.
| period | The periodicity at which you will trigger() this activity. | |
| run | Run this instance. |
Definition at line 51 of file SlaveActivity.cpp.
| SlaveActivity | ( | RunnableInterface * | run = 0 |
) |
Create an activity for which trigger() will not be periodically called.
The period of this activity will be 0.0.
| run | Run this instance. |
Definition at line 58 of file SlaveActivity.cpp.
| Seconds getPeriod | ( | ) | const [virtual] |
Get the periodicity of this activity in Seconds.
Implements ActivityInterface.
Definition at line 72 of file SlaveActivity.cpp.
| OS::ThreadInterface * thread | ( | ) | [virtual] |
Returns a pointer to the thread which will run this activity.
Will not be null.
Implements ActivityInterface.
Definition at line 77 of file SlaveActivity.cpp.
References MainThread::Instance(), and ActivityInterface::thread().
| bool start | ( | ) | [virtual] |
Start this slave.
Only allowed if the master activity is already running.
| false | if !master->isRunning() || this->isRunning() || initialize() returns false | |
| true | othwerise. |
Implements ActivityInterface.
Definition at line 106 of file SlaveActivity.cpp.
References RunnableInterface::initialize(), ActivityInterface::isActive(), and SlaveActivity::isPeriodic().
| bool stop | ( | ) | [virtual] |
Stop the activity This will stop the activity by removing it from the 'run-queue' of a thread or call RunnableInterface::breakLoop().
If no errors occured, RunnableInterface::finalize() is called.
Implements ActivityInterface.
Definition at line 122 of file SlaveActivity.cpp.
References RunnableInterface::breakLoop(), RunnableInterface::finalize(), and SlaveActivity::isPeriodic().
Referenced by SlaveActivity::~SlaveActivity().
| bool isRunning | ( | ) | const [virtual] |
Query if the activity is initialized and executing.
This is more strict than isActive(), it is only true after initialize() is executed and before finalize() is executed. More-over, an Activity may decide to be temporarily not running (not executing code), waiting for a signal to proceed. If this->isActive() and !this->isRunning() then the Activity is in a waiting state.
Implements ActivityInterface.
Definition at line 142 of file SlaveActivity.cpp.
| bool run | ( | RunnableInterface * | r | ) | [virtual] |
Run exclusively this RunnableInterface.
| r | The RunnableInterface to run exclusively. |
Implements ActivityInterface.
Definition at line 147 of file SlaveActivity.cpp.
| bool isPeriodic | ( | ) | const [virtual] |
Inspect if this activity is periodic.
If so, it will call RunnableInterface::step(). If the activity is not periodic, it will call RunnableInterface::loop().
Implements ActivityInterface.
Definition at line 159 of file SlaveActivity.cpp.
Referenced by SlaveActivity::start(), and SlaveActivity::stop().
| bool isActive | ( | ) | const [virtual] |
Query if the activity is started.
This is less strict than isRunning(), it is true during initialize(), step() or loop() and finalize(). Use this method to check if an activity was start()ed.
Implements ActivityInterface.
Definition at line 163 of file SlaveActivity.cpp.
| bool execute | ( | ) | [virtual] |
Execute this activity such that it executes a step or loop of the RunnableInterface.
When you invoke execute() you intend to call the step() or loop() methods. Some activity implementations allow a user controlled execute, others ignore it.
| true | When this->isActive() and the implementation allows external executes. | |
| false | When !this->isActive() or the implementation does not allow external updating. |
Implements ActivityInterface.
Definition at line 175 of file SlaveActivity.cpp.
References RunnableInterface::loop(), and RunnableInterface::step().
| bool trigger | ( | ) | [virtual] |
Trigger that work has to be done.
When you invoke trigger(), you intend to notify the mechanism that calls execute(), that execute() should be called. This allows a separation between actually executing code (execute()) and notifying that code must be executed (trigger()). A trigger may be ignored by the implementation, in which case trigger returns false.
| true | When this->isActive() and the implementation allows external triggers. | |
| false | When !this->isActive() or the implementation does not allow external triggering. |
Implements ActivityInterface.
Definition at line 168 of file SlaveActivity.cpp.
References ActivityInterface::trigger().
1.5.6