This class provides a protocol (or pure interface) for a thread‐safe object creator and deleter. It extends the Deleter protocol with the addition of a createObject method.

Synopsis

Declared in <bdlma_factory.h>

template<class TYPE>
class Factory
    : public Deleter<TYPE>

Base Classes

Name

Description

Deleter<TYPE>

Provide a protocol (or pure interface) for a thread‐safe object deleter.

Member Functions

Name

Description

~Factory [destructor] [virtual]

Destroy this object factory.

createObject [virtual]

Create an instance of the specified TYPE using default arguments. Return the address of the newly‐created object on success, and 0 otherwise. The instance must be destroyed using the deleteObject method of this object factory.

deleteObject [virtual]

Destroy the specified instance based on its static type and return its memory footprint to the appropriate memory manager. The behavior is undefined unless instance was obtained from a call to createObject on this object factory and has not yet been deleted.

Derived Classes

Name

Description

ObjectPool

This class provides a thread‐safe pool of reusable objects. It also implements the bdlma::Factory protocol: "creating" objects gets them from the pool and "deleting" objects returns them to the pool.

Created with MrDocs