RTT::AsynchCommandDecorator Class Reference

Based on the software patterns 'command' and 'decorator', this interface represents a wrapper around a given command, which decorates that command as an asynchronous command. More...

#include <rtt/AsynchCommandDecorator.hpp>

Inheritance diagram for RTT::AsynchCommandDecorator:
RTT::ActionInterface

List of all members.

Public Types

typedef boost::shared_ptr
< ActionInterface
shared_ptr
 Use this type for shared pointer storage of an ActionInterface object.

Public Member Functions

 AsynchCommandDecorator (CommandInterface *cmd)
 Construct a new decorator with given command.
 AsynchCommandDecorator (const AsynchCommandDecorator &orig)
void readArguments ()
 This is invoked some time before execute() at a time when the action may read its function arguments.
virtual bool execute ()
 Execute the functionality of the corresponding command.
virtual void reset ()
 Reset this action.
const CommandInterfacegetCommand () const
virtual CommandInterfaceclone () const
 The Clone Software Pattern.
virtual CommandInterfacecopy (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.
virtual bool valid () const
 Inspect if this action was executed and valid.

Detailed Description

Based on the software patterns 'command' and 'decorator', this interface represents a wrapper around a given command, which decorates that command as an asynchronous command.

The command will be executed once, until reset() and the result of this invocation will be returned.

If the command fails when executed, no more attempts will be done to execute it again, and execute() will return false until the AsynchCommandDecorator is reset().

Definition at line 64 of file AsynchCommandDecorator.hpp.


Constructor & Destructor Documentation

RTT::AsynchCommandDecorator::AsynchCommandDecorator ( CommandInterface cmd  ) 

Construct a new decorator with given command.

Precondition:
cmd != 0
Parameters:
cmd The command to be decorated
Postcondition:
The given command is decorated as an asynchronous command.

Member Function Documentation

virtual CommandInterface* RTT::AsynchCommandDecorator::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::ActionInterface.

virtual void RTT::AsynchCommandDecorator::reset (  )  [virtual]

Reset this action.

Must be used after execute() failed.

Reimplemented from RTT::ActionInterface.

virtual bool RTT::ActionInterface::valid (  )  const [virtual, inherited]

Inspect if this action was executed and valid.

This method may not be called before execute(). The default implementation returns always true, i.e. after execute(), it was executed. Override this method if it has more complex state semantics.

Reimplemented in RTT::CommandComposite, RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, RTT::detail::DataSourceArgsCommand< CommandT, CommandF >, RTT::DispatchAction, RTT::DispatchInterface, and RTT::TryCommand.


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