Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

corelinux::Builder Template Class Reference

Builder seperates the construction of a complex object from its representation so that the same construction process can create different representations. More...

#include <Builder.hpp>

Inheritance diagram for corelinux::Builder

Inheritance graph
[legend]
List of all members.

Public Methods

 Builder ( AbstractFactory<UniqueId> *aAbstractFactory ) throw ( Assertion )
 Default constructor requires a abstract factory for building the product parts. More...

 Builder ( const Builder &aBuilder ) throw ( Assertion )
 Copy constructor creates a new instance of the reference abstract factory. More...

virtual ~Builder ( void )
 Virtual destructor.

Builder& operator= ( const Builder &aRef )
 Operation assignment. More...

bool operator== ( const Builder &aRef )
 Equality operator. More...

virtual ProductImpl* getCurrentProduct ( void ) const
 Retrieves the current product. More...

virtual CountCref getProductCreates ( void ) const
 Retrieve the product create counts.

virtual CountCref getProductDestroys ( void ) const
 Retrieve the product destroy counts.

virtual AbstractFactory<UniqueId>* getFactory ( void ) const
 Retrieve the AbstractFactory.

virtual ProductImpl* create ( void )
 Default create routine invokes the implementation createProduct method. More...

virtual void destroy ( ProductImpl * aPtr )
 Default destroy routine invokes the implementation destroyProduct method. More...


Protected Methods

 Builder ( void ) throw (Assertion)
 Default constructor not supported.

void incrementCreates ( void )
 Increment the creates.

void incrementDestroys ( void )
 Increment the destroys.

virtual ProductImpl* createProduct ( void ) const = 0
 Pure virtual createProduct.

virtual void destroyProduct ( ProductImpl * ) const = 0
 Pure virtual destroyProduct.


Protected Attributes

ProductImpl* theCurrentProduct
 The product that was most recently built.

AbstractFactory<UniqueId>* theFactory
 The factory for creating parts.

Count theProductCreates
 The count of creates.

Count theProductDestroys
 The count of destroys.


Detailed Description

template<class ProductImpl, class UniqueId> template class corelinux::Builder

Builder seperates the construction of a complex object from its representation so that the same construction process can create different representations.

This differs from AbstractFactory in that the Factory creates parts and Builder creates Products (assembled parts).

See also:
AbstractFactory, Allocator, AbstractAllocator


Constructor & Destructor Documentation

template<classProductImpl, classUniqueId>
corelinux::Builder<ProductImpl, UniqueId>::Builder<ProductImpl, UniqueId> ( AbstractFactory< UniqueId >* aAbstractFactory ) throw ( Assertion )
 

Default constructor requires a abstract factory for building the product parts.

Parameters:
AbstractFactory  

template<classProductImpl, classUniqueId>
corelinux::Builder<ProductImpl, UniqueId>::Builder<ProductImpl, UniqueId> ( const Builder<ProductImpl, UniqueId> & aBuilder ) throw ( Assertion )
 

Copy constructor creates a new instance of the reference abstract factory.

Parameters:
Builder   const reference


Member Function Documentation

template<classProductImpl, classUniqueId>
ProductImpl * corelinux::Builder<ProductImpl, UniqueId>::create ( void ) [inline, virtual]
 

Default create routine invokes the implementation createProduct method.

Returns:
ProductImpl pointer

template<classProductImpl, classUniqueId>
void corelinux::Builder<ProductImpl, UniqueId>::destroy ( ProductImpl * aPtr ) [inline, virtual]
 

Default destroy routine invokes the implementation destroyProduct method.

Parameters:
ProductImpl   pointer

template<classProductImpl, classUniqueId>
ProductImpl * corelinux::Builder<ProductImpl, UniqueId>::getCurrentProduct ( void ) const [inline, virtual]
 

Retrieves the current product.

Returns:
ProductImpl pointer

template<classProductImpl, classUniqueId>
Builder<ProductImpl, UniqueId> & corelinux::Builder<ProductImpl, UniqueId>::operator= ( const Builder<ProductImpl, UniqueId> & aRef ) [inline]
 

Operation assignment.

Uses the same factory as the reference after destroying theCurrentProduct.

Parameters:
Builder   const reference
Returns:
Builder reference

template<classProductImpl, classUniqueId>
bool corelinux::Builder<ProductImpl, UniqueId>::operator== ( const Builder<ProductImpl, UniqueId> & aRef ) [inline]
 

Equality operator.

Parameters:
Builder   const reference
Returns:
bool - true if same Builder instance


The documentation for this class was generated from the following file:
This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium