ROSE
0.9.6a
|
Buffer that has no data. More...
#include <MemoryMap.h>
Public Member Functions | |
virtual const void * | get_data_ptr () const |
Always returns the null pointer. More... | |
virtual BufferPtr | clone () const |
Create a new buffer from an existing buffer. 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... | |
virtual void | resize (size_t n) |
Size of buffer in bytes. More... | |
Static Public Member Functions | |
static BufferPtr | create (size_t size) |
Construct a new buffer. More... | |
Protected Member Functions | |
NullBuffer (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::Buffer | |
bool | read_only |
If true, buffer data cannot be modified. More... | |
std::string | name |
Name for debugging. More... | |
size_t | p_size |
Size of buffer in bytes. More... | |
Buffer that has no data.
This can be useful to reserve areas of the virtual memory address space without actually storing any data at them. All reads and writes using such a buffer will fail (return zero).
Definition at line 182 of file MemoryMap.h.
|
inlineprotected |
Definition at line 195 of file MemoryMap.h.
|
static |
Construct a new buffer.
The buffer contains no data and all reads and writes will fail by returning zero.
Definition at line 151 of file MemoryMap.C.
Referenced by clone().
|
inlinevirtual |
Always returns the null pointer.
Implements MemoryMap::Buffer.
Definition at line 188 of file MemoryMap.h.
|
inlinevirtual |
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.
Implements MemoryMap::Buffer.
Definition at line 190 of file MemoryMap.h.
References create(), and MemoryMap::Buffer::size().
|
inlinevirtual |
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.
Implements MemoryMap::Buffer.
Definition at line 191 of file MemoryMap.h.
|
inlinevirtual |
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.
Implements MemoryMap::Buffer.
Definition at line 192 of file MemoryMap.h.