Public Member Functions | Private Member Functions

AbstractBuilder Class Reference

Abstract base class of all Builders. More...

#include <keyvalue/mngt/AbstractBuilder.h>

Inheritance diagram for AbstractBuilder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<typename ObjectType >
bool canBuild () const
 Checks if the Builder can build objects of a given type.
virtual const ::std::type_info & getObjectType () const =0
 Gets Builder's ObjectType.
virtual const char * getName () const =0
 Gets Processor's name.

Private Member Functions

virtual void thrower () const =0
 Throws a pointer defining the object built by the concrete Builder.

Detailed Description

Abstract base class of all Builders.


Member Function Documentation

bool canBuild (  )  const

Checks if the Builder can build objects of a given type.

Parameters:
ObjectType : (template parameter) The type to be checked against.
Returns:
This method returns true if the Builder can build objects of type ObjectType.
virtual const ::std::type_info& getObjectType (  )  const [pure virtual]

Gets Builder's ObjectType.

Returns:
std::type_info of Builder<span>'s ObjectType.

Implemented in Builder< Tag >.

virtual void thrower (  )  const [private, pure virtual]

Throws a pointer defining the object built by the concrete Builder.

This method is a helper to canBuild(). Recall that each concrete Builder builds a different type of object. Therefore, concrete Builders must implement this method which just throws a (null) pointer of type ObjectType* where ObjectType is the type of object that the Builder can build.

The idea is the same used in util::AnyPtr to cast its internal pointer as explained in

Neri, C, "Twisting the RTTI System for Safe Dynamic Casts of void* in C++", Dr.Dobb's Journal, April 05, 2011. http://drdobbs.com/cpp/229401004

Exceptions:
\e ObjectType* : Always throws.
virtual const char* getName (  )  const [pure virtual, inherited]

Gets Processor's name.

Returns:
The name.

Implemented in Builder< Tag >, and Calculator< Tag >.