TuttleOFX  1
tuttle::host::memory::MemoryPool Class Reference

#include <MemoryPool.hpp>

Inheritance diagram for tuttle::host::memory::MemoryPool:
Collaboration diagram for tuttle::host::memory::MemoryPool:

Public Member Functions

 MemoryPool (const std::size_t maxSize=0)
 ~MemoryPool ()
IPoolDataPtr allocate (const std::size_t size)
std::size_t updateMemoryAuthorizedWithRAM ()
void referenced (PoolData *)
void released (PoolData *)
std::size_t getUsedMemorySize () const
std::size_t getAllocatedAndUnusedMemorySize () const
std::size_t getAllocatedMemorySize () const
std::size_t getMaxMemorySize () const
std::size_t getAvailableMemorySize () const
std::size_t getWastedMemorySize () const
std::size_t getDataUsedSize () const
std::size_t getDataUnusedSize () const
void clear (std::size_t size)
void clear ()
void clearOne ()

Private Types

typedef boost::unordered_set
< PoolData * > 
DataList

Private Attributes

boost::ptr_list< PoolData_allDatas
std::map< char *, PoolData * > _dataMap
DataList _dataUsed
DataList _dataUnused
std::size_t _memoryAuthorized
boost::mutex _mutex

Detailed Description

Todo:
tuttle: virtual destructor or nothing in virtual

Definition at line 33 of file MemoryPool.hpp.


Member Typedef Documentation

typedef boost::unordered_set<PoolData*> tuttle::host::memory::MemoryPool::DataList [private]

Definition at line 61 of file MemoryPool.hpp.


Constructor & Destructor Documentation

tuttle::host::memory::MemoryPool::MemoryPool ( const std::size_t  maxSize = 0)

Definition at line 83 of file MemoryPool.cpp.

tuttle::host::memory::MemoryPool::~MemoryPool ( )

Definition at line 87 of file MemoryPool.cpp.


Member Function Documentation

boost::intrusive_ptr< IPoolData > tuttle::host::memory::MemoryPool::allocate ( const std::size_t  size)

Definition at line 156 of file MemoryPool.cpp.

References _dataUnused, _mutex, tuttle::host::memory::PoolData::_size, terry::algorithm::for_each(), getAvailableMemorySize(), TUTTLE_TLOG, and TUTTLE_TRACE.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

void tuttle::host::memory::MemoryPool::clear ( std::size_t  size)
Todo:
tuttle

Definition at line 247 of file MemoryPool.cpp.

void tuttle::host::memory::MemoryPool::clear ( ) [virtual]
Todo:
tuttle

Implements tuttle::host::memory::IMemoryPool.

Definition at line 252 of file MemoryPool.cpp.

References _dataUnused, and _mutex.

void tuttle::host::memory::MemoryPool::clearOne ( ) [virtual]
Todo:
tuttle

Implements tuttle::host::memory::IMemoryPool.

Definition at line 259 of file MemoryPool.cpp.

std::size_t tuttle::host::memory::MemoryPool::getAllocatedAndUnusedMemorySize ( ) const [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 210 of file MemoryPool.cpp.

References _dataUnused, and _mutex.

Referenced by getAllocatedMemorySize().

std::size_t tuttle::host::memory::MemoryPool::getAllocatedMemorySize ( ) const [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 216 of file MemoryPool.cpp.

References getAllocatedAndUnusedMemorySize(), and getUsedMemorySize().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

std::size_t tuttle::host::memory::MemoryPool::getAvailableMemorySize ( ) const [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 226 of file MemoryPool.cpp.

References getMaxMemorySize(), and getUsedMemorySize().

Referenced by allocate().

Here is the call graph for this function:

std::size_t tuttle::host::memory::MemoryPool::getDataUnusedSize ( ) const

Definition at line 242 of file MemoryPool.cpp.

References _dataUnused.

std::size_t tuttle::host::memory::MemoryPool::getDataUsedSize ( ) const

Definition at line 237 of file MemoryPool.cpp.

References _dataUsed.

std::size_t tuttle::host::memory::MemoryPool::getMaxMemorySize ( ) const [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 221 of file MemoryPool.cpp.

References _memoryAuthorized.

Referenced by BOOST_AUTO_TEST_CASE(), and getAvailableMemorySize().

std::size_t tuttle::host::memory::MemoryPool::getUsedMemorySize ( ) const [virtual]
std::size_t tuttle::host::memory::MemoryPool::getWastedMemorySize ( ) const [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 231 of file MemoryPool.cpp.

References _dataUsed, and _mutex.

Referenced by BOOST_AUTO_TEST_CASE().

void tuttle::host::memory::MemoryPool::referenced ( PoolData pData) [virtual]

Implements tuttle::host::memory::IPool.

Definition at line 96 of file MemoryPool.cpp.

References _allDatas, _dataMap, _dataUnused, _dataUsed, _mutex, and tuttle::host::memory::PoolData::data().

Here is the call graph for this function:

void tuttle::host::memory::MemoryPool::released ( PoolData pData) [virtual]

Implements tuttle::host::memory::IPool.

Definition at line 113 of file MemoryPool.cpp.

References _dataUnused, _dataUsed, and _mutex.

std::size_t tuttle::host::memory::MemoryPool::updateMemoryAuthorizedWithRAM ( ) [virtual]

Implements tuttle::host::memory::IMemoryPool.

Definition at line 183 of file MemoryPool.cpp.

References _memoryAuthorized, MemoryInfo::_totalRam, getMemoryInfo(), TUTTLE_LOG_DEBUG, and TUTTLE_TRACE.

Here is the call graph for this function:


Field Documentation

Definition at line 62 of file MemoryPool.hpp.

Referenced by referenced().

Definition at line 63 of file MemoryPool.hpp.

Referenced by referenced().


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