mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-10 07:30:09 +00:00
36 lines
569 B
C++
36 lines
569 B
C++
#ifndef __MAPPED_FILE_H__
|
|
#define __MAPPED_FILE_H__
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <File/File.h>
|
|
|
|
|
|
class MappedFile {
|
|
public:
|
|
|
|
MappedFile();
|
|
MappedFile(File f, bool readOnly);
|
|
MappedFile(MappedFile&);
|
|
|
|
~MappedFile();
|
|
|
|
void sync();
|
|
void close();
|
|
|
|
void *address() const { return _address; }
|
|
size_t length() const { return _length; }
|
|
|
|
void swap(MappedFile &);
|
|
void adopt(MappedFile &);
|
|
|
|
private:
|
|
|
|
MappedFile& operator=(MappedFile &);
|
|
|
|
void *_address;
|
|
size_t _length;
|
|
};
|
|
|
|
|
|
#endif |