From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02819.html | 1226 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1226 insertions(+) create mode 100644 docs/doxygen/nel/a02819.html (limited to 'docs/doxygen/nel/a02819.html') diff --git a/docs/doxygen/nel/a02819.html b/docs/doxygen/nel/a02819.html new file mode 100644 index 00000000..b80ee64f --- /dev/null +++ b/docs/doxygen/nel/a02819.html @@ -0,0 +1,1226 @@ + + +NeL: NLLOGIC::CLogicCounter class Reference + + + +
+

NLLOGIC::CLogicCounter Class Reference

#include <logic_variable.h> +

+

Inheritance diagram for NLLOGIC::CLogicCounter: +

+ +NLLOGIC::CLogicVariable + +

Detailed Description

+CLogicCounter

+

Author:
Stephane Coutelas

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 132 of file logic_variable.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TLogicCounterRule {
+  STOP_AT_LIMIT = 0, +LOOP, +SHUTTLE, +DOWN_UP, +
+  UP_DOWN +
+ }
 counter running mode More...

enum  TLogicCounterRunningMode { STOPPED = 0, +RUN, +REWIND, +FAST_FORWARD + }
 counter running state More...


Public Member Functions

void applyModification (std::string op, sint64 value)
 CLogicCounter ()
std::string getName () const
sint64 getValue () const
void manageRunningMode ()
virtual void processLogic ()
virtual void read (xmlNodePtr node)
void setName (std::string name)
void setValue (sint64 value)
void setVerbose (bool b)
void update ()
virtual void write (xmlNodePtr node) const

Data Fields

CLogicVariable Control
 running state

CLogicVariable HighLimit
 higher limit for counter

CLogicVariable LowLimit
 lower limit for counter

CLogicVariable Mode
 running mode

CLogicVariable Period
 period between inc( measured in game ticks )

CLogicVariable Phase
 time offset to apply with period

CLogicVariable Step
 regular increment value( normally 1 or -1 )


Protected Attributes

std::string _Name
 variable name

sint64 _Value
 variable value

bool _Verbose
 true if verbose mode is active


Private Attributes

uint _TickCount
+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NLLOGIC::CLogicCounter::TLogicCounterRule +
+
+ + + + + +
+   + + +

+counter running mode +

+

Enumeration values:
+ + + + + + +
STOP_AT_LIMIT  +
LOOP  +
SHUTTLE  +
DOWN_UP  +
UP_DOWN  +
+
+ +

+Definition at line 139 of file logic_variable.h. +

+

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         };
+
+

+ + + + +
+ + +
enum NLLOGIC::CLogicCounter::TLogicCounterRunningMode +
+
+ + + + + +
+   + + +

+counter running state +

+

Enumeration values:
+ + + + + +
STOPPED  +
RUN  +
REWIND  +
FAST_FORWARD  +
+
+ +

+Definition at line 149 of file logic_variable.h. +

+

00150         { 
+00151                 STOPPED = 0,
+00152                 RUN,
+00153                 REWIND,
+00154                 FAST_FORWARD, 
+00155         };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLLOGIC::CLogicCounter::CLogicCounter  ) 
+
+ + + + + +
+   + + +

+Default constructor +

+Definition at line 160 of file logic_variable.cpp. +

+References _TickCount, Control, HighLimit, LowLimit, Period, RUN, NLLOGIC::CLogicVariable::setName(), NLLOGIC::CLogicVariable::setValue(), and STOP_AT_LIMIT. +

+

00161 {
+00162         _TickCount = 0;
+00163         _Value = 0;
+00164         _Name = "unamed_counter";
+00165 
+00166         Period.setValue( 10 );
+00167         Period.setName("Period");
+00168         
+00169         Phase.setValue( 0 );
+00170         Phase.setName("Phase");
+00171         
+00172         Step.setValue( 1 );
+00173         Step.setName("Step");
+00174         
+00175         LowLimit.setValue( 0 );
+00176         LowLimit.setName("LowLimit");
+00177         
+00178         HighLimit.setValue( 100 );
+00179         HighLimit.setName("HighLimit");
+00180         
+00181         Mode.setValue( STOP_AT_LIMIT );
+00182         Mode.setName("Mode");
+00183         
+00184         Control.setValue( RUN );
+00185         Control.setName("Control");
+00186 
+00187 } // CLogicCounter //
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLOGIC::CLogicVariable::applyModification std::string  op,
sint64  value
[inherited]
+
+ + + + + +
+   + + +

