bindTag.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
9 class chunk;
10
15 class _nout bindTag: public typeProvidable, public tbindable<instance> {
16 BY_ME(bindTag)
17 BY_INIT_META(me)
18 template <typename T, typename TACTIC> friend class tweak;
19 template <typename T, typename TACTIC> friend class tstr;
20 friend class weakTactic;
21 friend class strTactic;
22
23 public:
24 // bindTag:
25 bindTag();
26 explicit bindTag(id newId);
27 ~bindTag();
28
29 public:
30 instance* operator->();
31 instance& operator*();
32 const instance* operator->() const BY_CONST_FUNC(operator->())
33 const instance& operator*() const BY_CONST_FUNC(operator*())
34
35 public:
36 const chunk* getChunk() const;
37 ncnt getStrongCnt() const;
38 // tbindable:
39 void rel() override;
40 nbool isBind() const override;
41 const type& getBindable() const;
42
43 instance* get();
44 const instance* get() const BY_CONST_FUNC(get())
45
46 template <typename E> E* get() { return get() TO(template cast<E>()); }
47 template <typename E> const E* get() const BY_CONST_FUNC(get<E>())
48
50 nbool canBind(const type& cls) const override;
51
53 nbool bind(const instance& new1) override;
54
55 // Instance:
56 id getId() const;
57 // typeProvidable:
58 const type& getType() const override;
59 static const bindTag* getBindTag(id newId);
60
61 private:
62 // bindTag:
63 nbool _onStrong(ncnt vote);
64 nbool _completeId(instance& it);
65 nbool _sync(id new1);
66
67 private:
68 instance* _pt;
69 ncnt _strong;
70 id _id;
71 };
72} // namespace by
Binding tag for instance reference tracking and lifecycle management.
Definition: bindTag.hpp:15
Memory chunk for block-based allocation.
Definition: chunk.hpp:12
Base class for all managed instances in memlite system.
Definition: instance.hpp:20
Strong reference binding tactic.
Definition: strTactic.hpp:12
Template interface for bindable objects.
Definition: tbindable.hpp:12
Strong reference smart pointer with strict type checking.
Definition: tstr.hpp:13
Weak reference smart pointer with type-safe access.
Definition: tweak.hpp:15
Base class for runtime type information in byeol language.
Definition: type.hpp:12
Interface for objects that can provide their type information.
Definition: typeProvidable.hpp:12
Weak reference binding tactic.
Definition: weakTactic.hpp:13
#define TO(fn)
Definition: to.hpp:171