2012-12-30 23:14:27 +00:00
|
|
|
#pragma once
|
2012-09-18 03:04:42 +00:00
|
|
|
#include <fc/fwd.hpp>
|
|
|
|
|
#include <fc/utility.hpp>
|
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
namespace interprocess {
|
|
|
|
|
class file_mapping;
|
|
|
|
|
class mapped_region;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
namespace fc {
|
|
|
|
|
enum mode_t {
|
|
|
|
|
read_only,
|
|
|
|
|
write_only,
|
|
|
|
|
read_write
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class file_mapping {
|
|
|
|
|
public:
|
|
|
|
|
file_mapping( const char* file, mode_t );
|
|
|
|
|
~file_mapping();
|
|
|
|
|
private:
|
|
|
|
|
friend class mapped_region;
|
2013-11-13 19:35:12 +00:00
|
|
|
#ifdef _WIN64
|
|
|
|
|
fc::fwd<boost::interprocess::file_mapping,0x38> my;
|
|
|
|
|
#else
|
2012-12-03 19:51:31 +00:00
|
|
|
fc::fwd<boost::interprocess::file_mapping,0x24> my;
|
2013-11-13 19:35:12 +00:00
|
|
|
#endif
|
2012-09-18 03:04:42 +00:00
|
|
|
};
|
2013-07-04 01:35:30 +00:00
|
|
|
|
2012-09-18 03:04:42 +00:00
|
|
|
class mapped_region {
|
|
|
|
|
public:
|
2013-06-05 19:19:00 +00:00
|
|
|
mapped_region( const file_mapping& fm, mode_t m, uint64_t start, size_t size );
|
2012-09-18 03:04:42 +00:00
|
|
|
mapped_region( const file_mapping& fm, mode_t m );
|
|
|
|
|
~mapped_region();
|
2013-01-27 15:24:11 +00:00
|
|
|
void flush();
|
2012-09-18 03:04:42 +00:00
|
|
|
void* get_address()const;
|
|
|
|
|
size_t get_size()const;
|
|
|
|
|
private:
|
|
|
|
|
fc::fwd<boost::interprocess::mapped_region,40> my;
|
|
|
|
|
};
|
|
|
|
|
}
|