+Apply modifications on a variable

+

Parameters:
+ + + +
op can be one of these operators :"SET"("set"),"ADD"("add"),"SUB"("sub"),"MUL"("mul"),"DIV"("div")
value is the value to use along with the modificator
+
+ +

+Definition at line 73 of file logic_variable.cpp. +

+References NLLOGIC::CLogicVariable::_Verbose, nlinfo, nlwarning, sint64, and value. +

+

00074 {
+00075         if( op == "SET" || op == "set" )
+00076         {
+00077                 _Value = value;
+00078         }
+00079         else
+00080         if( op == "ADD" || op == "add" )
+00081         {
+00082                 _Value += value;
+00083         }
+00084         else
+00085         if( op == "SUB" || op == "sub" )
+00086         {
+00087                 _Value -= value;
+00088         }
+00089         else
+00090         if( op == "MUL" || op == "mul")
+00091         {
+00092                 _Value *= value;
+00093         }
+00094         else
+00095         if( op == "DIV" || op == "div")
+00096         {
+00097                 if( value != 0 ) _Value /= value;
+00098         }
+00099         else
+00100         {
+00101                 nlwarning("(LGCS)<CLogicVariable::applyModification> The operator \"%s\" is unknown",op.c_str());
+00102                 return;
+00103         }
+00104 
+00105         if( _Verbose )
+00106         {
+00107                 nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
+00108         }
+00109 
+00110 } // applyModification //
+
+

+ + + + +
+ + + + + + + + + + +
std::string NLLOGIC::CLogicVariable::getName void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the variable name

+

Returns:
the name of the variable
+ +

+Definition at line 76 of file logic_variable.h. +

+Referenced by NLLOGIC::CLogicStateMachine::addCounter(), and NLLOGIC::CLogicStateMachine::addVariable(). +

+

00076 { return _Name; }
+
+

+ + + + +
+ + + + + + + + + +
sint64 NLLOGIC::CLogicVariable::getValue  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the variable value

+

Returns:
the variable's value
+ +

+Definition at line 90 of file logic_variable.h. +

+References sint64. +

+Referenced by manageRunningMode(), NLLOGIC::CLogicComparisonBlock::testLogic(), update(), and write(). +

+

00090 { return _Value; }
+
+

+ + + + +
+ + + + + + + + + +
void NLLOGIC::CLogicCounter::manageRunningMode  ) 
+
+ + + + + +
+   + + +

+check the counter value according to the running mode +

+Definition at line 248 of file logic_variable.cpp. +

+References DOWN_UP, NLLOGIC::CLogicVariable::getValue(), HighLimit, LOOP, LowLimit, NLLOGIC::CLogicVariable::setValue(), SHUTTLE, STOP_AT_LIMIT, and UP_DOWN. +

+Referenced by update(). +

+

