22 lines
362 B
C++
22 lines
362 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
class SharedMemory
|
|
{
|
|
public:
|
|
void allocate(const std::string& namePrefix, std::size_t size);
|
|
|
|
int getFileDescriptor() const;
|
|
|
|
bool isValid() const;
|
|
|
|
private:
|
|
|
|
void createFile(const std::string& namePrefix);
|
|
|
|
std::string getRandomName(const std::string& namePrefix) const;
|
|
|
|
int mFileDescriptor{0};
|
|
bool mIsValid{false};
|
|
};
|