The TypeSys ("type system") namespace provides classes for two related, but entirely independent concepts: More...
Classes | |
class | VarT |
This is a "wrapper" around a normal C++ variable. More... | |
class | VarArrayT |
This is a "wrapper" around a normal C++ variable specifically of type ArrayT<T>. More... | |
class | CreateParamsT |
class | MethsDocT |
class | VarsDocT |
class | TypeInfoT |
This class keeps type information (about an entity class that occurs in the game). More... | |
class | TypeInfoManT |
This class manages the type infos. More... | |
class | VarBaseT |
This is the common base class for the VarT classes. More... | |
class | VisitorT |
This is the base class for the visitors of VarTs. More... | |
class | VisitorConstT |
Like VisitorT, but for const VarTs. More... | |
class | VarManT |
This class is a simple container for pointers to VarBaseTs. More... | |
class | VarVisitorGetToLuaT |
This visitor is used to implement a "get()" function in Lua: It pushes the value(s) of the visited variable onto the Lua stack. More... | |
class | VarVisitorSetFromLuaT |
This visitor is used to implement a "set()" function in Lua: It sets the value of the visited variable to the value(s) taken from the Lua stack. More... | |
class | VarVisitorSetFloatT |
This visitor is used to set float values in variables that are of type float , or composed of float . More... | |
class | VarVisitorToLuaCodeT |
This visitor writes the value of the visited variable into the given std::ostream, formatted as Lua code. More... | |
The TypeSys ("type system") namespace provides classes for two related, but entirely independent concepts:
The main purpose of the Type System is to make the programmers life easier when he is working with inheritance hierarchies of C++ classes. In many such cases, "meta" knowledge about the classes is required.
For example, when binding a hierarchy of C++ classes to Lua it is very helpful during Lua state initialization when we can iterate over all classes in the hierarchy (specially ordered so that bases classes always occur before their child classes). Additionally, classes should register themselves automatically in the data-structure for the iteration, so that adding new classes to the hierarchy is easy and doesn't require any changes elsewhere, such as to the Lua init code (a very convenient and important feature for MOD and game developers!). The TypeSys is employed for the game entities hierarchy (BaseEntityT), for which the TypeSys was initially invented, as well as the windows hierarchy of the GuiSys (cf::GuiSys::WindowT), which supports scripting as well.
Other uses directly suggest themselves from the details of the implementation, or were trivially added to the basic system:
The Type System achieves its goals by explicitly modelling an inheritance hierarchy of C++ classes as a graph, which presents a "meta-layer" of information about the hierarchy and thus allows other C++ code to become conciously aware of the inheritance structure.