00249 {
+00250         // loop on one value
+00251         if( HighLimit.getValue() == LowLimit.getValue() )
+00252         {
+00253                 _Value = HighLimit.getValue();
+00254                 return;
+00255         }
+00256 
+00257         switch( Mode.getValue() )
+00258         {
+00259                 case STOP_AT_LIMIT :
+00260                 {
+00261                         if( _Value > HighLimit.getValue() )
+00262                         {
+00263                                 _Value = HighLimit.getValue();
+00264                         }
+00265                         if( _Value < LowLimit.getValue() )
+00266                         {
+00267                                 _Value = LowLimit.getValue();
+00268                         }
+00269                 }
+00270                 break;
+00271 
+00272                 case LOOP :
+00273                 {
+00274                         // value is higher than high limit
+00275                         if( _Value > HighLimit.getValue() )
+00276                         {
+00277                                 _Value = LowLimit.getValue() + _Value - HighLimit.getValue() - 1;
+00278                         }
+00279                         // value is lower than low limit
+00280                         else
+00281                         {
+00282                                 if( _Value < LowLimit.getValue() )
+00283                                 {
+00284                                         _Value = HighLimit.getValue() - (LowLimit.getValue() -_Value) + 1;
+00285                                 }
+00286                         }
+00287                 }
+00288                 break;
+00289 
+00290                 case SHUTTLE :
+00291                 {
+00292                         // value is higher than high limit
+00293                         if( _Value > HighLimit.getValue() )
+00294                         {
+00295                                 _Value = HighLimit.getValue() - (_Value - HighLimit.getValue());
+00296                                 Step.setValue( -Step.getValue() );
+00297                         }
+00298                         // value is lower than low limit
+00299                         else
+00300                         {
+00301                                 if( _Value < LowLimit.getValue() )
+00302                                 {
+00303                                         _Value = LowLimit.getValue() + LowLimit.getValue() - _Value;
+00304                                         Step.setValue( -Step.getValue() );
+00305                                 }
+00306                         }
+00307                 }
+00308                 break;
+00309 
+00310                 case DOWN_UP :
+00311                 {
+00312                         // low limit reached, we go up
+00313                         if( _Value < LowLimit.getValue() )
+00314                         {
+00315                                 _Value = LowLimit.getValue() + LowLimit.getValue() - _Value;
+00316                                 Step.setValue( -Step.getValue() );
+00317                         }
+00318                         else
+00319                         {
+00320                                 // high limit reached we stop
+00321                                 if( _Value > HighLimit.getValue() )
+00322                                 {
+00323                                         _Value = HighLimit.getValue();
+00324                                 }
+00325                         }
+00326                 }
+00327                 break;
+00328 
+00329                 case UP_DOWN :
+00330                 {
+00331                         // high limit reached, we go down
+00332                         if( _Value > HighLimit.getValue() )
+00333                         {
+00334                                 _Value = HighLimit.getValue() - (_Value - HighLimit.getValue());
+00335                                 Step.setValue( -Step.getValue() );
+00336                         }
+00337                         else
+00338                         {
+00339                                 // low limit reached, we stop
+00340                                 if( _Value < LowLimit.getValue() )
+00341                                 {
+00342                                         _Value = LowLimit.getValue();
+00343                                 }
+00344                         }
+00345                 }
+00346         }
+00347 
+00348 } // manageRunningMode //
+
+

+ + + + +
+ + + + + + + + + +
void NLLOGIC::CLogicVariable::processLogic  )  [virtual, inherited]
+
+ + + + + +
+   + + +

+update the variable +

+Definition at line 117 of file logic_variable.cpp. +

+

00118 {
+00119 
+00120 
+00121 } // processLogic //
+
+

+ + + + +
+ + + + + + + + + + +
void NLLOGIC::CLogicCounter::read xmlNodePtr  node  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLLOGIC::CLogicVariable. +

+Definition at line 387 of file logic_variable.cpp. +

+References Control, NLLOGIC::getXMLProp(), HighLimit, LowLimit, Period, NLLOGIC::CLogicVariable::setValue(), and NLLOGIC::xmlCheckNodeName(). +

+

