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.
typedef std::map<Billcycle::Type, Billcycle*> OSB_LIB::TheBillcycleFactory::Registry [private] |
OSB_LIB::TheBillcycleFactory::TheBillcycleFactory | ( | ) | [protected] |
Prevent construction other than through instance().
OSB_LIB::TheBillcycleFactory::TheBillcycleFactory | ( | const TheBillcycleFactory & | rhs | ) | [protected] |
Prevent copy construction: not implemented.
Billcycle::AutoPtr OSB_LIB::TheBillcycleFactory::create | ( | Billcycle::Type | type, | |
const Billcycle::Oid & | bcId | |||
) |
Create a billcycle with specified object id.
type | Identifies the type of billcycle to create. | |
bcId | Object id of the billcycle to create. |
Billcycle::AutoPtr OSB_LIB::TheBillcycleFactory::create | ( | Billcycle::Type | type | ) |
Create a billcycle.
type | Identifies the type of billcycle to create. |
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.
type | Billcycle type | |
billcycle | Pointer to the prototype. Ownership is transfered to the billcycle factory. That's what the auto pointer indicates. |
TheBillcycleFactory* OSB_LIB::TheBillcycleFactory::instance_ [static, private] |