Class MemFileManager

Class Documentation

class MemFileManager

Lifetime-management for memory that goes into FITS memory files.

Public Functions

MemFileManager()

Construct a MemFileManager with no initial memory buffer.

The manager will still free the memory when it goes out of scope, but all allocation and reallocation will be performed by cfitsio as needed.

MemFileManager(std::size_t len)

Construct a MemFileManager with (len) bytes of initial memory.

The manager will free the memory when it goes out of scope, and cfitsio will be allowed to reallocate the internal memory as needed.

MemFileManager(void *ptr, std::size_t len)

Construct a MemFileManager that references and does not manage external memory.

The manager will not manage the given pointer, and it will not allow cfitsio to do so either. The user must provide enough initial memory and is responsible for freeing it manually after the FITS file has been closed.

void reset()

Return the manager to the same state it would be if default-constructed.

This must not be called while a FITS file that uses this memory is open.

void reset(std::size_t len)

Set the size of the internal memory buffer, freeing the current buffer if necessary.

This must not be called while a FITS file that uses this memory is open.

Memory allocated with this overload of reset can be reallocated by cfitsio and will be freed when the manager goes out of scope or is reset.

void reset(void *ptr, std::size_t len)

Set the internal memory buffer to an manually-managed external block.

This must not be called while a FITS file that uses this memory is open.

Memory passed to this overload of reset cannot be reallocated by cfitsio and will not be freed when the manager goes out of scope or is reset.

~MemFileManager()
MemFileManager(const MemFileManager&)
MemFileManager &operator=(const MemFileManager&)
MemFileManager(MemFileManager&&)
MemFileManager &operator=(MemFileManager&&)
void *getData() const

Return the buffer.

std::size_t getLength() const

Return the buffer length.