A user friendly Command to a TaskContext. More...
#include <rtt/CommandC.hpp>
Public Member Functions | |
CommandC () | |
The default constructor Make a copy from another CommandC object in order to make it usable. | |
CommandC (const CommandFactory *gcf, const std::string &name) | |
The constructor. | |
CommandC (const CommandC &other) | |
A CommandC is copyable by value. | |
CommandC (DispatchInterface *di) | |
Create a CommandC object from a dispatch command. | |
CommandC (DispatchInterface::shared_ptr di) | |
Create a CommandC object from a dispatch command. | |
CommandC & | operator= (const CommandC &other) |
A CommandC is assignable. | |
CommandC & | arg (DataSourceBase::shared_ptr a) |
Add a datasource argument to the Command. | |
template<class ArgT > | |
CommandC & | argC (const ArgT a) |
Add a constant argument to the Command. | |
template<class ArgT > | |
CommandC & | arg (ArgT &a) |
Add an argument by reference to the Command. | |
bool | ready () const |
Returns true if all correct arguments were provided and the command is ready for execution. | |
bool | execute () |
Send the contained command to the Command Processor and report Status. | |
bool | sent () const |
Returns true if the command was sent to the CommandProcessor. | |
bool | accepted () const |
Check if the Command was accepted by the receiving task. | |
bool | executed () const |
Check if the Command was executed by the receiving task. | |
bool | valid () const |
Check the return value of the Command when it is executed. | |
bool | done () const |
Evaluate if the command is done. | |
void | reset () |
Reset the command. |
A user friendly Command to a TaskContext.
Definition at line 55 of file CommandC.hpp.
RTT::CommandC::CommandC | ( | const CommandFactory * | gcf, | |
const std::string & | name | |||
) |
The constructor.
RTT::CommandC::CommandC | ( | DispatchInterface * | di | ) |
RTT::CommandC::CommandC | ( | DispatchInterface::shared_ptr | di | ) |
Create a CommandC object from a dispatch command.
di | The command shares ownership of di. |
bool RTT::CommandC::accepted | ( | ) | const |
Check if the Command was accepted by the receiving task.
true | if accepted by the command processor. | |
false | otherwise. |
CommandC & RTT::CommandC::arg | ( | ArgT & | a | ) | [inline] |
Add an argument by reference to the Command.
a | A value of which the reference is used and re-read each time the command is executed. Thus if the contents of the source of a changes, execute() will use the new contents. |
Definition at line 199 of file CommandC.hpp.
References arg().
CommandC& RTT::CommandC::arg | ( | DataSourceBase::shared_ptr | a | ) |
Add a datasource argument to the Command.
a | A DataSource which contents are consulted each time when execute() is called. |
CommandC & RTT::CommandC::argC | ( | const ArgT | a | ) | [inline] |
Add a constant argument to the Command.
a | A value of which a copy is made and this value is used each time in execute(). |
Definition at line 193 of file CommandC.hpp.
References arg().
bool RTT::CommandC::done | ( | ) | const |
Evaluate if the command is done.
true | if accepted(), valid() was true and the completion condition was true as well. | |
false | otherwise. |
bool RTT::CommandC::execute | ( | ) |
Send the contained command to the Command Processor and report Status.
Multiple invocations of execute will send the command only once, and will return the 'status' of the Command. From the moment an error is detected (for example, rejection by the Command Processor or invalid Command), this method will return false. Use reset() to restart this cycle.
Referenced by RTT::detail::RemoteCommandImpl< CommandT >::invoke().
bool RTT::CommandC::executed | ( | ) | const |
void RTT::CommandC::reset | ( | ) |
Reset the command.
Required before invoking execute() a second time.
bool RTT::CommandC::sent | ( | ) | const |
Returns true if the command was sent to the CommandProcessor.
You can use this flag to check whether execute() was invoked.
bool RTT::CommandC::valid | ( | ) | const |
Check the return value of the Command when it is executed.
true | if accepted() and the command returned true, indicating that it is valid. | |
false | otherwise. |