Files
spark/src/lib/utils/SharedMemory.h
T
2017-08-07 17:21:12 -04:00

31 lines
711 B
C++

#pragma once
#include "lib/utils/bts_no_copy.h"
#include "lib/utils/bts_export.h"
#include <string>
#include <memory>
#include <utility>/*pair*/
namespace bts {
namespace utils {
typedef uint8_t byte;
struct Segment {
size_t size;
byte* address;
operator bool() const { return size != 0 && address != nullptr; }
};
struct LowLevelSharedMemory {
virtual ~LowLevelSharedMemory() {};
virtual Segment create(const std::string& name, size_t size) = 0;
virtual const Segment open(const std::string& name, bool read_only) = 0;
virtual bool release(const std::string& name) = 0;
};
BTS_EXPORT std::unique_ptr<LowLevelSharedMemory> create_low_level_shared_memory(bool shared);
}}//namespace