Files
spark/src/lib/utils/SharedMemory.h
T

32 lines
735 B
C++

#pragma once
#include "lib/utils/bts_export.h"
#include "lib/utils/bts_no_copy.h"
#include <memory>
#include <string>
#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 utils
} // namespace bts