Loading...
Searching...
No Matches
casacore::AlignMemory Class Reference
casa package (libcasa_casa) » Utilities_module

More...

`#include <AlignMemory.h>`

## Public Member Functions

| AlignMemory (uInt alignment=0)
| Default alignment is none.
uInt | alignment () const
| Get the alignment.
void * | alloc (size_t size) const
| Allocate the given amount of memory with the correct alignment.

## Private Attributes

uInt | itsAlign

## Detailed Description

Referenced counted pointer for constant data

### Intended use:

Public interface

### Review Status

Reviewed By:
  Friso Olnon
Date Reviewed:
  1995/03/15
Test programs:
  tCountedPtr

### Etymology

This class is Counted because it is reference counted.

### Synopsis

This class implements a reference counting mechanism. It allows CountedPtrs 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.

### Motivation

Reference counting

Definition at line 59 of file AlignMemory.h.

## Constructor & Destructor Documentation

## AlignMemory()

casacore::AlignMemory::AlignMemory | ( | uInt | alignment = 0 | ) |

inline explicit

Default alignment is none.

Definition at line 64 of file AlignMemory.h.

References alignment(), and itsAlign.

## Member Function Documentation

## alignment()

uInt casacore::AlignMemory::alignment | ( |  | ) | const

inline

Get the alignment.

Definition at line 69 of file AlignMemory.h.

References itsAlign.

Referenced by AlignMemory().

## alloc()

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.

References casacore::size().

## Member Data Documentation

## itsAlign

uInt casacore::AlignMemory::itsAlign

private

Definition at line 79 of file AlignMemory.h.

Referenced by AlignMemory(), and alignment().

The documentation for this class was generated from the following file:

- casa/Utilities/AlignMemory.h