instance.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <map>
5
8
9struct byeolTest;
10
11namespace by {
12
13 class bindTag;
14 class instancer;
15
20 class _nout instance: public typeProvidable, public clonable {
21 BY_ME(instance)
22 BY_INIT_META(me)
23 friend class bindTag;
24 friend class watcher; // for vault.
25 friend class chunks; // for vault.
26 friend class instancer; // for _id.
27 friend struct ::byeolTest; // for vault.
28
29 public:
30 class vault {
31 public:
32 void set(void* ptr, nidx chkN);
33 nidx get(void* ptr);
34 ncnt len() const;
35 nbool rel();
36 std::map<void*, int>& getVaults();
37
38 private:
39 std::map<void*, int> _vaults;
40 };
41
42 // instance:
43 instance();
44 explicit instance(id newId);
45 instance(const me& rhs);
46 virtual ~instance();
47
48 public:
49 me& operator=(const me& rhs) = default;
50 void* operator new(size_t sz) noexcept;
51 void operator delete(void* pt, size_t sz) noexcept;
52
53 public:
54 virtual id getId() const;
55 virtual nbool isHeap() const;
56 const bindTag* getBindTag() const;
57
58 protected:
59 // instance:
60 nbool _setId(id new1);
61 static instancer* _getMgr();
62
63 private:
64 id _id;
65 static vault _vault;
66 };
67} // namespace by
Binding tag for instance reference tracking and lifecycle management.
Definition: bindTag.hpp:15
Collection of memory chunks for scalable allocation.
Definition: chunks.hpp:12
Interface for objects that can be cloned.
Definition: clonable.hpp:12
Definition: instance.hpp:30
Base class for all managed instances in memlite system.
Definition: instance.hpp:20
Singleton manager for instance lifecycle and memory allocation.
Definition: instancer.hpp:13
Interface for objects that can provide their type information.
Definition: typeProvidable.hpp:12
Memory watcher for tracking instance lifecycle and allocation.
Definition: watcher.hpp:13