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 Types

typedef MemoryPool This

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
PoolDatagetOneAvailableData (const size_t size)
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

Friends

std::ostream & operator<< (std::ostream &os, const This &v)

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 68 of file MemoryPool.hpp.


Constructor & Destructor Documentation

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

Definition at line 93 of file MemoryPool.cpp.

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

Definition at line 97 of file MemoryPool.cpp.

References _dataUsed, and TUTTLE_LOG_DEBUG.


Member Function Documentation

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

Definition at line 301 of file MemoryPool.cpp.

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

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

Definition at line 306 of file MemoryPool.cpp.

References _dataUnused, and _mutex.

Referenced by allocate().

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

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

Definition at line 312 of file MemoryPool.cpp.

References _dataUnused, and _mutex.

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

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

Definition at line 258 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 264 of file MemoryPool.cpp.

References getAllocatedAndUnusedMemorySize(), and getUsedMemorySize().

Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::memory::operator<<().

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 274 of file MemoryPool.cpp.

References getMaxMemorySize(), and getUsedMemorySize().

Referenced by allocate(), and tuttle::host::memory::operator<<().

Here is the call graph for this function:

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

Definition at line 290 of file MemoryPool.cpp.

References _dataUnused.

Referenced by tuttle::host::memory::operator<<().

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

Definition at line 285 of file MemoryPool.cpp.

References _dataUsed.

Referenced by tuttle::host::memory::operator<<().

std::size_t tuttle::host::memory::MemoryPool::getMaxMemorySize ( ) const [virtual]
PoolData * tuttle::host::memory::MemoryPool::getOneAvailableData ( const size_t  size)

Definition at line 295 of file MemoryPool.cpp.

References _dataUnused, and _mutex.

Referenced by allocate().

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 279 of file MemoryPool.cpp.

References _dataUsed, and _mutex.

Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::memory::operator<<().

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

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

Definition at line 105 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 122 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 231 of file MemoryPool.cpp.

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

Here is the call graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const This v 
) [friend]

Definition at line 318 of file MemoryPool.cpp.


Field Documentation

Definition at line 69 of file MemoryPool.hpp.

Referenced by referenced().

Definition at line 70 of file MemoryPool.hpp.

Referenced by referenced().


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