RTT::detail::LocalCommandImpl< CommandT > Class Template Reference

A Command which is dispatched locally to a CommandProcessor. More...

#include <rtt/LocalCommand.hpp>

Inheritance diagram for RTT::detail::LocalCommandImpl< CommandT >:

RTT::detail::CommandBase< CommandT > RTT::detail::BindStorage< CommandT > 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

 LocalCommandImpl ()
 The defaults are reset by the constructor.
CommandProcessorgetCommandProcessor () const
bool isInverted () const
bool invoke ()
 Call this operator if the LocalCommand takes no arguments.
template<class T1 >
bool invoke (T1 a1)
template<class T1 , class T2 >
bool invoke (T1 a1, T2 a2)
template<class T1 , class T2 , class T3 >
bool invoke (T1 a1, T2 a2, T3 a3)
template<class T1 , class T2 , class T3 , class T4 >
bool invoke (T1 a1, T2 a2, T3 a3, T4 a4)
virtual CommandBase< CommandT > * cloneI () const =0
virtual bool ready () const =0
 The command's effect is done.
virtual bool dispatch ()=0
 Dispatch a command.
virtual void reset ()=0
 After reset(), another attempt to dispatch the command will be made upon execute().
virtual bool sent () const =0
 Returns true if the command was sent to the CommandProcessor.
virtual bool accepted () const =0
 Returns true if the command was accepted when sent to the CommandProcessor.
virtual bool executed () const =0
 Returns true if the command was executed by the CommandProcessor.
virtual bool valid () const =0
 Returns true if the command was valid, i.e.
virtual bool done () const =0
 Returns true if the command is done.
virtual ConditionInterfacecreateCondition () const =0
virtual DispatchInterfaceclone () const =0
 The Clone Software Pattern.
virtual 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.
virtual bool execute ()=0
 Execute the functionality of this action.
virtual void readArguments ()=0
 This is invoked some time before execute() at a time when the action may read its function arguments.

Protected Attributes

CommandProcessormcp
bool minvoked
bool maccept
bool mvalid
bool mexec
bool minvert


Detailed Description

template<class CommandT>
class RTT::detail::LocalCommandImpl< CommandT >

A Command which is dispatched locally to a CommandProcessor.

Parameters:
CommandT The function signature of the command. For example, bool( int, Frame, double)

Definition at line 62 of file LocalCommand.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.


Member Function Documentation

virtual bool RTT::DispatchInterface::accepted (  )  const [pure virtual, inherited]

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.

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

Referenced by RTT::DispatchAction::execute().

virtual DispatchInterface* RTT::DispatchInterface::copy ( std::map< const DataSourceBase *, DataSourceBase * > &  alreadyCloned  )  const [inline, virtual, inherited]

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.

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

Definition at line 128 of file DispatchInterface.hpp.

References RTT::DispatchInterface::clone().

Referenced by RTT::DispatchAction::copy().

virtual bool RTT::DispatchInterface::dispatch (  )  [pure virtual, inherited]

Dispatch a command.

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

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

Referenced by RTT::DispatchAction::execute().

virtual bool RTT::ActionInterface::execute (  )  [pure virtual, inherited]

virtual bool RTT::DispatchInterface::executed (  )  const [pure virtual, inherited]

Returns true if the command was executed by the CommandProcessor.

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

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

Referenced by RTT::DispatchAction::execute().

template<class CommandT >
bool RTT::detail::LocalCommandImpl< CommandT >::invoke (  )  [inline]

Call this operator if the LocalCommand takes no arguments.

Returns:
true if ready and succesfully queued.

Definition at line 89 of file LocalCommand.hpp.

References RTT::DispatchInterface::done(), RTT::CommandProcessor::process(), and RTT::DispatchInterface::reset().

virtual bool RTT::DispatchInterface::ready (  )  const [pure virtual, inherited]

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.

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

virtual bool RTT::DispatchInterface::sent (  )  const [pure virtual, inherited]

Returns true if the command was sent to the CommandProcessor.

You can use this flag to check whether execute() was invoked.

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

Referenced by RTT::DispatchAction::execute().

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

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

the command itself was executed and returned true.

Reimplemented from RTT::ActionInterface.

Implemented in RTT::CommandDispatch, RTT::CommandExecFunction, RTT::Corba::CommandProxy, and RTT::detail::DataSourceArgsCommand< CommandT, CommandF >.

Referenced by RTT::DispatchAction::execute(), and RTT::DispatchAction::valid().


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

Generated on Tue Aug 25 14:17:26 2009 for Orocos Real-Time Toolkit by  doxygen 1.5.8