# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

logic_variable.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef LOGIC_VARIABLE_H
00027 #define LOGIC_VARIABLE_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/stream.h"
00031 #include "nel/misc/o_xml.h"
00032 #include "nel/misc/i_xml.h"
00033 
00034 namespace NLLOGIC
00035 {
00036 
00044 class CLogicVariable
00045 {
00046 protected:
00047 
00049         sint64 _Value;
00050 
00052         std::string _Name;
00053 
00055         bool _Verbose;
00056 
00057 public:
00058 
00062         CLogicVariable();
00063 
00069         void setName( std::string name ) { _Name = name; }
00070 
00076         std::string getName() const { return _Name; }
00077 
00083         void setValue( sint64 value );
00084 
00090         sint64 getValue() const { return _Value; }
00091 
00098         void setVerbose( bool b ) { _Verbose = b; }
00099 
00106         void applyModification( std::string op, sint64 value );
00107         
00111         virtual void processLogic();
00112         
00116         //virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00117 
00118         virtual void write (xmlNodePtr node) const;
00119         virtual void read (xmlNodePtr node);
00120 };
00121 
00122 
00123 
00124 
00132 class CLogicCounter : public CLogicVariable
00133 {
00134         uint _TickCount;
00135 
00136 public:
00137 
00139         enum TLogicCounterRule 
00140         { 
00141                 STOP_AT_LIMIT = 0,
00142                 LOOP,
00143                 SHUTTLE,
00144                 DOWN_UP, // bounce at low end, stop at high end
00145                 UP_DOWN, // bounce at high end, stop at low end
00146         };
00147 
00149         enum TLogicCounterRunningMode
00150         { 
00151                 STOPPED = 0,
00152                 RUN,
00153                 REWIND,
00154                 FAST_FORWARD, 
00155         };
00156 
00157 
00159         CLogicVariable Period;
00160 
00162         CLogicVariable Phase;
00163 
00165         CLogicVariable Step;
00166 
00168         CLogicVariable LowLimit;
00169 
00171         CLogicVariable HighLimit;
00172 
00173 
00175         CLogicVariable Mode;
00176 
00178         CLogicVariable Control;
00179 
00183         CLogicCounter();
00184 
00188         void update();
00189 
00193         void manageRunningMode();
00194 
00198         //void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00199 
00200         virtual void write (xmlNodePtr node) const;
00201         virtual void read (xmlNodePtr node);
00202 };
00203 
00204 } // NLLOGIC
00205 
00206 #endif //LOGIC_VARIABLE
00207 
00208 
00209