ML Reference
|
00001 // **InsertLicense** code 00002 //----------------------------------------------------------------------------- 00003 // The handle of a memory block. 00004 // 00005 // \file mlMemoryBlockHandle.h 00006 // \author Marcus Barann 00007 // \date 03/2008 00008 // 00009 //----------------------------------------------------------------------------- 00010 00011 #ifndef MLMEMORYBLOCKHANDLE_H_INCLUDED 00012 #define MLMEMORYBLOCKHANDLE_H_INCLUDED 00013 00014 #ifdef _MSC_VER 00015 // Disable all system header warnings. 00016 #pragma warning( push,0 ) 00017 #endif 00018 #include <cstddef> 00019 #ifdef _MSC_VER 00020 #pragma warning( pop ) 00021 #endif 00022 00023 #include "../mlMemoryManagerDllExport.h" 00024 00025 00026 class MLMemoryBlock; 00027 class MLWeakMemoryBlockHandle; 00028 00029 00036 class MLMEMORYMANAGER_EXPORT MLMemoryBlockHandle 00037 { 00038 public: 00040 MLMemoryBlockHandle(); 00043 MLMemoryBlockHandle(const MLMemoryBlockHandle& memoryBlockHandle); 00047 MLMemoryBlockHandle(const MLWeakMemoryBlockHandle& weakMemoryBlockHandle); 00048 00051 ~MLMemoryBlockHandle(); 00052 00056 bool isNull() const; 00057 00059 void* data() const; 00060 00062 size_t size() const; 00063 00066 void clear(); 00067 00072 00073 00074 MLMemoryBlockHandle& operator=(const MLMemoryBlockHandle& memoryBlockHandle); 00075 00078 MLMemoryBlockHandle& operator=(const MLWeakMemoryBlockHandle& weakMemoryBlockHandle); 00079 // End of group ThreadSafe 00081 00082 00083 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00084 00085 private: 00086 void setMemoryBlockFromStrongHandle(const MLMemoryBlockHandle& memoryBlockHandle); 00087 void setMemoryBlockFromWeakHandle(const MLWeakMemoryBlockHandle& weakMemoryBlockHandle); 00088 00089 private: 00090 MLMemoryBlock* _memoryBlock; 00091 00092 friend class MLMemoryBlock; 00093 friend class MLMemoryManager; 00094 friend class MLWeakMemoryBlockHandle; 00095 #endif 00096 }; 00097 00098 #endif // MLMEMORYBLOCKHandle_H_INCLUDED