OSB_LIB::TheBillcycleFactory Class Reference

Collaboration diagram for OSB_LIB::TheBillcycleFactory:

Collaboration graph
[legend]
List of all members.

Detailed Description

Factory for billcycle.

The class creates a billcycle of the requested type. The factory is implemented as a singleton, which can be accessed only through the static member function instance().

Definition at line 526 of file billcycle.h.

Public Member Functions

Static Public Member Functions

Protected Member Functions

Private Types

Private Attributes

Static Private Attributes


Member Typedef Documentation

typedef std::map<Billcycle::Type, Billcycle*> OSB_LIB::TheBillcycleFactory::Registry [private]

Type used to store Billcycle prototype classes.

Definition at line 603 of file billcycle.h.


Constructor & Destructor Documentation

OSB_LIB::TheBillcycleFactory::TheBillcycleFactory (  )  [protected]

Prevent construction other than through instance().

OSB_LIB::TheBillcycleFactory::TheBillcycleFactory ( const TheBillcycleFactory rhs  )  [protected]

Prevent copy construction: not implemented.


Member Function Documentation

Billcycle::AutoPtr OSB_LIB::TheBillcycleFactory::create ( Billcycle::Type  type,
const Billcycle::Oid bcId 
)

Create a billcycle with specified object id.

Parameters:
type Identifies the type of billcycle to create.
bcId Object id of the billcycle to create.
Returns:
An auto pointer that owns an billcycle of the requested type. If the billcycle type is not supported, the pointer is 0.
Remarks:
The caller of the function should check the content of the returned auto pointer and take appropriate action (e.g. throw an exception) if it is 0.

Billcycle::AutoPtr OSB_LIB::TheBillcycleFactory::create ( Billcycle::Type  type  ) 

Create a billcycle.

Parameters:
type Identifies the type of billcycle to create.
Returns:
An auto pointer that owns an billcycle of the requested type. If the billcycle type is not supported, the pointer is 0.
Remarks:
The caller of the function should check the content of the returned auto pointer and take appropriate action (e.g. throw an exception) if it is 0.

static TheBillcycleFactory* OSB_LIB::TheBillcycleFactory::instance (  )  [static]

Get access to the billcycle factory.

Clients access the billcycle factory exclusively through this member function.

Thread safety: The current implementation of instance() is not thread safe. Applications must ensure that only one thread is running the first time the instance() member function is called. Subsequent use of instance() is then thread-safe.

void OSB_LIB::TheBillcycleFactory::registerBillcycle ( Billcycle::Type  type,
Billcycle::AutoPtr  billcycle 
)

Register a billcycle prototype together with its type.

The billcycle factory creates new billcycles of a given type by cloning its associated prototype. By default, the registry contains a prototype for each billcycle provided by the OSB library. Applications can register additional billcycles or change existing associations. If called for a type which already exists in the list, the corresponding prototype is replaced.

Parameters:
type Billcycle type
billcycle Pointer to the prototype. Ownership is transfered to the billcycle factory. That's what the auto pointer indicates.


Member Data Documentation

TheBillcycleFactory* OSB_LIB::TheBillcycleFactory::instance_ [static, private]

Pointer to the one and only instance of this class.

Definition at line 601 of file billcycle.h.

Registry OSB_LIB::TheBillcycleFactory::registry_ [private]

List of billcycle types and corresponding prototypes.

Definition at line 605 of file billcycle.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:10:52 2006 for OSB Library by  doxygen 1.4.7