50 #ifndef AFF_SHAREDHEAP_H_VERSION 51 #error "include this only through sharedheap.h" 55 #ifndef AFF_SHAREDHEAP_DEF_H_VERSION 57 #define AFF_SHAREDHEAP_DEF_H_VERSION \ 58 "AFF_SHAREDHEAP_DEF_H V1.4" 67 #ifndef AFF_COMPILING_LIBRARY 68 #error "definition read in prebuilt mode and not during library compilation" 80 : Mheap(0), Msize(size), Mnref(1), Mextern(false)
83 try {
Mheap=
new T[size]; }
84 catch (std::bad_alloc) {
98 : Mheap(pointer), Msize(size), Mnref(1), Mextern(true) { }
103 template <
typename T>
107 if ((Mheap!=0) && (Msize>0) && (!Mextern))
118 template <
typename T>
126 template <
typename T>
134 template <
typename T>
142 template <
typename T>
145 : Mheapstruct(sharedheap.Mheapstruct)
151 template <
typename T>
155 if (--(Mheapstruct->Mnref) < 1)
164 template <
typename T>
171 if (--(Mheapstruct->Mnref) < 1)
176 ++(Mheapstruct->Mnref);
187 #endif // AFF_SHAREDHEAP_DEF_H_VERSION (includeguard) ~SHeap()
Free heap memory.
Root namespace of library.
ConstSharedHeap< T > & operator=(const Tcontainer &sharedheap)
Copy representation to share heap.
Theapstruct * Mheapstruct
shared heap structure
Tsize Msize
size (number of elements) of array
T * Mheap
shared raw array on heap
This is the base class for const elements.
SHeap(const Tsize &size)
Allocate memory on heap.
ConstSharedHeap()
Create from nothing.
A structure to be shared between different SharedHeap instances.
~ConstSharedHeap()
Deallocate heap memory if this is the last referencing instance.
Exception thrown in case of allocation error.
size_t Tsize
Type to hold the size of an array dimension.
Tsize Mnref
number of referencing instances