#include <DynamicObject.h>
Inherited by Camera, Fog, ImageFilter, Light, Region, Scene, Shade, and Shape.
Inheritance diagram for DynamicObject:


Public Methods | |
| virtual | ~DynamicObject () |
| const string & | className () |
| Returns the name of the class. | |
| bool | isKindOf (const string aClass) |
| Returns true iff 'this' inherits from the class named 'aClass'. | |
| bool | isKindOf (Class &aClass) |
| Returns true iff 'this' inherits from 'aClass'. | |
| void | read (ObjectFile &file) |
| Reads the body of an object description. More... | |
| void | write (ostream &stream) |
| Writes the object description to 'stream'. More... | |
| void | readParams (ObjectFile &file) |
| Reads all parameter sections inside the body of the object description. More... | |
| virtual void | writeParams (ostream &stream) |
| Writes all parameter sections inside the body of the object description. More... | |
| virtual void | parseSymbol (Token &t, ObjectFile &file) |
| Reads a single parameter sections inside the body of the object description. More... | |
Static Public Methods | |
| bool | find (RefObject &object, const string &name) |
| Finds the instance 'name' from the object pool. More... | |
| RefObject & | store (RefObject &object, const string &name) |
| Stores the object in the object pool. More... | |
| RefObject | readRefObject (const string className, ObjectFile &file) |
| Reads an object from ObjectFile. More... | |
Protected Methods | |
| virtual void | createSymbols () |
| Creates all parameter symbols that are used within the body of the object description. | |
Static Protected Attributes | |
| Mutex | mutex |
| Mutex for 'objectPool'. | |
| map< string, RefObject > | objectPool |
| The object pool. More... | |
Related Functions | |
| (Note that these are not member functions.) | |
| ObjectFile & | operator>> (ObjectFile &file, DynamicObject *&obj) |
| Reads a string from ObjectFile. More... | |
| ObjectFile & | operator>> (ObjectFile &file, RefObject &object) |
| Reads a string from ObjectFile, refcount version. More... | |
| ostream & | operator<< (ostream &stream, DynamicObject &obj) |
| Writes a string to an ostream. | |
A DynamicObject can be dynamically created, i.e. created from a class name. DynamicObjects can be read from ObjectFile and be written to ostream. A DYNAMIC_OBJECT macro must be inserted in the class body and a IMPLEMENT_DYNAMIC(<className>, <superClass>) must be part of its implementation.
OBJECT ::= className [label] OBJECT_BODY
OBJECT_BODY ::= '{ PARAM_LIST '}'
className ::= name of a DynamicObject class
label ::= '"' char* '"'
PARAM_LIST ::= <empty> | PARAM ';' PARAM_LIST
Example:
Person "myself" {
name "Kees";
age 10;
}
|
||||||||||||
|
Finds the instance 'name' from the object pool.
|
|
||||||||||||
|
Reads a single parameter sections inside the body of the object description. Each object has a set of parameter names associated with it, called symbols. Symbols are declared inside the createSymbols method. The method parseSymbol expects the Token t to be such a symbol and reads the corresponding parameters. Unknown symbols are passed to its super class.
Reimplemented in Camera. |
|
|
Reads the body of an object description. Reads the object body from an ObjectFile. Which parameters are accepted depends on parseSymbol method.
|
|
|
Reads all parameter sections inside the body of the object description. Reads the object body from an ObjectFile excluding braces. Which parameters are accepted depends on parseSymbol method.
|
|
||||||||||||
|
Reads an object from ObjectFile.
Reads an object from ObjectFile in the 'Object "name" {}' format or 'Object {}'. If the object 'name' is present in the object pool it is returned, otherwise a new instance is created.
|
|
||||||||||||
|
Stores the object in the object pool. The object that is currently stored under name will be removed from the object pool. Since the object pool contains ref counted objects the replaced object may or may not be deleted.
|
|
|
Writes the object description to 'stream'. The object description is written to an ostream. Which parameters are actually written depends on implementaion of writeParams.
|
|
|
Writes all parameter sections inside the body of the object description. This method writes all object parameters to ostream. Inhereting classes will always call super::writeParams().
Reimplemented in Camera. |
|
||||||||||||
|
Reads a string from ObjectFile, refcount version. Creates and reads a DynamicObject, the object is instanciated given the class name that is to be read from file. (Ref. counted version). Named objects are accepeted and are taken from the object pool if the exists
|
|
||||||||||||
|
Reads a string from ObjectFile. Creates and reads a DynamicObject, the object is instanciated given the class name that is to be read from file.
|
|
|
The object pool. DynamicObject instances can be stored by name in the object pool. This is simply a mapping from string to reference counted DynamicObject instances. |