Solid Fluid System Solutions  
Home Software About Hardware Firmware
Folder Icon MemMgr
 
Our ANSI style memory management module.

Document Icon VCore (Library)
Document Icon Memory Manager
Current Document Icon Run-time Type
Document Icon Object Creation
Document Icon Constructor / Destructor
Document Icon Error Handling
Document Icon Verification
Document Icon Serialisation
Document Icon Synchronisation
Document Icon Thread Completion

Run-time type

Not including application objects, the VObject libraries currently describe some 400 individual classes, or functional objects. Each object has a unique run-time type. Run-time type is the way in which it is possible to determine the type of any unknown object from within the program.

Run-time type codes are globally unique integers. To ensure that these integers never collide they are currently managed in a spreadsheet. The spreadsheet pragmatically allocates the integers, leaving space between, such that classes of similar function (some of which may not yet have been developed) may be grouped numerically.

Each of these codes is associated with a textual name by #define in the associated library header file. The management spreadsheet creates these headers, such that the program may reference the run-time types by name. The text representations generally follow the format V{MODULE}_{ClassName}.

Actual run-time type information is stored as a member variable in the VObject base class, from which virtually all other objects we use are derived. Run-time type information is retrieved from VObject through it's member function GetType(). A typedef is provided for run-time type, the type is VObjectId. The underlying type of VOjectId is unsigned long.

This facility is useful, for example, where a number of different objects are all stored in the same list. It is not necassary to keep track of which objects are where in the list. They can float about, with objects being added and removed randomly either side of them. When one needs to know what sort of object one has in the list, one merely calls the GetType() function.

In practice, VObject is the absolute base class for all Solid Fluid objects. As new objects inherit VObject, the overall object takes on the run-time type of the newest subclass. When a new class is programmed, it may inherit some intermediate object, or it may inherit VObject directly. Either way, VObject will have been inherited since the intermediate object would itself have inherited VObject before the new class was programmed.

The run-time type of VObject is "VOBJ_Object". The run time type of the intermediate class might be either "VOBJ_Intermediate" or "VOBJ_NewClass". The run-time type of the intermediate class depends on whether the intermediate class has been inherited/subclassed by the new class. Logically then, VObject can be any of these three run-time types, depending on which classes inherit it for any given instance.

As will be seen, our implementation of run-time type allows for reflection. Reflection is a structured methodology by which a program can dynamically modify it's own capability at run-time.

Copyright © Solid Fluid 2007-2022
Last modified: SolFlu  Sat, 13 Jun 2009 00:29:48 GMT