ROSE
0.9.6a
|
Buffer whose underlying storage is from mmap. More...
#include <MemoryMap.h>
Public Member Functions | |
virtual | ~MmapBuffer () |
virtual void | resize (size_t n) |
Mmap buffers cannot be resized. More... | |
Public Member Functions inherited from MemoryMap::ExternBuffer | |
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... | |
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 (size_t length, int prot, int flags, int fd, off_t offset) |
Construct a new buffer from part of a file. More... | |
static BufferPtr | create (const std::string &filename, int oflags, int mprot, int mflags) |
Construct a new buffer from part of 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 | |
MmapBuffer (uint8_t *data, size_t size, bool read_only) | |
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 whose underlying storage is from mmap.
Definition at line 243 of file MemoryMap.h.
|
virtual |
Definition at line 345 of file MemoryMap.C.
|
inlineprotected |
Definition at line 262 of file MemoryMap.h.
References MemoryMap::Buffer::set_read_only().
|
static |
Construct a new buffer from part of a file.
The file is mapped into memory via mmap and unmapped when the last reference to the buffer is deleted. The arguments are the same as for mmap. A MemoryMap::Exception is thrown if the file cannot be mapped. The file is not closed after mapping.
Definition at line 337 of file MemoryMap.C.
Referenced by MemoryMap::insert_file().
|
static |
Construct a new buffer from part of a file.
The file is opened with the flags oflags
and then mapped into memory by calling mmap with the mprot
and mflags
arguments. The entire file is mapped. A MemoryMap::Exception is thrown if the file cannot be opened or the memory cannot be mapped. The file is closed immediately after mapping.
Definition at line 316 of file MemoryMap.C.
|
virtual |
Mmap buffers cannot be resized.
This method will abort if called.
Reimplemented from MemoryMap::ExternBuffer.
Definition at line 354 of file MemoryMap.C.