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/a05243.html | 167 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 docs/doxygen/nel/a05243.html (limited to 'docs/doxygen/nel/a05243.html') diff --git a/docs/doxygen/nel/a05243.html b/docs/doxygen/nel/a05243.html new file mode 100644 index 00000000..fea02083 --- /dev/null +++ b/docs/doxygen/nel/a05243.html @@ -0,0 +1,167 @@ + + +NeL: variable.h File Reference + + + +
+

variable.h File Reference


Detailed Description

+Management of runtime variable

+

Id
variable.h,v 1.8 2004/01/15 17:29:44 lecroart Exp
+ +

+Definition in file variable.h. +

+#include "nel/misc/types_nl.h"
+#include "nel/misc/command.h"
+#include "nel/misc/value_smoother.h"
+ +

+Go to the source code of this file. + + + + + + + + + +

Namespaces

namespace  NLMISC

Defines

#define NLMISC_DYNVARIABLE(__type, __name, __help)
#define NLMISC_VARIABLE(__type, __var, __help)   NLMISC::CVariablePtr<__type> __var##Instance(#__var, __help " (" #__type ")", &__var)
+


Define Documentation

+

+ + + + +
+ + + + + + + + + + + + + +
#define NLMISC_DYNVARIABLE__type,
__name,
__help   )  +
+
+ + + + + +
+   + + +

+Value:

class __name##Class : public NLMISC::IVariable \
+{ \
+public: \
+        __name##Class () : IVariable(#__name, __help) { } \
+         \
+        virtual void fromString(const std::string &val, bool human=false) \
+        { \
+                /*std::stringstream ss (val);*/ \
+                __type p; \
+                /*ss >> p;*/ \
+                NLMISC::fromString(val, p) ; \
+                ptr (&p, false, human); \
+        } \
+         \
+        virtual std::string toString(bool human) const \
+        { \
+                __type p; \
+                ptr (&p, true, human); \
+                /*std::stringstream ss;*/ \
+                /*ss << p;*/ \
+                /*return ss.str();*/ \
+                return NLMISC::toString(p); \
+        } \
+        \
+        void ptr(__type *pointer, bool get, bool human) const; \
+}; \
+__name##Class __name##Instance; \
+void __name##Class::ptr(__type *pointer, bool get, bool human) const
+
Add a variable that can be modify in realtime. The code profide the way to access to the variable in the read and write access (depending of the get boolean value)

+Example:

// a function to read the variable + uint8 getVar() { return ...; } + + // a function to write the variable + void setVar(uint8 val) { ...=val; } + + // I want to look and change the variable in realtime: + NLMISC_DYNVARIABLE(uint8, FooBar, "this is a dummy variable") + { + // read or write the variable + if (get) + *pointer = getVar(); + else + setVar(*pointer); + } +

+Please use the same casing than for the variable (first letter of each word in upper case) ie: MyVariable, NetSpeedLoop, Time

+

Author:
Vianney Lecroart

+Nevrax France

+
Date:
2001
+ +

+Definition at line 99 of file variable.h.

+

+ + + + +
+ + + + + + + + + + + + + +
#define NLMISC_VARIABLE__type,
__var,
__help   )    NLMISC::CVariablePtr<__type> __var##Instance(#__var, __help " (" #__type ")", &__var) +
+
+ + + + + +
+   + + +

+Add a variable that can be modify in realtime. The variable must be global. If you must acces the variable with function, use NLMISC_DYNVARIABLE

+Example:

// I want to look and change the variable 'foobar' in realtime, so, first i create it: + uint8 foobar; + // and then, I add it + NLMISC_VARIABLE(uint8, FooBar, "this is a dummy variable"); +

+Please use the same casing than for the variable (first letter of each word in upper case) ie: MyVariable, NetSpeedLoop, Time

+

Author:
Vianney Lecroart

+Nevrax France

+
Date:
2001
+ +

+Definition at line 64 of file variable.h.

+


Generated on Tue Mar 16 06:43:29 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1