Primary template class
for Builder's specializations.
More...
#include "keyvalue/mngt/Builder.h"
Public Member Functions | |
const char * | getName () const |
Gets Builder's name. | |
value::Result | getResult (const DataSet &data) const |
Gets result of processing a DataSet. | |
value::Result | getResult (const value::Variant &data) const |
Gets result of processing a value::Variant. | |
virtual shared_ptr< ObjectType > | getObject (const DataSet &data) const |
Gets the result of processing a DataSet. | |
virtual shared_ptr< ObjectType > | getObject (const value::Variant &data) const |
Gets the result of processing a value::Variant. | |
Static Public Member Functions | |
static Builder & | getInstance () |
Gets the unique instance of a Builder specialization. | |
Static Protected Member Functions | |
static void | setGetter (Builder &(*getter)()) |
Sets the point of acess to the unique instance of a Builder specialization. | |
Static Private Member Functions | |
static Builder & | getSingleton () |
Gets the unique instance of a Builder specialization. | |
Static Private Attributes | |
static Builder &(* | getter_ )() |
Primary template class
for Builder's specializations.
Each builder constructs an object based on the information stored in a DataSet. In practice, a builder is a specialization of this template class
which is parametrized on the type of object build.
Some methods are declared here but not implemented. Clients must implement missing methods in each specialization.
ObjectType | : Type of object build by the builder. |
Builder< ObjectType > & getInstance | ( | ) | [inline, static] |
Gets the unique instance of a Builder specialization.
For each type of object there should be only one instance of a Builder specialization. Therefore, each Builder specialization is a singleton and this method provides a global point of access to it.
return A reference to the unique instance of a Builder specialization.
Reimplemented in XBuilder< ObjectType >.
const char* getName | ( | ) | const [virtual] |
value::Result getResult | ( | const DataSet & | data | ) | const [inline, virtual] |
value::Result getResult | ( | const value::Variant & | data | ) | const [inline, virtual] |
Gets result of processing a value::Variant.
A redirection to getObject(const value::Variant& data).
data | : value::Variant to be processed. |
Implements Processor.
virtual shared_ptr<ObjectType> getObject | ( | const DataSet & | data | ) | const [virtual] |
shared_ptr< ObjectType > getObject | ( | const value::Variant & | data | ) | const [inline, virtual] |
Gets the result of processing a value::Variant.
The implementation provided here throws an exception to indicate that a Builder specialization cannot constructs the object given just a value::Variant input. Use XBuilder to make it possible.
data | : Input value::Variant. |
RuntimeError | : Always thrown. (See above.) |
Reimplemented in XBuilder< ObjectType >.
void setGetter | ( | Builder< ObjectType > &(*)() | getter | ) | [inline, static, protected] |
Sets the point of acess to the unique instance of a Builder specialization.
Each specialization of this template class
must be a singleton and the getInstance() method above gives acess to this unique instance.
However, trough public
inheritance, a Buider specialization can be extended to an XBuilder one. In this case, the unique accesible instance of a Builder specialization must be an instance of an XBuilder specialization. Therefore, each XBuilder specialization must register itself as the provider of the unique instance of the Builder specialization which is returned by getInstance().
The registration is done by calling this method and providing a global point of access to the unique instance of the Builder specialization.
: | A pointer to a funtion which returns a reference to the unique instance of a Builder specialization. |
Builder< ObjectType > & getSingleton | ( | ) | [inline, static, private] |
Gets the unique instance of a Builder specialization.
By default, the global point of acess to the unique instace of a Builder specialization is this method. To change it one must use setGetter().
return A reference to the unique instance of a Builder specialization.
Reimplemented in XBuilder< ObjectType >.