Orocos Real-Time Toolkit
2.8.3
|
A command which tries another command and stores the result in a internal::DataSource<bool>. More...
#include <rtt/scripting/TryCommand.hpp>
Public Types | |
typedef boost::shared_ptr< ActionInterface > | shared_ptr |
Use this type for shared pointer storage of an ActionInterface object. More... | |
Public Member Functions | |
TryCommand (base::ActionInterface *command, internal::AssignableDataSource< bool >::shared_ptr storage=0) | |
Try a command. More... | |
~TryCommand () | |
bool | execute () |
Execute the functionality of this action. More... | |
void | reset () |
Reset this action. More... | |
bool | valid () const |
Inspect if this action was executed and valid. More... | |
void | readArguments () |
This is invoked some time before execute() at a time when the action may read its function arguments. More... | |
base::ActionInterface * | theCommand () const |
internal::AssignableDataSource< bool >::shared_ptr | result () |
TryCommand * | clone () const |
The Clone Software Pattern. More... | |
TryCommand * | copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const |
When copying an Orocos program, we want identical internal::DataSource's to be mapped to identical DataSources, in order for the program to work correctly. More... | |
A command which tries another command and stores the result in a internal::DataSource<bool>.
Definition at line 59 of file TryCommand.hpp.
|
inherited |
Use this type for shared pointer storage of an ActionInterface object.
Definition at line 78 of file ActionInterface.hpp.
RTT::TryCommand::TryCommand | ( | base::ActionInterface * | command, |
internal::AssignableDataSource< bool >::shared_ptr | storage = 0 |
||
) |
RTT::TryCommand::~TryCommand | ( | ) |
Definition at line 53 of file TryCommand.cpp.
|
virtual |
The Clone Software Pattern.
Implements RTT::base::ActionInterface.
Definition at line 100 of file TryCommand.cpp.
References RTT::base::ActionInterface::clone(), and TryCommand().
|
virtual |
When copying an Orocos program, we want identical internal::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 internal::DataSource's onto their new replacements. This way, it is possible to check before cloning a internal::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 internal::DataSource, it is important that you reimplement this function correctly though.
Reimplemented from RTT::base::ActionInterface.
Definition at line 105 of file TryCommand.cpp.
References RTT::base::ActionInterface::copy(), RTT::internal::AssignableDataSource< T >::copy(), and TryCommand().
|
virtual |
Execute the functionality of this action.
Implements RTT::base::ActionInterface.
Definition at line 56 of file TryCommand.cpp.
References RTT::base::ActionInterface::execute(), RTT::internal::DataSource< T >::get(), and RTT::internal::AssignableDataSource< T >::set().
|
virtual |
This is invoked some time before execute() at a time when the action may read its function arguments.
Implements RTT::base::ActionInterface.
Definition at line 82 of file TryCommand.cpp.
References RTT::base::ActionInterface::readArguments(), and RTT::internal::AssignableDataSource< T >::set().
|
virtual |
Reset this action.
Must be used after execute() failed.
Reimplemented from RTT::base::ActionInterface.
Definition at line 70 of file TryCommand.cpp.
References RTT::base::ActionInterface::reset(), and RTT::internal::AssignableDataSource< T >::set().
AssignableDataSource< bool >::shared_ptr RTT::TryCommand::result | ( | ) |
Definition at line 96 of file TryCommand.cpp.
Referenced by RTT::scripting::ProgramGraphParser::parseFunction().
ActionInterface * RTT::TryCommand::theCommand | ( | ) | const |
Definition at line 92 of file TryCommand.cpp.
|
virtual |
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 from RTT::base::ActionInterface.
Definition at line 75 of file TryCommand.cpp.
References RTT::internal::DataSource< T >::get(), and RTT::base::ActionInterface::valid().