aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/shmat.h
blob: ab860e30ca5649d317b84b6d64cb69a1edceb1f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once 
 
#include "fhandle.h"

#include <util/generic/ptr.h>
#include <util/generic/guid.h>
 
class TSharedMemory: public TThrRefBase {
    TGUID Id; 
    FHANDLE Handle;
    void* Data;
    int Size; 

public: 
    TSharedMemory();
    ~TSharedMemory() override;

    bool Create(int Size); 
    bool Open(const TGUID& id, int size);

    const TGUID& GetId() {
        return Id;
    }

    void* GetPtr() {
        return Data;
    }

    int GetSize() const {
        return Size;
    }
};