ROSE
0.9.6a
|
#include <MemoryMap.h>
Public Member Functions | |
virtual | ~AnonymousBuffer () |
virtual BufferPtr | clone () const |
Create a new buffer from an existing buffer. 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... | |
virtual bool | is_zero () const |
Returns true if the buffer's data is all zero. More... | |
Public Member Functions inherited from MemoryMap::ExternBuffer | |
virtual void | resize (size_t n) |
Size of buffer in bytes. 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_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 (size_t size) |
Construct an anonymous buffer. 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 | |
AnonymousBuffer (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 |
Buffer of bytes.
The bytes are initialized to all zero and storage is allocated only when a non-zero value is written to the buffer.
Definition at line 267 of file MemoryMap.h.
|
inlinevirtual |
Definition at line 269 of file MemoryMap.h.
References MemoryMap::ExternBuffer::p_data.
|
inlineprotected |
Definition at line 282 of file MemoryMap.h.
|
static |
Construct an anonymous buffer.
Storage for the buffer is allocated when a non-zero value is written to the buffer. Reads from unallocated buffers return all zero bytes.
Definition at line 247 of file MemoryMap.C.
References MemoryMap::Buffer::get_name(), and MemoryMap::Buffer::set_name().
Referenced by clone(), and Partitioner::mark_ipd_configuration().
|
virtual |
Create a new buffer from an existing buffer.
The new buffer will point to a different copy of the data so that writing data into one buffer will not cause it to appear when reading from the other buffer. The type of the new buffer might not be the same as this buffer because not all buffers are able to copy their data. For instance, cloning an ExternBuffer or a MmapBuffer will create a ByteBuffer.
Reimplemented from MemoryMap::ExternBuffer.
Definition at line 255 of file MemoryMap.C.
References MemoryMap::ExternBuffer::clone(), create(), and MemoryMap::size().
|
virtual |
Return pointer to low-level data.
This probably shouldn't be used to access the data because it makes assumptions about the implementation (use read() and write() methods instead). But it is sometimes useful when trying to determine if a buffer was initialized with data known to the caller.
Reimplemented from MemoryMap::ExternBuffer.
Definition at line 300 of file MemoryMap.C.
References MemoryMap::ExternBuffer::get_data_ptr(), and MemoryMap::size().
|
virtual |
Reads data from a buffer.
Reads up to nbytes
of data from this buffer and copies it to the caller-supplied address, the buf
argument. Reading starts at the specified byte offset from the beginning of this buffer. Returns the number of bytes copied. The output buffer is not zero-padded for short reads.
If buf
is the null pointer, then no data is copied and the return value is the number of bytes that would have been copied if buf
had not been null.
Reimplemented from MemoryMap::ExternBuffer.
Definition at line 263 of file MemoryMap.C.
References MemoryMap::size().
|
virtual |
Writes data into a buffer.
Writes up to nbytes
of data from buf
into this buffer starting at the specified byte offset within this buffer. Returns the number of bytes written. The return value will be less than nbytes
if an error occurs.
Reimplemented from MemoryMap::ExternBuffer.
Definition at line 279 of file MemoryMap.C.
References MemoryMap::size().
|
virtual |
Returns true if the buffer's data is all zero.
Some subclasses will be able to do something more efficient than reading all the data.
Reimplemented from MemoryMap::Buffer.
Definition at line 310 of file MemoryMap.C.
References MemoryMap::Buffer::is_zero().