ParsedStateMachine.hpp

00001 /***************************************************************************
00002   tag: Peter Soetens  Tue Jul 20 17:33:09 CEST 2004  ParsedStateMachine.hpp
00003 
00004                         ParsedStateMachine.hpp -  description
00005                            -------------------
00006     begin                : Tue July 20 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 CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP
00040 #define CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP
00041 
00042 #include "../StateMachine.hpp"
00043 #include "../DataSource.hpp"
00044 #include <boost/shared_ptr.hpp>
00045 
00046 namespace RTT
00047 {
00048     class TaskObject;
00049     class StateMachineTask;
00050 
00051     class ParsedStateMachine;
00052     typedef boost::shared_ptr<ParsedStateMachine> ParsedStateMachinePtr;
00053     typedef boost::weak_ptr<ParsedStateMachine> ParsedStateMachineWPtr;
00054 
00058     class ParsedStateMachine
00059         : public StateMachine
00060     {
00061         typedef std::map<std::string, AttributeBase*> VisibleWritableValuesMap;
00062     protected:
00063         virtual void handleUnload();
00064     public:
00065         ParsedStateMachine();
00066         virtual ~ParsedStateMachine();
00067 
00071         ParsedStateMachinePtr copy( std::map<const DataSourceBase*, DataSourceBase*>& replacements, bool instantiate = false ) const;
00072 
00073         void addParameter( const std::string& name, AttributeBase* var );
00074 
00075         AttributeBase* getParameter( const std::string& name ) const;
00076         VisibleWritableValuesMap getParameters() const;
00077         std::vector<std::string> getParameterNames() const;
00078 
00084         void setName( const std::string& name, bool recursive );
00085 
00086         std::string getText() const;
00087 
00088         void setText( std::string text);
00089 
00090         StateMachineTask* getTaskObject() const;
00091 
00092         void setTaskObject(StateMachineTask* tc);
00093 
00094         bool inState( const std::string& name );
00098         void finish();
00099     private:
00100         VisibleWritableValuesMap parametervalues;
00101 
00102         boost::shared_ptr<std::string> _text;
00103 
00104         StateMachineTask* object;
00105     };
00106 }
00107 
00108 #endif
Generated on Thu Dec 23 13:22:38 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3