aboutsummaryrefslogtreecommitdiff
path: root/include/odhtdb/OwnedMemory.hpp
blob: 5dcdf25975d4dc47c0f9dfa2e1ecd102815e4d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include "types.hpp"

namespace odhtdb
{
    class OwnedMemory
    {
    public:
        OwnedMemory() : data(nullptr), size(0) {}
        OwnedMemory(void *_data, usize _size) : data(_data), size(_size) {}
        OwnedMemory(OwnedMemory &&other);
        ~OwnedMemory();
        
        // Do not allow copy of this struct, forcing move when returning a OwnedMemory in a function
        OwnedMemory(OwnedMemory&) = delete;
        OwnedMemory& operator = (OwnedMemory&) = delete;
        
        void *data;
        usize size;
    };
}