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.
Synopsis
Declared in <bdlcc_objectpool.h>
template<
class TYPE,
class CREATOR = ObjectPoolFunctors::DefaultCreator,
class RESETTER = ObjectPoolFunctors::Nil<TYPE>>
class ObjectPool
: public bdlma::Factory<TYPE>
Base Classes
Name |
Description |
This |
Type Aliases
Name |
Description |
Type of the creator functor used by this pool. |
|
Type of the resetter functor used by this pool. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this object pool. All objects created by this pool are destroyed (even if some of them are still in use) and memory is reclaimed. |
|
This concrete implementation of |
|
|
Return an address of modifiable object from this object pool. If this pool is empty, it is replenished according to the strategy specified at the pool construction (or an implementation‐defined strategy if none was provided). |
|
Create the specified |
|
Return a snapshot of the number of objects available in this pool. |
|
Return the (instantaneous) number of objects managed by this pool. This includes both the objects available in the pool and the objects that were allocated from the pool and not yet released. |
|
Return the specified |
|
Create enough objects to satisfy requests for at least the specified |
|
|
Declare that this type uses a |
Friends
Name |
Description |
|
Created with MrDocs