ADTF
IObjectPoolabstract

The IObjectPool interface provides methods for managing pools of objects. More...

Inheritance diagram for IObjectPool:
[legend]

Public Member Functions

 ADTF_IID (IObjectPool, "object_pool.ant.ucom.adtf.iid")
 Marks the IObjectPool to be castable with the ucom_cast<> More...
 
virtual tResult ReleaseObject (const iobject_ptr< IObject > &i_pRelease)=0
 A pooled Object will manage its Destroy Method with the UnrefObject Method. More...
 
virtual size_t GetCacheSize () const =0
 Get entire size of the cache which is also the amount of preallocated objects. More...
 
virtual size_t GetUseCount () const =0
 Get amount of objects currently in use. More...
 
virtual tResult ResizeCache (size_t i_nSize)=0
 Resize the cache. More...
 
- Public Member Functions inherited from IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 Marks the IObject to be castable with the ucom_cast() More...
 

Protected Member Functions

 ~IObjectPool ()=default
 Protected destructor --> Use implemented Destroy() instead of delete!
 
- Protected Member Functions inherited from IObject
 ~IObject ()=default
 Protected destructor --> Use implemented Destroy() instead of delete!
 

Detailed Description

The IObjectPool interface provides methods for managing pools of objects.

Definition at line 23 of file object_pool_intf.h.

Member Function Documentation

◆ ADTF_IID()

ADTF_IID ( IObjectPool  ,
"object_pool.ant.ucom.adtf.iid"   
)

Marks the IObjectPool to be castable with the ucom_cast<>

See also
ADTF_IID(_interface, _striid)

◆ GetCacheSize()

virtual size_t GetCacheSize ( ) const
pure virtual

Get entire size of the cache which is also the amount of preallocated objects.

Note
To retrieve the current cache size , use GetCacheSize() - GetUseCount()
Returns
Entire size of the cache.

◆ GetUseCount()

virtual size_t GetUseCount ( ) const
pure virtual

Get amount of objects currently in use.

Returns
Amount of objects currently in use.

◆ ReleaseObject()

virtual tResult ReleaseObject ( const iobject_ptr< IObject > &  i_pRelease)
pure virtual

A pooled Object will manage its Destroy Method with the UnrefObject Method.

Default object implementation:

See also
ucom::cObject.
Parameters
i_pRelease[in] A pooled object, that needs to be unreferenced.
Returns
Standard Result Code.

◆ ResizeCache()

virtual tResult ResizeCache ( size_t  i_nSize)
pure virtual

Resize the cache.

Parameters
[in]i_nSizeNew size of the cache
Postcondition
If i_nSize > GetCacheSize() --> Memory for the cache is (re-)allocated.
If i_nSize < GetCacheSize() --> Memory from the cache is released. If the resulting cache size would be smaller zero, nothing is released and ERR_RESOURCE_IN_USE is returned.
If i_nSize == GetCacheSize() --> Nothing is done.
Returns
Standard error code
Return values
ERR_NOERROREverything went fine.
ERR_MEMORYMemory could not be allocated.
ERR_RESOURCE_IN_USEWanted cache size is too small for all currently held objects