18 #ifndef LUNCHBOX_MEMORYMAP_H
19 #define LUNCHBOX_MEMORYMAP_H
22 #include <boost/noncopyable.hpp>
28 namespace detail {
class MemoryMap; }
43 LUNCHBOX_API
explicit MemoryMap(
const std::string& filename );
46 LUNCHBOX_API
MemoryMap(
const std::string& filename,
const size_t size );
67 LUNCHBOX_API
const void*
map(
const std::string& filename );
78 LUNCHBOX_API
const void*
remap(
const std::string& filename );
91 LUNCHBOX_API
void*
create(
const std::string& filename,
const size_t size );
103 LUNCHBOX_API
void*
recreate(
const std::string& filename,
107 LUNCHBOX_API
void unmap();
117 {
return static_cast< const T*
>(
getAddress( )); }
124 LUNCHBOX_API
size_t getSize()
const;
127 detail::MemoryMap*
const impl_;
130 inline std::ostream&
operator << ( std::ostream& os,
const MemoryMap& m )
132 return os <<
"MemoryMap at " << m.getAddress() <<
" size " << m.getSize();
137 #endif //LUNCHBOX_MEMORYMAP_H
Defines export visibility macros for library Lunchbox.
LUNCHBOX_API size_t getSize() const
LUNCHBOX_API void * recreate(const std::string &filename, const size_t size)
Recreate a different writable file for this memory map.
LUNCHBOX_API void * create(const std::string &filename, const size_t size)
Create a writable file to a memory address.
LUNCHBOX_API const void * getAddress() const
LUNCHBOX_API ~MemoryMap()
Destruct the memory map.
Helper to map a file to a memory address (mmap).
LUNCHBOX_API const void * remap(const std::string &filename)
Remap a different file for this memory map.
LUNCHBOX_API void unmap()
Unmap the file.
LUNCHBOX_API const void * map(const std::string &filename)
Map a file to a memory address.
Abstraction layer and common utilities for multi-threaded programming.
LUNCHBOX_API MemoryMap()
Construct a new memory map.
std::ostream & operator<<(std::ostream &os, const Array< T > &array)
Pretty-print all members of the array.
const T * getAddress() const