AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.5.17
AMPS::MMapStoreBuffer Class Reference

A Buffer implementation that uses a memory mapped file as its storage. More...

#include <MMapStoreBuffer.hpp>

+ Inheritance diagram for AMPS::MMapStoreBuffer:

Public Member Functions

 MMapStoreBuffer (const std::string &fileName_, size_t initialSize_=AMPS_MEMORYBUFFER_DEFAULT_LENGTH, size_t sizeAlignment_=1, bool useStoredSizeAlignment_=false)
 Create an MMapStoreBuffer using fileName_ as the name of the memory mapped file used for storage. More...
 
virtual void setSize (size_t newSize_)
 Set the size for the buffer. More...
 
void setSizeAlignment (size_t sizeAlignment_)
 Set the allocation-unit alignment for logical buffer sizes. More...
 
- Public Member Functions inherited from AMPS::MemoryStoreBuffer
virtual size_t getSize () const
 Get the current size of the Buffer in bytes. More...
 
virtual size_t getPosition () const
 Get the current position in the buffer. More...
 
virtual void setPosition (size_t position_)
 Set the buffer postion to a location. More...
 
virtual void putByte (char byte_)
 Put a byte into the buffer at the current position and advance. More...
 
virtual char getByte ()
 Get the next byte from the buffer and advance. More...
 
virtual void putSizet (size_t s_)
 Put a size_t value into the buffer at the current position and advance past it. More...
 
virtual size_t getSizet ()
 Get a size_t value at the current buffer position and advance past it. More...
 
virtual void putInt32 (amps_int32_t s_)
 Put a 32-bit int value into the buffer and advance past it. More...
 
virtual amps_int32_t getInt32 ()
 Get the 32-bit int value at the current buffer position and advance past it. More...
 
virtual void putUint32 (amps_uint32_t s_)
 Put an unsigned 32-bit int value into the buffer at the current position and advance past the end of it. More...
 
virtual amps_uint32_t getUint32 ()
 Get the unsigned 32-bit int value at the current buffer position and advance past it. More...
 
virtual void putInt64 (amps_int64_t s_)
 Put an amps_int64_t value into the buffer at the current position and advance past it. More...
 
virtual amps_int64_t getInt64 ()
 Get a 64-bit int value at the current buffer position and advance past it. More...
 
virtual void putUint64 (amps_uint64_t s_)
 Put an amps_uint64_t value into the buffer at the current position and advance past it. More...
 
virtual amps_uint64_t getUint64 ()
 Get an unsigned 64-bit int value at the current buffer position and advance past it. More...
 
virtual void putBytes (const char *data_, size_t dataLength_)
 Put the given length of bytes in data into the buffer at the current position and advance past them. More...
 
virtual void putBytes (const Buffer::ByteArray &bytes_)
 Put the given bytes into the buffer at the current position and advance past them. More...
 
virtual Buffer::ByteArray getBytes (size_t numBytes_)
 Get the given number of bytes from the buffer. More...
 
virtual void copyBytes (char *buffer_, size_t numBytes_)
 Copy the given number of bytes from this buffer to the given buffer. More...
 
virtual void zero (size_t offset_, size_t length_)
 Set the given number of bytes in the buffer to zero starting at the given position. More...
 
virtual void copyBytes (size_t destination_, size_t source_, size_t number_)
 Move the given number of bytes at the given location to the new location Buffer should do this in the most optimal fashion. More...
 

Detailed Description

A Buffer implementation that uses a memory mapped file as its storage.

Constructor & Destructor Documentation

AMPS::MMapStoreBuffer::MMapStoreBuffer ( const std::string &  fileName_,
size_t  initialSize_ = AMPS_MEMORYBUFFER_DEFAULT_LENGTH,
size_t  sizeAlignment_ = 1,
bool  useStoredSizeAlignment_ = false 
)
inline

Create an MMapStoreBuffer using fileName_ as the name of the memory mapped file used for storage.

If the file exists and contains valid messages, they will be available for replay.

Parameters
fileName_The name of the file mapped to memory.
initialSize_The initial size of the buffer in bytes.
sizeAlignment_Alignment for logical buffer sizes. The default retains page-size alignment.
useStoredSizeAlignment_If true, use a value greater than one in the first 32 bits of an existing file as its size alignment.

Member Function Documentation

virtual void AMPS::MMapStoreBuffer::setSize ( size_t  newSize_)
inlinevirtual

Set the size for the buffer.

Parameters
newSize_The new size in bytes for the buffer.

Reimplemented from AMPS::MemoryStoreBuffer.

void AMPS::MMapStoreBuffer::setSizeAlignment ( size_t  sizeAlignment_)
inline

Set the allocation-unit alignment for logical buffer sizes.

If the current buffer is not aligned, grow it to the next aligned size.


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