WMclass.h File Reference
Watchable memory. Variables are monitored and changes are announced.
More...
#include <string>
#include <vector>
#include <iostream>
#include "Events/EventRouter.h"
Go to the source code of this file.
Classes |
class | WMregistry |
| A WMregistry is a namespace; it holds a collection of WMEntry instances describing the variables that live in this registry. More...
|
class | WMentry |
| A WMentry is an entry in a WMregistry. More...
|
class | WMitem_base |
| WMitem_base is the base class from which all WMitem<T> subclasses are derived. More...
|
class | WMitem< T > |
| WMitem<T> is a reference to the variable of type T described by the associated WMentry. More...
|
Defines |
#define | WM_max_stringlen 60 |
| Maximum displayed length of a char* or std::string variable.
|
#define | WMvar(T, name) static WMitem<T> name(lookup_WMentry<T>(#name,#T,GlobalWM)); |
| Allows you to create a static WMvar.
|
#define | WMvari(T, name, initval) static WMitem<T> name(lookup_WMentry<T>(#name,#T,initval,GlobalWM)); |
| Allows you to create a static WMvar with a default initialization value.
|
#define | WMvar_(T, name, registry) static WMitem<T> name(lookup_WMentry<T>(#name,#T,registry)); |
| Allows you to create a static WMvar in a registry with a default initialization value.
|
#define | WMvari_(T, name, initval, registry) static WMitem<T> name(lookup_WMentry<T>(#name,#T,initval,registry)); |
| Allows you to create a static WMvar in a registry with a default initialization value.
|
#define | WMreg(name) static WMitem<WMregistry> name(lookup_reg(#name,GlobalWM)); |
| Allows you to create a new static registry.
|
#define | WMreg_(name, parent) static WMitem<WMregistry> name(lookup_reg(#name,parent)); |
| Allows you to create a new static registry with a parent registry.
|
Functions |
template<typename T > |
WMitem< T > | lookup_WMentry (const std::string &iname, const std::string &tname, WMregistry ®) |
template<typename T > |
WMitem< T > | create_WMentry (const std::string &iname, const std::string &tname, T *const value, WMregistry ®) |
Global Lookup functions |
Three versions of lookup_WMentry with different argument types, and one version of create_WMentry, which they share.
|
WMregistry | GlobalWM |
| the global registry for all others to put their stuff in
|
template<typename T > |
WMitem< T > | lookup_WMentry (const std::string &iname, const std::string &tname, const std::string ®name) |
| The lookup_reg function is defined in WMclass.cc since it's not templated.
|
template<typename T > |
WMitem< T > | lookup_WMentry (const std::string &iname, const std::string &tname, const WMregistry ®) |
| the global registry for all others to put their stuff in
|
template<typename T > |
WMitem< T > | lookup_WMentry (const std::string &iname, const std::string &tname, const T &initval, WMregistry ®) |
| the global registry for all others to put their stuff in
|
template<typename T > |
WMitem< T > | create_WMentry (const std::string &iname, const std::string &tname, const T *const value, WMregistry ®) |
| the global registry for all others to put their stuff in
|
WMitem< WMregistry > | lookup_reg (const std::string &name, WMregistry ®istry) |
| the global registry for all others to put their stuff in
|
void | dump (const WMitem< WMregistry > &wmreg) |
| the global registry for all others to put their stuff in
|
Detailed Description
Watchable memory. Variables are monitored and changes are announced.
- Author:
- dst (Creator)
-
alokl (Ported)
- These macros allow you to quickly create a WM variable, but only if
- it's staticly defined - you can't use these with a dynamic number of variables. You'll have to manually create a WMitem<T> or another subclass of WMitem_base if you want define these on the fly... it's not hard to do, just look at the macro definitions.
- WMvar(type,name) declares the variable in the registry
- GlobalWM.
- WMvari(type,name,initval) declares the variable in GlobalWM
- and initializes it if it doesn't already exist.
- WMvar_(type,name,registry) declares the variable in the
- specified registry.
- WMvari_(type,name,initval,registry) declares the variable in
- the specified registry and initializes it if it doesn't already exist.
- WMreg(name) declares a new WMregistry as a variable in
- GlobalWM.
- WMreg(name,registry) declares a new WMregistry as a variable
- in the specified registry,
Examples:
Definition in file WMclass.h.
Define Documentation
#define WM_max_stringlen 60 |
Allows you to create a new static registry.
Definition at line 198 of file WMclass.h.
#define WMreg_ |
( |
name, |
|
|
parent |
|
) |
static WMitem<WMregistry> name(lookup_reg(#name,parent)); |
Allows you to create a new static registry with a parent registry.
Definition at line 202 of file WMclass.h.
#define WMvar |
( |
T, |
|
|
name |
|
) |
static WMitem<T> name(lookup_WMentry<T>(#name,#T,GlobalWM)); |
Allows you to create a static WMvar.
Definition at line 182 of file WMclass.h.
#define WMvar_ |
( |
T, |
|
|
name, |
|
|
registry |
|
) |
static WMitem<T> name(lookup_WMentry<T>(#name,#T,registry)); |
Allows you to create a static WMvar in a registry with a default initialization value.
Definition at line 190 of file WMclass.h.
#define WMvari |
( |
T, |
|
|
name, |
|
|
initval |
|
) |
static WMitem<T> name(lookup_WMentry<T>(#name,#T,initval,GlobalWM)); |
Allows you to create a static WMvar with a default initialization value.
Definition at line 186 of file WMclass.h.
#define WMvari_ |
( |
T, |
|
|
name, |
|
|
initval, |
|
|
registry |
|
) |
static WMitem<T> name(lookup_WMentry<T>(#name,#T,initval,registry)); |
Allows you to create a static WMvar in a registry with a default initialization value.
Definition at line 194 of file WMclass.h.
Function Documentation
template<typename T >
WMitem<T> create_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
T *const |
value, |
|
|
WMregistry & |
reg | |
|
) |
| | |
template<typename T >
WMitem<T> create_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
const T *const |
value, |
|
|
WMregistry & |
reg | |
|
) |
| | |
the global registry for all others to put their stuff in
Definition at line 100 of file WMclass.cc.
the global registry for all others to put their stuff in
Definition at line 81 of file WMclass.cc.
template<typename T >
WMitem<T> lookup_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
WMregistry & |
reg | |
|
) |
| | |
template<typename T >
WMitem< T > lookup_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
const T & |
initval, |
|
|
WMregistry & |
reg | |
|
) |
| | |
the global registry for all others to put their stuff in
Definition at line 369 of file WMclass.h.
template<typename T >
WMitem<T> lookup_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
const WMregistry & |
reg | |
|
) |
| | |
the global registry for all others to put their stuff in
template<typename T >
WMitem< T > lookup_WMentry |
( |
const std::string & |
iname, |
|
|
const std::string & |
tname, |
|
|
const std::string & |
regname | |
|
) |
| | |
The lookup_reg function is defined in WMclass.cc since it's not templated.
Definition at line 340 of file WMclass.h.
Variable Documentation
|