TryCommand.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Tue Dec 21 22:43:08 CET 2004  TryCommand.hpp
00003 
00004                         TryCommand.hpp -  description
00005                            -------------------
00006     begin                : Tue December 21 2004
00007     copyright            : (C) 2004 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.ac.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 #ifndef ORO_TRY_COMMAND_HPP
00040 #define ORO_TRY_COMMAND_HPP
00041 
00042 #include "rtt-scripting-config.h"
00043 #include "../base/ActionInterface.hpp"
00044 #include "ConditionInterface.hpp"
00045 #include "../Logger.hpp"
00046 #include "../internal/DataSource.hpp"
00047 
00048 namespace RTT
00049 { namespace scripting {
00050 
00051 
00052 
00053 
00059     class RTT_SCRIPTING_API TryCommand :
00060         public base::ActionInterface
00061     {
00062         // we must use a internal::DataSource for correct
00063         // copy sementics ...
00064         internal::AssignableDataSource<bool>::shared_ptr _result;
00065         base::ActionInterface* c;
00066     public:
00070         TryCommand( base::ActionInterface* command,
00071                     internal::AssignableDataSource<bool>::shared_ptr storage=0);
00072 
00073         ~TryCommand();
00074 
00075         bool execute();
00076         void reset();
00077 
00078         bool valid() const;
00079 
00080         void readArguments();
00081 
00082         base::ActionInterface* theCommand() const;
00083 
00084         internal::AssignableDataSource<bool>::shared_ptr result();
00085 
00086         TryCommand* clone() const;
00087 
00088         TryCommand* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
00089     };
00090 
00096     class RTT_SCRIPTING_API TryCommandResult :
00097         public ConditionInterface
00098     {
00099         internal::DataSource<bool>::shared_ptr c;
00100         bool _invert;
00101     public:
00109         TryCommandResult( internal::DataSource<bool>::shared_ptr ec, bool invert);
00110 
00111         ~TryCommandResult();
00112 
00113         bool evaluate();
00114 
00115         ConditionInterface* clone() const;
00116 
00117         ConditionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
00118     };
00119 
00127     class RTT_SCRIPTING_API EvalCommand :
00128         public base::ActionInterface
00129     {
00130         // the result
00131         internal::AssignableDataSource<bool>::shared_ptr _cache;
00132         // the data to evaluate in the command.
00133         internal::DataSource<bool>::shared_ptr _ds;
00134     public:
00135         EvalCommand( internal::DataSource<bool>::shared_ptr ds, internal::AssignableDataSource<bool>::shared_ptr cache=0);
00136 
00137         ~EvalCommand();
00138 
00139         void readArguments();
00140 
00141         bool execute();
00142 
00143         void reset();
00144 
00145         internal::AssignableDataSource<bool>::shared_ptr cache();
00146 
00147         base::ActionInterface* clone() const;
00148 
00149         base::ActionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
00150     };
00151 
00157     class RTT_SCRIPTING_API EvalCommandResult :
00158         public ConditionInterface
00159     {
00160         internal::DataSource<bool>::shared_ptr c;
00161     public:
00162         EvalCommandResult( internal::DataSource<bool>::shared_ptr ec);
00163 
00164         ~EvalCommandResult();
00165 
00166         bool evaluate();
00167 
00168         ConditionInterface* clone() const;
00169 
00170         ConditionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
00171     };
00172 }}
00173 
00174 #endif


rtt
Author(s): RTT Developers
autogenerated on Thu Jan 2 2014 11:35:40