RTT::CommandExecFunction Class Reference

A command which queues (dispatches) a FunctionFraph for execution in a ProgramProcessor. More...

#include <rtt/CommandExecFunction.hpp>

Inheritance diagram for RTT::CommandExecFunction:
RTT::DispatchInterface RTT::ActionInterface

List of all members.

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

 CommandExecFunction (CommandInterface *init_com, boost::shared_ptr< ProgramInterface > foo, ProgramProcessor *p, AssignableDataSource< ProgramInterface * > *v=0, AssignableDataSource< bool > *a=0)
 Create a Command to send a function to a ProgramProcessor.
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 dispatch ()
 Dispatch a command.
bool execute ()
 Execute the functionality of this action.
void reset ()
 After reset(), another attempt to dispatch the command will be made upon execute().
virtual bool sent () const
 Returns true if the command was sent to the CommandProcessor.
virtual bool accepted () const
 Returns true if the command was accepted when sent to the CommandProcessor.
virtual bool executed () const
 Returns true if the command was executed by the CommandProcessor.
virtual bool valid () const
 Returns true if the command was valid, i.e.
virtual bool done () const
 Returns true if the command is done.
ConditionInterfacecreateCondition () const
 Create a condition which checks if this command is finished or not.
DispatchInterfaceclone () const
 The Clone Software Pattern.
DispatchInterfacecopy (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.

Detailed Description

A command which queues (dispatches) a FunctionFraph for execution in a ProgramProcessor.

See ConditionExecFunction to check if it is done or not.

Definition at line 89 of file CommandExecFunction.hpp.


Member Enumeration Documentation

The status progressions of a Dispatchable Command.

The order of these enums is important and should not be altered.

Enumerator:
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.


Constructor & Destructor Documentation

RTT::CommandExecFunction::CommandExecFunction ( CommandInterface init_com,
boost::shared_ptr< ProgramInterface foo,
ProgramProcessor p,
AssignableDataSource< ProgramInterface * > *  v = 0,
AssignableDataSource< bool > *  a = 0 
)

Create a Command to send a function to a ProgramProcessor.

Parameters:
init_com The command to execute before sending the function into the processor, in order to initialise it.
foo The function to run in the processor.
p The target processor which will run the function.
v Implementation specific parameter to support copy/clone semantics.

Member Function Documentation

virtual bool RTT::CommandExecFunction::accepted (  )  const [inline, 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.

Definition at line 152 of file CommandExecFunction.hpp.

DispatchInterface* RTT::CommandExecFunction::copy ( std::map< const DataSourceBase *, DataSourceBase * > &  alreadyCloned  )  const [inline, 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.

Definition at line 182 of file CommandExecFunction.hpp.

bool RTT::CommandExecFunction::dispatch (  )  [inline, virtual]

Dispatch a command.

If it is not accepted, fail, if it is accepted, return true

Implements RTT::DispatchInterface.

Definition at line 120 of file CommandExecFunction.hpp.

bool RTT::CommandExecFunction::execute (  )  [inline, virtual]

Execute the functionality of this action.

Returns:
true if the action was accepted, false otherwise

Implements RTT::ActionInterface.

Definition at line 125 of file CommandExecFunction.hpp.

virtual bool RTT::CommandExecFunction::executed (  )  const [inline, virtual]

Returns true if the command was executed by the CommandProcessor.

When executed() is true, you can check if it was found valid().

Implements RTT::DispatchInterface.

Definition at line 156 of file CommandExecFunction.hpp.

bool RTT::CommandExecFunction::ready (  )  const [inline, 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.

Definition at line 116 of file CommandExecFunction.hpp.

virtual bool RTT::CommandExecFunction::sent (  )  const [inline, 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.

Definition at line 148 of file CommandExecFunction.hpp.

virtual bool RTT::CommandExecFunction::valid (  )  const [inline, virtual]

Returns true if the command was valid, i.e.

the command itself was executed and returned true.

Implements RTT::DispatchInterface.

Definition at line 160 of file CommandExecFunction.hpp.


The documentation for this class was generated from the following file:

Generated on Tue Jul 13 11:03:24 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.1