casa
5.7.0-16
|
Referenced counted pointer for constant data. More...
#include <AlignMemory.h>
Public Member Functions | |
AlignMemory (uInt alignment=0) | |
Default alignment is none. More... | |
uInt | alignment () const |
Get the alignment. More... | |
void * | alloc (size_t size) const |
Allocate the given amount of memory with the correct alignment. More... | |
Private Attributes | |
uInt | itsAlign |
Referenced counted pointer for constant data.
Public interface
This class is Counted because it is reference counted.
This class implements a reference counting mechanism. It allows CountedPtr
s to be passed around freely, incrementing or decrementing the reference count as needed when one CountedPtr
is assigned to another. When the reference count reaches zero the internal storage is deleted by default, but this behavior can be overridden.
Internally the class uses std::shared_ptr to be thread-safe. Note that tr1 is used if the compiler does not support C++11 yet.
Reference counting
Definition at line 61 of file AlignMemory.h.
|
inlineexplicit |
Default alignment is none.
Definition at line 66 of file AlignMemory.h.
|
inline |
void* casacore::AlignMemory::alloc | ( | size_t | size | ) | const |
Allocate the given amount of memory with the correct alignment.
If alignment < sizeof(void*), malloc will be used, otherwise posix_memalign. The alignment must be a power of 2 for posix_memalign to succeed. It can be freed with the normal free.
|
private |
Definition at line 81 of file AlignMemory.h.
Referenced by alignment().