00388 {
+00389         xmlCheckNodeName (node, "COUNTER");
+00390 
+00391         _Name = getXMLProp (node, "Name");
+00392         _Value = atoiInt64 (getXMLProp (node, "Value").c_str());
+00393         _Verbose = atoi(getXMLProp (node, "Verbose").c_str()) == 1;
+00394         Period.setValue(atoiInt64(getXMLProp (node, "Period").c_str()));
+00395         Phase.setValue(atoiInt64(getXMLProp (node, "Phase").c_str()));
+00396         Step.setValue(atoiInt64(getXMLProp (node, "Step").c_str()));
+00397         LowLimit.setValue(atoiInt64(getXMLProp (node, "LowLimit").c_str()));
+00398         HighLimit.setValue(atoiInt64(getXMLProp (node, "HighLimit").c_str()));
+00399         Mode.setValue(atoiInt64(getXMLProp (node, "Mode").c_str()));
+00400         Control.setValue(atoiInt64(getXMLProp (node, "Control").c_str()));
+00401 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLLOGIC::CLogicVariable::setName std::string  name  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the variable name

+

Parameters:
+ + +
name is the name of the variable
+
+ +

+Definition at line 69 of file logic_variable.h. +

+Referenced by CLogicCounter(). +

+

00069 { _Name = name; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLLOGIC::CLogicVariable::setValue sint64  value  )  [inherited]
+
+ + + + + +
+   + + +

+Set the variable value

+

Parameters:
+ + +
value is the new value of the variable
+
+ +

+Definition at line 56 of file logic_variable.cpp. +

+References NLLOGIC::CLogicVariable::_Verbose, nlinfo, sint64, and value. +

+Referenced by CLogicCounter(), manageRunningMode(), read(), and update(). +

+

00057 { 
+00058         _Value = value;
+00059         
+00060         if( _Verbose )
+00061         {
+00062                 nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
+00063         }
+00064 
+00065 } // setValue //
+
+

+ + + + +
+ + + + + + + + + + +
void NLLOGIC::CLogicVariable::setVerbose bool  b  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the verbose mode active or inactive

+

Parameters:
+ + + +
varName is the name of the variable
b is true to activate the verbose mode, false else
+
+ +

+Definition at line 98 of file logic_variable.h. +

+References NLLOGIC::CLogicVariable::_Verbose. +

+

00098 { _Verbose = b; }
+
+

+ + + + +
+ + + + + + + + + +
void NLLOGIC::CLogicCounter::update  ) 
+
+ + + + + +
+   + + +

+update the counter +

+Definition at line 194 of file logic_variable.cpp. +

+References _TickCount, Control, FAST_FORWARD, NLLOGIC::CLogicVariable::getValue(), HighLimit, LowLimit, manageRunningMode(), nlinfo, Period, REWIND, RUN, NLLOGIC::CLogicVariable::setValue(), and STOPPED. +

+

00195 {
+00196         if( Control.getValue() == STOPPED )
+00197         {
+00198                 return;
+00199         }
+00200 
+00201         _TickCount++;
+00202         if( _TickCount < Period.getValue() )
+00203         {
+00204                 return;
+00205         }
+00206         else
+00207         {
+00208                 _TickCount = 0;
+00209         }
+00210 
+00211         switch( Control.getValue() )
+00212         {
+00213                 case RUN :
+00214                 {
+00215                         _Value += Step.getValue();
+00216                         manageRunningMode();
+00217                 }
+00218                 break;
+00219 
+00220                 case REWIND :
+00221                 {
+00222                         _Value = LowLimit.getValue();
+00223                         Control.setValue( RUN );
+00224                 }
+00225                 break;
+00226 
+00227                 case FAST_FORWARD :
+00228                 {
+00229                         _Value = HighLimit.getValue();
+00230                         Control.setValue( RUN );
+00231                 }
+00232                 break;
+00233                 
+00234         }
+00235 
+00236         if( _Verbose )
+00237         {
+00238                 nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
+00239         }
+00240 
+00241 } // update //
+
+

+ + + + +
+ + + + + + + + + + +
void NLLOGIC::CLogicCounter::write xmlNodePtr  node  )  const [virtual]
+
+ + + + + +
+   + + +

+serial +

+Reimplemented from NLLOGIC::CLogicVariable. +

+Definition at line 372 of file logic_variable.cpp. +

+References Control, NLLOGIC::CLogicVariable::getValue(), HighLimit, LowLimit, and Period. +

+

