| 
 | 
 | ||||||||||||||||
Elements are created via their string represented type. They are initialized via a c-style string. If this string is null, then a default value is assigned to the element.
Functions that perform the creation are registered with the factory at run-time.
An exception is throw on element creationg failure.
| typedef Element* (*Callback) (const char*) | (*Callback) | 
| typedef map<string,Callback> Map | Map | 
| ElementFactory () | ElementFactory | 
| UnknownElement (class) | UnknownElement | 
When creating an element of a type which has no registered creation callback with the factory.
| void  add (const string& key, Callback cb) | add | 
Register a callback with the factory.
Parameters:
| key | the element id/type. Must be unique. | 
| cb | function to be called when the element must be created. | 
| Element*  create (const string& key, const char* arg) | create | 
Create an element.
Parameters:
| key | the type of element that needs to be created. | 
| arg | initial value of element. If null, a default is assigned. | 
Returns: the requested element. Caller is responsible for deletion.
| template<class T>
    Element*  createSet (const set<T>& s) | createSet | 
Create a set from an STL set.
The objects contained in the set are converted to a string representation via an ostringstream.
Parameters:
| s | STL set to be converted to ElemSet. | 
Returns: the requested ElemSet.