KFoundation  v2.1
A Better Foundation Library for C++
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
kfoundation::MemoryManager Class Referenceabstract

Abstract interface to be implemented by all memory managers. More...

#include <kfoundation/MemoryManager.h>

Inheritance diagram for kfoundation::MemoryManager:
Inheritance graph
[legend]

Public Member Functions

virtual kf_uref_t add (KFObject *obj, bool retain)=0
 Creates a new entry for the object at the given memory location. More...
 
virtual void retain (const kf_int32_t index, const kf_int16_t key)=0
 Retains the object associated with the given index if key maches, otherwise throws InvalidPointerException.
 
virtual void release (const kf_int32_t index, const kf_int16_t key)=0
 Releases the object associated with the given index if the key matches, otherwise throws InvalidPointerException. More...
 
virtual KFObjectgetObject (const kf_int32_t index, const kf_int16_t key)=0
 Returns the object referenced by the given index, if the given key matches the corresponding record.
 
virtual kf_int32_t getObjectCount () const =0
 Returns the number of alive objects currently managed by this manager.
 

Detailed Description

Abstract interface to be implemented by all memory managers.

Member Function Documentation

kfoundation::MemoryManager::add ( KFObject obj,
bool  retain 
)
pure virtual

Creates a new entry for the object at the given memory location.

Parameters
obj- The object to manage
retain- If set true, the initial retain count of the object will be set to 1.

Implemented in kfoundation::RefCountMemoryManager.

kfoundation::MemoryManager::release ( const kf_int32_t  index,
const kf_int16_t  key 
)
pure virtual

Releases the object associated with the given index if the key matches, otherwise throws InvalidPointerException.

If the retain count drops to zero the object will be deleted.

Implemented in kfoundation::ObjectPoolMemoryManager< T >, and kfoundation::RefCountMemoryManager.


The documentation for this class was generated from the following files: