SourceForge Project Site
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

FSMAction.h

Go to the documentation of this file.
00001 #if !defined(AFX_FSMACTION_H__7C6ABC20_3696_40ED_9DC4_8C06E73BFC85__INCLUDED_)
00002 #define AFX_FSMACTION_H__7C6ABC20_3696_40ED_9DC4_8C06E73BFC85__INCLUDED_
00003 
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 
00008 /*
00009  * The Finite State Machine (FSM) Library
00010  * Copyright (C) 2002 Siemens C-LAB Paderborn
00011  * All rights reserved.
00012  *
00013  * This program is  free  software;  you can redistribute it and/or modify it
00014  * under the terms of the  GNU Lesser General Public License  as published by 
00015  * the  Free Software Foundation;  either version 2.1 of the License,  or (at 
00016  * your option) any later version.
00017  *
00018  * This  program  is  distributed in  the  hope that it will  be useful,  but
00019  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00020  * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public  
00021  * License for more details.
00022  *
00023  * You should  have received  a copy of the GNU Lesser General Public License
00024  * along with  this program;  if not, write to the  Free Software Foundation,
00025  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
00026  */
00027 
00028 // $Log: FSMAction.h,v $
00029 // Revision 1.2  2002/08/20 14:48:41  vofka
00030 // FiniteStateMachine-config.h removed from installing. Loading exported to the loader class. Saver introduced. Error codes exported to FSMErrorCodes.
00031 //
00032 // Revision 1.1  2002/06/28 11:10:36  vofka
00033 // first time on sourceforge.net cvs
00034 //
00035 // Revision 1.7  2002/06/20 12:22:10  bobka
00036 // LGPL license
00037 //
00038 // Revision 1.6  2002/06/20 11:27:02  ozone
00039 // I4D-Code aus FSM entfernt
00040 //
00041 // Revision 1.5  2002/06/17 10:50:14  ozone
00042 // CFSMActionIlluCommand impementiert.
00043 // Damit ist es möglich ein belibiges Commando in I4D auszuführen.
00044 //
00045 // Revision 1.4  2001/12/19 17:14:00  bobka
00046 // IncrVariable action added
00047 //
00048 // Revision 1.3  2001/11/28 15:42:00  bobka
00049 // a lot of changes
00050 //
00051 // Revision 1.2  2001/11/23 09:27:57  bobka
00052 // Load/Save funktioniert.
00053 // FSM* im Fileformat entfernt.
00054 // streams entfernt.
00055 // Laeuft unter Win32 und unter WinCE (WinCE_STL Modul auschecken)
00056 // static library unter WinCE funktioniert nicht, nur DLL.
00057 //
00058 // Revision 1.1  2001/11/15 10:37:31  bobka
00059 // initial checkin
00060 // not tested on linux!
00061 //
00062 
00063 
00064 // Base-Class
00065 #include "FSMObject.h"
00066 
00068 namespace FSM {
00069 
00070 // forward reference
00071 class CFiniteStateMachine;
00072 
00076 class CFSMAction :  public CFSMObject
00077 {
00078         public:
00079                 friend class CFSMState;
00080                 friend class CFSMTransition;
00081 
00082                 // Overloadables
00083                 virtual bool Execute(const char* event, void *a, void *b) =0;
00084 
00085         protected:
00086 
00087                 CFSMAction();
00088                 virtual ~CFSMAction();
00089         private:
00090 };
00091 
00095 class CFSMActionSetVariable :  public CFSMAction
00096 {
00097         public:
00098                 friend class CFSMState;
00099                 friend class CFSMTransition;
00100                 friend class CFiniteStateMachine;
00101 
00102                 // Construction/Destruction
00103                 static CFSMObject *Create();
00104                 virtual void DeleteThis();
00105 
00106                 // Get/Set
00107                 void SetVariable(const char* varName);
00108                 void SetValue(int val);
00109 
00110                 const char* GetVariable() const;
00111                 int         GetValue() const;
00112 
00113                 // Overloaded
00114                 virtual bool Execute(const char* event, void *a, void *b);
00115                 virtual bool SetParameter(const char* paramName, const char* paramValue);
00116 
00117         protected:
00118 
00119                 // Overloaded
00120                 virtual bool SaveParameters(CFSMSaver* out) const;
00121 
00122         private:
00123                 CFSMActionSetVariable();
00124                 virtual ~CFSMActionSetVariable();
00125 
00126                 string variableName;
00127                 int value;
00128 };
00129 
00133 class CFSMActionIncrVariable :  public CFSMAction
00134 {
00135         public:
00136                 friend class CFSMState;
00137                 friend class CFSMTransition;
00138                 friend class CFiniteStateMachine;
00139 
00140                 // Construction/Destruction
00141                 static CFSMObject *Create();
00142                 virtual void DeleteThis();
00143 
00144                 // Get/Set
00145                 void SetVariable(const char* varName);
00146                 void SetIncrement(int val);
00147 
00148                 const char* GetVariable() const;
00149                 int         GetIncrement() const;
00150 
00151                 // Overloaded
00152                 virtual bool Execute(const char* event, void *a, void *b);
00153                 virtual bool SetParameter(const char* paramName, const char* paramValue);
00154 
00155         protected:
00156 
00157                 // Overloaded
00158                 virtual bool SaveParameters(CFSMSaver* out) const;
00159 
00160         private:
00161                 CFSMActionIncrVariable();
00162                 virtual ~CFSMActionIncrVariable();
00163 
00164                 string variableName;
00165                 int increment;
00166 };
00167 
00168 }; // namespace FSM
00169 
00170 #endif // !defined(AFX_FSMACTION_H__7C6ABC20_3696_40ED_9DC4_8C06E73BFC85__INCLUDED_)

© 2002 by C-LAB
generated by doxygen