|
rambrain
|
Main class to allocate memory that is managed by the rambrain memory defaultManager in a multidimensional way given by the second template parameter. More...
#include <managedPtr.h>
Public Member Functions | |
| managedPtr (const managedPtr< T, 1 > &ref) | |
| copy ctor More... | |
| managedPtr () | |
| with no arguments given, instantiates an array with one element More... | |
| template<typename... ctor_args> | |
| managedPtr (unsigned int n_elem, ctor_args...Args) | |
| instantiates managedPtr containing n_elem elements and passes Args as arguments to the constructor of these More... | |
| ~managedPtr () | |
| destructor More... | |
| unsigned int | size () const |
| Simple getter. More... | |
| bool | prepareUse () const |
| tells the memory manager to possibly swap in chunk for near future use More... | |
| bool | setUse (bool writable=true, bool *tracker=NULL) const |
| Atomically sets use to a chunk if tracker is not already set to true. returns whether we set use or not. More... | |
| bool | unsetUse (unsigned int loaded=1) const |
| unsets use count on memory chunk More... | |
| managedPtr< T > & | operator= (const managedPtr< T, 1 > &ref) |
| assignment operator More... | |
| DEPRECATED T & | operator[] (int i) |
| DEPRECATED const T & | operator[] (int i) const |
| T * | getLocPtr () const |
| returns local pointer to object More... | |
| const T * | getConstLocPtr () const |
| returns const local pointer to object More... | |
Private Member Functions | |
| template<class G > | |
| std::enable_if< std::is_class< G >::value >::type | mDelete () const |
| This function manages correct deallocation for array elements having a destructor. More... | |
| template<class G > | |
| std::enable_if< !std::is_class< G >::value >::type | mDelete () |
| This function manages correct deallocation for array elements lacking a destructor. More... | |
| void | waitForSwapin () const |
| : indefinitely waits for swapin of the chunk While it would have been desirable to throw exceptions when chunk is not available, checking this in a save way would produce lots of overhead. Thus, it is better to wait indefinitely in this case, as under normal use, the chunk will become available. More... | |
Private Attributes | |
| managedMemoryChunk * | chunk |
| unsigned int * | tracker |
| unsigned int | n_elem |
Friends | |
| template<class G > | |
| class | adhereTo |
| template<class G > | |
| class | adhereToConst |
| class | ::managedPtr_Unit_ChunkInUse_Test |
| class | ::managedPtr_Unit_GetLocPointer_Test |
| class | ::managedPtr_Unit_SmartPointery_Test |
| class | ::managedFileSwap_Unit_SwapSingleIsland_Test |
| class | ::managedFileSwap_Unit_SwapNextAndSingleIsland_Test |
| class | ::adhereTo_Unit_TwiceAdheredOnceUsed_Test |
Main class to allocate memory that is managed by the rambrain memory defaultManager in a multidimensional way given by the second template parameter.
Definition at line 145 of file managedPtr.h.
|
inline |
copy ctor
Definition at line 149 of file managedPtr.h.
|
inline |
with no arguments given, instantiates an array with one element
Definition at line 154 of file managedPtr.h.
|
inline |
instantiates managedPtr containing n_elem elements and passes Args as arguments to the constructor of these
I admit, this is a bit complicated. as we do not want users to carry around information about object parenthood into their classes, we have to ensure that our 'memoryManager::parent' attribute is carried down the hierarchy correctly. As this code part is accessed recursively throughout creation, we have to make sure that we do not lock twice (deadlock) we only continue if we're called by the currently active creation process the following is not very elegant, but works. The idea behind this is that we admit one thread at a time to create an object class hierarchy. In this way, the parent argument from below is correct. This is synced by basically checking wether we should be a master or not based on a possibly setted threadID...
Definition at line 158 of file managedPtr.h.
|
inline |
destructor
Definition at line 226 of file managedPtr.h.
|
inline |
returns const local pointer to object
Definition at line 304 of file managedPtr.h.
|
inline |
returns local pointer to object
Definition at line 294 of file managedPtr.h.
|
inlineprivate |
This function manages correct deallocation for array elements having a destructor.
Definition at line 319 of file managedPtr.h.
|
inlineprivate |
This function manages correct deallocation for array elements lacking a destructor.
Definition at line 334 of file managedPtr.h.
|
inline |
assignment operator
Definition at line 262 of file managedPtr.h.
|
inline |
Definition at line 279 of file managedPtr.h.
|
inline |
Definition at line 285 of file managedPtr.h.
|
inline |
tells the memory manager to possibly swap in chunk for near future use
Definition at line 239 of file managedPtr.h.
|
inline |
Atomically sets use to a chunk if tracker is not already set to true. returns whether we set use or not.
Definition at line 245 of file managedPtr.h.
|
inline |
Simple getter.
Definition at line 234 of file managedPtr.h.
|
inline |
unsets use count on memory chunk
Definition at line 257 of file managedPtr.h.
|
inlineprivate |
: indefinitely waits for swapin of the chunk While it would have been desirable to throw exceptions when chunk is not available, checking this in a save way would produce lots of overhead. Thus, it is better to wait indefinitely in this case, as under normal use, the chunk will become available.
Definition at line 346 of file managedPtr.h.
|
friend |
Definition at line 372 of file managedPtr.h.
|
friend |
Definition at line 371 of file managedPtr.h.
|
friend |
Definition at line 370 of file managedPtr.h.
|
friend |
Definition at line 367 of file managedPtr.h.
|
friend |
Definition at line 368 of file managedPtr.h.
|
friend |
Definition at line 369 of file managedPtr.h.
Definition at line 361 of file managedPtr.h.
|
friend |
Definition at line 363 of file managedPtr.h.
|
private |
Definition at line 312 of file managedPtr.h.
|
private |
Definition at line 314 of file managedPtr.h.
|
private |
Definition at line 313 of file managedPtr.h.