Loading...
Searching...
No Matches
life.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
9 class chunk;
10
21 class _nout life: public typeProvidable, public tbindable<instance> {
22 BY_ME(life)
23 BY_INIT_META(me)
24
25 public:
26 // life:
27 life();
28 explicit life(id newId);
29 ~life();
30
31 public:
32 instance* operator->();
33 instance& operator*();
34 const instance* operator->() const BY_CONST_FUNC(operator->())
35 const instance& operator*() const BY_CONST_FUNC(operator*())
36
37 public:
42 const chunk* getChunk() const;
43
49
50 // tbindable:
56 void rel() override;
57 nbool isBind() const override;
58 const type& getBindable() const;
59
60 instance* get();
61 const instance* get() const BY_CONST_FUNC(get())
62
63 template <typename E> E* get() { return get() TO(template cast<E>()); }
64 template <typename E> const E* get() const BY_CONST_FUNC(get<E>())
65
66 using tbindable<instance>::canBind;
67 nbool canBind(const type& cls) const override;
68
70
77
78 // Instance:
79 id getId() const;
80 // typeProvidable:
81 const type& getType() const override;
82
88 static const life* getBindTag(id newId);
89
96 nbool onStrong(ncnt vote);
97
98 private:
99 // life:
100
106 nbool _completeId(instance& it);
107
113 nbool _sync(id new1);
114
115 private:
116 instance* _pt;
117 ncnt _strong;
118 id _id;
119 };
120} // namespace by
Memory chunk for block-based allocation.
Definition chunk.hpp:57
Base class for all managed instances in memlite system.
Definition instance.hpp:41
Binding tag for instance reference tracking and lifecycle management.
Definition life.hpp:21
void rel() override
Releases the binding for this life object, decrementing the strong reference count.
ncnt getStrongCnt() const
Returns current strong reference count.
Template interface for bindable objects.
Definition tbindable.hpp:13
Core class for runtime type information in byeol language.
Definition type.hpp:100
Interface for objects that can provide their type information.
Definition typeProvidable.hpp:13
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34