|
fw4spl
|
BufferManager implementation. More...
#include <BufferManager.hpp>
Inheritance diagram for fwMemory::BufferManager:
Collaboration diagram for fwMemory::BufferManager:Classes | |
| struct | BufferStats |
| struct | StreamInfo |
Public Types | |
| enum | LoadingModeType { DIRECT, LAZY } |
| typedef void * | BufferType |
| typedef const void * | ConstBufferType |
| typedef BufferType * | BufferPtrType |
| typedef void const *const * | ConstBufferPtrType |
| typedef BufferInfo::SizeType | SizeType |
| typedef ::fwCom::Signal< void() > | UpdatedSignalType |
| typedef std::map< ConstBufferPtrType, BufferInfo > | BufferInfoMapType |
Public Member Functions | |
| virtual bool | isA (const std::string &type) const override |
| virtual FWMEMORY_API std::shared_future< void > | registerBuffer (BufferPtrType bufferPtr) |
| Hook called when a new BufferObject is created. More... | |
| virtual FWMEMORY_API std::shared_future< void > | unregisterBuffer (BufferPtrType bufferPtr) |
| Hook called when a BufferObject is destroyed. More... | |
| virtual FWMEMORY_API std::shared_future< void > | allocateBuffer (BufferPtrType bufferPtr, SizeType size, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| Hook called when an allocation is requested from a BufferObject. More... | |
| virtual FWMEMORY_API std::shared_future< void > | setBuffer (BufferPtrType bufferPtr,::fwMemory::BufferManager::BufferType buffer, SizeType size, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| Hook called when a request is made to set BufferObject's buffer from an external buffer. More... | |
| virtual FWMEMORY_API std::shared_future< void > | reallocateBuffer (BufferPtrType bufferPtr, SizeType newSize) |
| Hook called when a reallocation is requested from a BufferObject. More... | |
| virtual FWMEMORY_API std::shared_future< void > | destroyBuffer (BufferPtrType bufferPtr) |
| Hook called when a destruction is requested from a BufferObject. More... | |
| virtual FWMEMORY_API std::shared_future< void > | swapBuffer (BufferPtrType bufA, BufferPtrType bufB) |
| Hook called when a request to swap two BufferObject contents is made. More... | |
| virtual FWMEMORY_API std::shared_future< std::shared_ptr< void > > | lockBuffer (ConstBufferPtrType bufferPtr) |
| Hook called when a BufferObject is locked. More... | |
| virtual FWMEMORY_API std::shared_future< bool > | unlockBuffer (ConstBufferPtrType bufferPtr) |
| Hook called when a BufferObject lock is released. More... | |
| virtual FWMEMORY_API std::shared_future< std::string > | toString () const |
| returns BufferManager status string | |
| std::shared_ptr< UpdatedSignalType > | getUpdatedSignal () |
| Returns a boost::signal emitted when an action has been hooked. More... | |
| FWMEMORY_API std::shared_future< BufferInfoMapType > | getBufferInfos () const |
| Returns the Buffer info map. More... | |
| FWMEMORY_API std::shared_future< BufferStats > | getBufferStats () const |
| Returns managed buffers statistics. | |
| FWMEMORY_API void | setDumpPolicy (const std::shared_ptr< ::fwMemory::IPolicy > &policy) |
| Sets the dump policy. | |
| FWMEMORY_API std::shared_ptr< ::fwMemory::IPolicy > | getDumpPolicy () const |
| Returns the dump policy. | |
| FWMEMORY_API std::shared_future< StreamInfo > | getStreamInfo (const ConstBufferPtrType bufferPtr) const |
| Returns stream info. | |
| FWMEMORY_API std::shared_future< void > | setIStreamFactory (BufferPtrType bufferPtr, const std::shared_ptr< ::fwMemory::stream::in::IFactory > &factory, SizeType size,::fwMemory::FileHolder fsFile,::fwMemory::FileFormatType format, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| FWMEMORY_API LoadingModeType | getLoadingMode () const |
| FWMEMORY_API void | setLoadingMode (LoadingModeType mode) |
| ::fwCore::mt::ReadWriteMutex & | getMutex () const |
| FWMEMORY_API std::shared_future< bool > | dumpBuffer (ConstBufferPtrType bufferPtr) |
| Dump/restore a buffer. More... | |
| FWMEMORY_API std::shared_future< bool > | restoreBuffer (ConstBufferPtrType bufferPtr) |
| Dump/restore a buffer. More... | |
| FWMEMORY_API std::shared_future< bool > | writeBuffer (ConstBufferType buffer, SizeType size,::boost::filesystem::path &path) |
| Write/read a buffer. More... | |
| FWMEMORY_API std::shared_future< bool > | readBuffer (BufferType buffer, SizeType size,::boost::filesystem::path &path) |
| Write/read a buffer. More... | |
Public Member Functions inherited from fwCore::BaseObject | |
| virtual const std::string & | getLeafClassname () const |
| return object's classname without its namespace, i.e. BaseObject | |
Static Public Member Functions | |
| static bool | isTypeOf (const std::string &type) |
| static FWMEMORY_API BufferStats | computeBufferStats (const BufferInfoMapType &bufferInfo) |
| static FWMEMORY_API BufferManager::sptr | getDefault () |
| Returns the current BufferManager instance. More... | |
Static Public Member Functions inherited from fwCore::BaseObject | |
| static bool | isTypeOf (const std::string &type) |
| static const std::string & | leafClassname () |
| return object's classname without its namespace, i.e. BaseObject | |
| static const std::string & | classname () |
| return object's classname without its namespace, i.e. BaseObject | |
Protected Member Functions | |
| virtual void | registerBufferImpl (BufferPtrType bufferPtr) |
| BufferManager'a Implementation. | |
| virtual void | unregisterBufferImpl (BufferPtrType bufferPtr) |
| BufferManager'a Implementation. | |
| virtual void | allocateBufferImpl (BufferPtrType bufferPtr, SizeType size, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| BufferManager'a Implementation. | |
| virtual void | setBufferImpl (BufferPtrType bufferPtr,::fwMemory::BufferManager::BufferType buffer, SizeType size, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| BufferManager'a Implementation. | |
| virtual void | reallocateBufferImpl (BufferPtrType bufferPtr, SizeType newSize) |
| BufferManager'a Implementation. | |
| virtual void | destroyBufferImpl (BufferPtrType bufferPtr) |
| BufferManager'a Implementation. | |
| virtual void | swapBufferImpl (BufferPtrType bufA, BufferPtrType bufB) |
| BufferManager'a Implementation. | |
| virtual std::shared_ptr< void > | lockBufferImpl (ConstBufferPtrType bufferPtr) |
| BufferManager'a Implementation. | |
| virtual bool | unlockBufferImpl (ConstBufferPtrType bufferPtr) |
| BufferManager'a Implementation. | |
| virtual std::string | toStringImpl () const |
| BufferManager'a Implementation. | |
| bool | dumpBufferImpl (ConstBufferPtrType buffer) |
| BufferManager'a Implementation. | |
| bool | restoreBufferImpl (ConstBufferPtrType buffer) |
| BufferManager'a Implementation. | |
| bool | writeBufferImpl (ConstBufferType buffer, SizeType size,::boost::filesystem::path &path) |
| BufferManager'a Implementation. | |
| bool | readBufferImpl (BufferType buffer, SizeType size,::boost::filesystem::path &path) |
| BufferManager'a Implementation. | |
| BufferInfoMapType | getBufferInfosImpl () const |
| BufferManager'a Implementation. | |
| StreamInfo | getStreamInfoImpl (const ConstBufferPtrType bufferPtr) const |
| BufferManager'a Implementation. | |
| void | setIStreamFactoryImpl (BufferPtrType bufferPtr, const std::shared_ptr< ::fwMemory::stream::in::IFactory > &factory, SizeType size,::fwMemory::FileHolder fsFile,::fwMemory::FileFormatType format, const ::fwMemory::BufferAllocationPolicy::sptr &policy) |
| BufferManager'a Implementation. | |
| FWMEMORY_API bool | dumpBuffer (BufferInfo &info, BufferPtrType bufferPtr) |
| Dump/restore a buffer. More... | |
| FWMEMORY_API bool | restoreBuffer (BufferInfo &info, BufferPtrType bufferPtr, SizeType size=0) |
| Dump/restore a buffer. More... | |
Protected Attributes | |
| std::shared_ptr< UpdatedSignalType > | m_updatedSig |
| ::fwCore::LogicStamp | m_lastAccess |
| BufferInfoMapType | m_bufferInfos |
| std::shared_ptr< ::fwMemory::IPolicy > | m_dumpPolicy |
| LoadingModeType | m_loadingMode |
| std::shared_ptr< fwThread::Worker > | m_worker |
| mutable::fwCore::mt::ReadWriteMutex | m_mutex |
| Mutex to protect concurrent access in BufferManager. | |
Demangling methods | |
| virtual const std::string & | getClassname () const override |
| return full object's classname with its namespace, i.e. fwCore::BaseObject | |
| static const std::string & | classname () |
| return full object's classname with its namespace, i.e. fwCore::BaseObject | |
BufferManager implementation.
This implementation purpose is to manage memory load, freeing memory and restoring freed buffers as needed.
A dump policy is used to trigger memory freeing process. The restore process is always triggers when a lock is requested on a dumped buffer.
Definition at line 62 of file BufferManager.hpp.
|
virtual |
Hook called when an allocation is requested from a BufferObject.
| bufferPtr | BufferObject's buffer pointer |
| size | requested size for allocation |
| policy | BufferObject's allocation policy |
Definition at line 99 of file BufferManager.cpp.
References allocateBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a destruction is requested from a BufferObject.
| bufferPtr | BufferObject's buffer pointer |
Definition at line 226 of file BufferManager.cpp.
References destroyBufferImpl().
Here is the call graph for this function:| std::shared_future< bool > fwMemory::BufferManager::dumpBuffer | ( | BufferManager::ConstBufferPtrType | bufferPtr | ) |
Dump/restore a buffer.
Keeps up to date buffer's information
| bufferPtr | Buffer to dump/restore |
Definition at line 362 of file BufferManager.cpp.
References dumpBufferImpl().
Referenced by dumpBufferImpl().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Dump/restore a buffer.
Used by public dump/restoreBuffer methods
Definition at line 378 of file BufferManager.cpp.
References fwTools::System::getTemporaryFolder(), fwMemory::BufferInfo::loaded, OSLM_TRACE, and writeBufferImpl().
Here is the call graph for this function:| std::shared_future< BufferManager::BufferInfoMapType > fwMemory::BufferManager::getBufferInfos | ( | ) | const |
Returns the Buffer info map.
Definition at line 577 of file BufferManager.cpp.
References getBufferInfosImpl().
Here is the call graph for this function:
|
static |
Returns the current BufferManager instance.
Definition at line 40 of file BufferManager.cpp.
Referenced by monitorQt::DumpEditor::changeStatus(), fwDcmtkIO::reader::ImageStorageReader::read(), memory::Plugin::start(), memory::SDumpPolicy::starting(), monitorQt::DumpEditor::starting(), monitor::action::SDumpAll::updating(), and monitor::action::MemoryInfo::updating().
Here is the caller graph for this function:
|
inline |
Returns a boost::signal emitted when an action has been hooked.
Definition at line 225 of file BufferManager.hpp.
References SPTR.
|
virtual |
Hook called when a BufferObject is locked.
| bufferPtr | BufferObject's buffer pointer |
Definition at line 316 of file BufferManager.cpp.
References lockBufferImpl(), and SPTR.
Here is the call graph for this function:| std::shared_future< bool > fwMemory::BufferManager::readBuffer | ( | BufferManager::BufferType | buffer, |
| SizeType | size, | ||
| ::boost::filesystem::path & | path | ||
| ) |
Write/read a buffer.
The buffer is written/read in a raw format
| buffer | Buffer to write/read |
| size | Buffer's size |
| path | file to write/read |
Definition at line 497 of file BufferManager.cpp.
References readBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a reallocation is requested from a BufferObject.
| bufferPtr | BufferObject's buffer pointer |
| newSize | requested size for reallocation |
Definition at line 183 of file BufferManager.cpp.
References reallocateBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a new BufferObject is created.
| bufferPtr | BufferObject's buffer pointer. |
Definition at line 65 of file BufferManager.cpp.
References registerBufferImpl().
Here is the call graph for this function:| std::shared_future< bool > fwMemory::BufferManager::restoreBuffer | ( | BufferManager::ConstBufferPtrType | bufferPtr | ) |
Dump/restore a buffer.
Keeps up to date buffer's information
| bufferPtr | Buffer to dump/restore |
Definition at line 411 of file BufferManager.cpp.
References restoreBufferImpl().
Referenced by reallocateBufferImpl(), restoreBufferImpl(), and setIStreamFactoryImpl().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Dump/restore a buffer.
Used by public dump/restoreBuffer methods
Definition at line 427 of file BufferManager.cpp.
References fwMemory::BufferInfo::loaded, fwCore::LogicStamp::modified(), OSLM_TRACE, and SPTR.
Here is the call graph for this function:
|
virtual |
Hook called when a request is made to set BufferObject's buffer from an external buffer.
| bufferPtr | BufferObject's buffer pointer |
| buffer | new buffer |
| size | requested size for allocation |
| policy | BufferObject's allocation policy |
Definition at line 142 of file BufferManager.cpp.
References setBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a request to swap two BufferObject contents is made.
| bufA | First BufferObject's buffer |
| bufB | Second BufferObject's buffer |
Definition at line 252 of file BufferManager.cpp.
References swapBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a BufferObject lock is released.
| bufferPtr | BufferObject's buffer pointer |
Definition at line 344 of file BufferManager.cpp.
References unlockBufferImpl().
Here is the call graph for this function:
|
virtual |
Hook called when a BufferObject is destroyed.
| bufferPtr | BufferObject's buffer pointer. |
Definition at line 80 of file BufferManager.cpp.
References unregisterBufferImpl().
Here is the call graph for this function:| std::shared_future< bool > fwMemory::BufferManager::writeBuffer | ( | BufferManager::ConstBufferType | buffer, |
| SizeType | size, | ||
| ::boost::filesystem::path & | path | ||
| ) |
Write/read a buffer.
The buffer is written/read in a raw format
| buffer | Buffer to write/read |
| size | Buffer's size |
| path | file to write/read |
Definition at line 475 of file BufferManager.cpp.
References writeBufferImpl().
Here is the call graph for this function: