ML Reference
mlWeakMemoryBlockHandle.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2008, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_WEAK_MEMORY_BLOCK_HANDLE_H
14#define ML_WEAK_MEMORY_BLOCK_HANDLE_H
15
16#include "../mlMemoryManagerDllExport.h"
17
18class MLMemoryBlock;
20
21
22
26class MLMEMORYMANAGER_EXPORT MLWeakMemoryBlockHandle
27{
28public:
31
36
38 MLWeakMemoryBlockHandle(const MLWeakMemoryBlockHandle& weakMemoryBlockHandle);
39
43
51
55
57 bool isNull() const;
58
59 // End of group ThreadSafe
60
63 void clear();
64
65 bool deletionOngoing() const;
66
67
68#ifndef DOXYGEN_SHOULD_SKIP_THIS
69private:
70 void markMemoryBlockWasDeleted();
71
73 MLMemoryBlock* setMemoryBlock(MLMemoryBlock* memoryBlock);
74 void setMemoryBlockFromStrongHandle(const MLMemoryBlockHandle& memoryBlockHandle);
75 void setMemoryBlockFromWeakHandle(const MLWeakMemoryBlockHandle& weakMemoryBlockHandle);
76
77
78 MLMemoryBlock* _memoryBlock;
80 MLWeakMemoryBlockHandle* _previous;
81 bool _deletionOngoing;
82
83 friend class MLMemoryBlock;
84 friend class MLMemoryBlockHandle;
85 friend class MLMemoryManager;
86#endif
87};
88
89#endif // MLWEAKMEMORYBLOCKHANDLE_H_INCLUDED
The strong handle of a MLMemoryBlock.
The memory manager.
The weak handle of a MLMemoryBlock.
void clear()
Releases this handle from the memory block.
MLWeakMemoryBlockHandle(const MLWeakMemoryBlockHandle &weakMemoryBlockHandle)
Creates a weak memory block handle from another weak handle.
~MLWeakMemoryBlockHandle()
If this is the last weak handle of the memory block, and no strong handle references it,...
MLWeakMemoryBlockHandle(const MLMemoryBlockHandle &memoryBlockHandle)
Creates a weak memory block handle from the the strong handle.
bool deletionOngoing() const
MLWeakMemoryBlockHandle()
Creates a weak memory block handle that is null.
MLWeakMemoryBlockHandle & operator=(const MLWeakMemoryBlockHandle &weakMemoryBlockHandle)
Creates a weak memory block handle from the memory block handle.
MLWeakMemoryBlockHandle & operator=(const MLMemoryBlockHandle &memoryBlockHandle)
Creates a weak memory block handle from the memory block handle.
bool isNull() const
Returns true if the weak memory block references a NULL memory block.