00373 {
+00374         xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"COUNTER", NULL);
+00375         xmlSetProp (elmPtr, (const xmlChar*)"Name", (const xmlChar*)_Name.c_str());
+00376         xmlSetProp (elmPtr, (const xmlChar*)"Value", (const xmlChar*)toString(_Value).c_str());
+00377         xmlSetProp (elmPtr, (const xmlChar*)"Verbose", (const xmlChar*)toString(_Verbose).c_str());
+00378         xmlSetProp (elmPtr, (const xmlChar*)"Period", (const xmlChar*)toString(Period.getValue()).c_str());
+00379         xmlSetProp (elmPtr, (const xmlChar*)"Phase", (const xmlChar*)toString(Phase.getValue()).c_str());
+00380         xmlSetProp (elmPtr, (const xmlChar*)"Step", (const xmlChar*)toString(Step.getValue()).c_str());
+00381         xmlSetProp (elmPtr, (const xmlChar*)"LowLimit", (const xmlChar*)toString(LowLimit.getValue()).c_str());
+00382         xmlSetProp (elmPtr, (const xmlChar*)"HighLimit", (const xmlChar*)toString(HighLimit.getValue()).c_str());
+00383         xmlSetProp (elmPtr, (const xmlChar*)"Mode", (const xmlChar*)toString(Mode.getValue()).c_str());
+00384         xmlSetProp (elmPtr, (const xmlChar*)"Control", (const xmlChar*)toString(Control.getValue()).c_str());
+00385 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::string NLLOGIC::CLogicVariable::_Name [protected, inherited] +
+
+ + + + + +
+   + + +

+variable name +

+ +

+Definition at line 52 of file logic_variable.h.

+

+ + + + +
+ + +
uint NLLOGIC::CLogicCounter::_TickCount [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 134 of file logic_variable.h. +

+Referenced by CLogicCounter(), and update().

+

+ + + + +
+ + +
sint64 NLLOGIC::CLogicVariable::_Value [protected, inherited] +
+
+ + + + + +
+   + + +

+variable value +

+ +

+Definition at line 49 of file logic_variable.h.

+

+ + + + +
+ + +
bool NLLOGIC::CLogicVariable::_Verbose [protected, inherited] +
+
+ + + + + +
+   + + +

+true if verbose mode is active +

+ +

+Definition at line 55 of file logic_variable.h. +

+Referenced by NLLOGIC::CLogicVariable::applyModification(), NLLOGIC::CLogicVariable::CLogicVariable(), NLLOGIC::CLogicVariable::read(), NLLOGIC::CLogicVariable::setValue(), NLLOGIC::CLogicVariable::setVerbose(), and NLLOGIC::CLogicVariable::write().

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::Control +
+
+ + + + + +
+   + + +

+running state +

+ +

+Definition at line 178 of file logic_variable.h. +

+Referenced by CLogicCounter(), read(), update(), and write().

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::HighLimit +
+
+ + + + + +
+   + + +

+higher limit for counter +

+ +

+Definition at line 171 of file logic_variable.h. +

+Referenced by CLogicCounter(), manageRunningMode(), read(), update(), and write().

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::LowLimit +
+
+ + + + + +
+   + + +

+lower limit for counter +

+ +

+Definition at line 168 of file logic_variable.h. +

+Referenced by CLogicCounter(), manageRunningMode(), read(), update(), and write().

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::Mode +
+
+ + + + + +
+   + + +

+running mode +

+ +

+Definition at line 175 of file logic_variable.h.

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::Period +
+
+ + + + + +
+   + + +

+period between inc( measured in game ticks ) +

+ +

+Definition at line 159 of file logic_variable.h. +

+Referenced by CLogicCounter(), read(), update(), and write().

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::Phase +
+
+ + + + + +
+   + + +

+time offset to apply with period +

+ +

+Definition at line 162 of file logic_variable.h.

+

+ + + + +
+ + +
CLogicVariable NLLOGIC::CLogicCounter::Step +
+
+ + + + + +
+   + + +

+regular increment value( normally 1 or -1 ) +

+ +

+Definition at line 165 of file logic_variable.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 12:53:47 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1