Dispatch a CommandInterface to a CommandProcessor. More...
#include <rtt/CommandDispatch.hpp>
Public Types | |
| enum | Status { NotReady, Ready, Sent, NotAccepted, Accepted, Executed, NotValid, Valid, Done } |
The status progressions of a Dispatchable Command. More... | |
|
typedef boost::shared_ptr < DispatchInterface > | shared_ptr |
| If you want to share ownership of DispatchInterface instances, use this shared_ptr type. | |
Public Member Functions | |
| CommandDispatch (CommandProcessor *p, CommandInterface *c, ConditionInterface *cn) | |
| Create a command to dispatch another command c to a CommandProcessor p. | |
| ~CommandDispatch () | |
| Be sure only to delete this command if the target processor is not processing the encapsulated command. | |
| void | readArguments () |
| This is invoked some time before execute() at a time when the action may read its function arguments. | |
| bool | ready () const |
| The command's effect is done. | |
| bool | execute () |
| Execute the functionality of this action. | |
| bool | dispatch () |
| Dispatch a command. | |
| void | reset () |
| After reset(), another attempt to dispatch the command will be made upon execute(). | |
| bool | sent () const |
| Returns true if the command was sent to the CommandProcessor. | |
| bool | accepted () const |
| Returns true if the command was accepted when sent to the CommandProcessor. | |
| bool | executed () const |
| Returns true if the command was executed by the CommandProcessor. | |
| bool | valid () const |
| Returns true if the command was valid, i.e. | |
| bool | done () const |
| Evaluate if the command is done. | |
| virtual ConditionInterface * | createCondition () const |
| DispatchInterface * | clone () const |
| The Clone Software Pattern. | |
| DispatchInterface * | copy (std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const |
| When copying an Orocos program, we want identical DataSource's to be mapped to identical DataSources, in order for the program to work correctly. | |
Dispatch a CommandInterface to a CommandProcessor.
The execute() method will return false from the moment on that the dispatched command failed. Hence, this execute() must not wrapped in an AsyncCommandDecorator, but directly executed by the caller.
Definition at line 59 of file CommandDispatch.hpp.
enum RTT::DispatchInterface::Status [inherited] |
The status progressions of a Dispatchable Command.
The order of these enums is important and should not be altered.
| Ready |
The command is not yet initialised. |
| Sent |
The command is ready for execution. |
| NotAccepted |
The command has been sent/dispatched to the CommandProcessor. |
| Accepted |
The command was not accepted by the CommandProcessor. |
| Executed |
The command was accepted by the CommandProcessor. |
| NotValid |
The command was executed by the CommandProcessor. |
| Valid |
The command's arguments were found to be invalid. |
| Done |
The command's arguments were valid. |
Definition at line 65 of file DispatchInterface.hpp.
| bool RTT::CommandDispatch::accepted | ( | ) | const [virtual] |
Returns true if the command was accepted when sent to the CommandProcessor.
A Command is accepted when the CommandProcessor was running and its queue was not full.
Implements RTT::DispatchInterface.
| DispatchInterface* RTT::CommandDispatch::copy | ( | std::map< const DataSourceBase *, DataSourceBase * > & | alreadyCloned | ) | const [virtual] |
When copying an Orocos program, we want identical DataSource's to be mapped to identical DataSources, in order for the program to work correctly.
This is different from the clone function, where we simply want a new Action that can replace the old one directly.
This function takes a map that maps the old DataSource's onto their new replacements. This way, it is possible to check before cloning a DataSource, whether it has already been copied, and if so, reuse the existing copy.
To keep old source working, the standard implementation of this function simply calls the clone function. If your ActionInterface uses a DataSource, it is important that you reimplement this function correctly though.
Reimplemented from RTT::DispatchInterface.
| bool RTT::CommandDispatch::dispatch | ( | ) | [virtual] |
Dispatch a command.
If it is not accepted, fail, if it is accepted, return the dispatched command's result status.
Implements RTT::DispatchInterface.
| bool RTT::CommandDispatch::done | ( | ) | const [virtual] |
Evaluate if the command is done.
| true | if accepted(), valid() was true and the completion condition was true as well. | |
| false | otherwise. |
Implements RTT::DispatchInterface.
| bool RTT::CommandDispatch::execute | ( | ) | [virtual] |
Execute the functionality of this action.
Implements RTT::ActionInterface.
| bool RTT::CommandDispatch::executed | ( | ) | const [virtual] |
Returns true if the command was executed by the CommandProcessor.
When executed() is true, you can check its result().
Implements RTT::DispatchInterface.
| bool RTT::CommandDispatch::ready | ( | ) | const [virtual] |
The command's effect is done.
Returns true if the command is ready for dispatch. If ready() returns true, dispatch() can be safely called, otherwise, dispatch() will fail.
Implements RTT::DispatchInterface.
| bool RTT::CommandDispatch::sent | ( | ) | const [virtual] |
Returns true if the command was sent to the CommandProcessor.
You can use this flag to check whether execute() was invoked.
Implements RTT::DispatchInterface.
| bool RTT::CommandDispatch::valid | ( | ) | const [virtual] |
Returns true if the command was valid, i.e.
the command itself was executed and returned true.
Implements RTT::DispatchInterface.
1.6.1