39 #ifndef ORO_CMD_FUNCTION_HPP 40 #define ORO_CMD_FUNCTION_HPP 42 #include "../SendStatus.hpp" 43 #include "../base/ActionInterface.hpp" 44 #include "../base/DisposableInterface.hpp" 46 #include "../internal/DataSources.hpp" 48 #include "../internal/DataSource.hpp" 49 #include "../ExecutionEngine.hpp" 50 #include <boost/shared_ptr.hpp> 51 #include <boost/bind.hpp> 56 {
namespace scripting {
57 using namespace detail;
70 boost::shared_ptr<ProgramInterface>
_foo;
84 boost::shared_ptr<ProgramInterface>
foo,
88 mrunner(p), mcaller(caller),
89 _foo( foo ), ss(
SendFailure), isqueued(false), maccept(false)
101 if (isqueued ==
false ) {
108 if ( _foo->needsStart() ) {
115 if ( _foo->inError() ) {
118 if ( _foo->isStopped() ) {
122 cout <<
"CmdFunction threw an exception" <<
endl;
152 CmdFunction*
copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned )
const 155 if ( alreadyCloned[
this] == 0 ) {
156 boost::shared_ptr<ProgramInterface> fcpy( _foo->copy(alreadyCloned) );
157 alreadyCloned[
this] =
new CmdFunction( minit->
copy(alreadyCloned), fcpy , mrunner, mcaller);
160 assert ( dynamic_cast<CmdFunction*>( alreadyCloned[
this] ) == static_cast<CmdFunction*>( alreadyCloned[
this] ) );
161 return static_cast<CmdFunction*
>( alreadyCloned[
this] );
virtual CmdCollectCondition * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
virtual SendStatus const & rvalue() const
CmdFunction * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
virtual bool removeFunction(base::ExecutableInterface *f)
boost::shared_ptr< ProgramInterface > _foo
The base class for all internal data representations.
virtual CmdCollectCondition * clone() const
This interface represents the concept of a condition which can be evaluated and return true or false...
CmdFunction * clone() const
bool evaluate()
Evaluate the Condition and return the outcome.
virtual void readArguments()=0
base::ActionInterface * minit
virtual DataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const =0
virtual SendStatus value() const
virtual ActionInterface * clone() const =0
virtual const_reference_t rvalue() const =0
Based on the software pattern 'command', this interface allows execution of action objects...
virtual bool evaluate() const
basic_ostreams & endl(basic_ostreams &s)
DataSource< SendStatus >::shared_ptr collectds
CmdFunction(base::ActionInterface *init_com, boost::shared_ptr< ProgramInterface > foo, ExecutionEngine *p, ExecutionEngine *caller)
ExecutionEngine * mrunner
CmdCollectCondition(DataSource< SendStatus >::shared_ptr ds)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
ExecutionEngine * mcaller
virtual bool runFunction(base::ExecutableInterface *f)
virtual ActionInterface * copy(std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const