ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MemoryMap::ByteBuffer Class Reference

Buffer of bytes. More...

#include <MemoryMap.h>

Inheritance diagram for MemoryMap::ByteBuffer:
Collaboration diagram for MemoryMap::ByteBuffer:

Public Member Functions

virtual ~ByteBuffer ()
 
- Public Member Functions inherited from MemoryMap::ExternBuffer
virtual BufferPtr clone () const
 Create a new buffer from an existing buffer. More...
 
virtual void resize (size_t n)
 Size of buffer in bytes. More...
 
virtual const void * get_data_ptr () const
 Return pointer to low-level data. More...
 
virtual size_t read (void *, size_t offset, size_t nbytes) const
 Reads data from a buffer. More...
 
virtual size_t write (const void *, size_t offset, size_t nbytes)
 Writes data into a buffer. More...
 
- Public Member Functions inherited from MemoryMap::Buffer
virtual ~Buffer ()
 
virtual void save (const std::string &filename) const
 Saves data to a file. More...
 
virtual bool is_zero () const
 Returns true if the buffer's data is all zero. More...
 
virtual bool is_read_only () const
 Property indicating whether buffer is read-only. More...
 
virtual void set_read_only (bool b=true)
 Property indicating whether buffer is read-only. More...
 
void clear_read_only ()
 Property indicating whether buffer is read-only. More...
 
virtual std::string get_name () const
 Debug name for buffer. More...
 
virtual void set_name (const std::string &s)
 Debug name for buffer. More...
 
virtual size_t size () const
 Size of buffer in bytes. More...
 

Static Public Member Functions

static BufferPtr create (void *data, size_t size)
 Construct from caller-supplied data. More...
 
static BufferPtr create_from_file (const std::string &filename, size_t start_offset=0)
 Construct from a file. More...
 
- Static Public Member Functions inherited from MemoryMap::ExternBuffer
static BufferPtr create (void *data, size_t size)
 Construct from caller-supplied data. More...
 
static BufferPtr create (const void *data, size_t size)
 Construct from caller-supplied data. More...
 

Protected Member Functions

 ByteBuffer (uint8_t *data, size_t size)
 
- Protected Member Functions inherited from MemoryMap::ExternBuffer
 ExternBuffer (const uint8_t *data, size_t size)
 
 ExternBuffer (uint8_t *data, size_t size)
 
- Protected Member Functions inherited from MemoryMap::Buffer
 Buffer (size_t size)
 
std::string new_name ()
 

Additional Inherited Members

- Protected Attributes inherited from MemoryMap::ExternBuffer
uint8_t * p_data
 

Detailed Description

Buffer of bytes.

The bytes are deleted when the buffer is deleted.

Definition at line 225 of file MemoryMap.h.

Constructor & Destructor Documentation

virtual MemoryMap::ByteBuffer::~ByteBuffer ( )
inlinevirtual

Definition at line 227 of file MemoryMap.h.

References MemoryMap::ExternBuffer::p_data.

MemoryMap::ByteBuffer::ByteBuffer ( uint8_t *  data,
size_t  size 
)
inlineprotected

Definition at line 239 of file MemoryMap.h.

Member Function Documentation

MemoryMap::BufferPtr MemoryMap::ByteBuffer::create ( void *  data,
size_t  size 
)
static

Construct from caller-supplied data.

The caller supplies a pointer to data allocated on the heap (with new) and the size of that data. The new buffer object takes ownership of the data, which is deleted when the buffer object is destroyed.

Definition at line 208 of file MemoryMap.C.

Referenced by MemoryMap::ExternBuffer::clone().

MemoryMap::BufferPtr MemoryMap::ByteBuffer::create_from_file ( const std::string &  filename,
size_t  start_offset = 0 
)
static

Construct from a file.

The new buffer is created by reading all data from the specified file beginning at byte offset start_offset.

Definition at line 214 of file MemoryMap.C.

References MemoryMap::read(), MemoryMap::size(), and TEMP_FAILURE_RETRY.

Referenced by MemoryMap::load().


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