|
libtgd 5.0
A library that makes working with multidimensional arrays in C++ easy
|
An mmap-based allocator that allows to work with arrays that do not fit into main memory. More...
#include <alloc.hpp>
Inherits TGD::Allocator.
Public Types | |
| enum | Type { Private , NewFile , ExistingFileReadOnly , ExistingFileReadWrite } |
Public Member Functions | |
| MmapAllocator (const std::string &dirName=".") | |
| Constructor for a private mmap allocator. | |
| MmapAllocator (const std::string &fileName, Type type) | |
| Constructor for a named-file mmap allocator. | |
| virtual | ~MmapAllocator () |
| Destructor. | |
| virtual unsigned char * | allocate (std::size_t n) const override |
| Allocates n bytes. | |
| virtual std::function< void(unsigned char *p)> | getDeallocator (std::size_t n) const override |
| Returns a function that deallocates n bytes at the given pointer. | |
| virtual bool | clearsMemory () const override |
| Returns whether this allocator clears allocated memory. | |
Public Member Functions inherited from TGD::Allocator | |
| Allocator () | |
| Constructor. | |
| virtual | ~Allocator () |
| Destructor. | |
An mmap-based allocator that allows to work with arrays that do not fit into main memory.
|
inline |
Constructor for a private mmap allocator.
| dirName | Directory in which the private file is created. |
Creates a private temporary file in the given directory. Typical values for dirName are "." for the current directory, or a directory taken from the TMPDIR environment variable, if available.
|
inline |
Constructor for a named-file mmap allocator.
| fileName | Name of the file. |
| type | Type of file usage. |
The type can be NewFile, which will create a new file (or possibly overwrites an existing file with the same name), or ExistingFileReadOnly, which will open the specified file in read-only mode, or ExistingFileReadWrite, which will open the specified file in read-write mode.
|
inlinevirtual |
Destructor.
|
inlineoverridevirtual |
Allocates n bytes.
Reimplemented from TGD::Allocator.
|
inlineoverridevirtual |
Returns whether this allocator clears allocated memory.
Reimplemented from TGD::Allocator.
|
inlineoverridevirtual |
Returns a function that deallocates n bytes at the given pointer.
Reimplemented from TGD::Allocator.