Loading...
Searching...
No Matches
watcher.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
20 class _nout watcher: public chunk {
21 BY(ME(watcher, chunk))
22
23 public:
24 // watcher:
25 watcher();
26
27 public:
28 life& operator[](nidx n);
29 const life& operator[](nidx n) const BY_CONST_FUNC(operator[](n));
30 life& operator[](id id);
31 const life& operator[](id id) const BY_CONST_FUNC(operator[](id));
32
33 public:
34 life* get(nidx n);
35 life* get(id newId);
36 const life* get(nidx n) const BY_CONST_FUNC(get(n))
37 const life* get(id newId) const BY_CONST_FUNC(get(newId))
38 // Allocator:
44 void* new1() override;
45
51 nbool del(void* used, ncnt sz) override;
52
53 protected:
54 // watcher:
60 id _genId(void* pt) const;
61
67 nidx _getIdx(void* it) const;
68 };
69} // namespace by
Memory chunk for block-based allocation.
Definition chunk.hpp:57
Binding tag for instance reference tracking and lifecycle management.
Definition life.hpp:21
Memory watcher for tracking instance lifecycle and allocation.
Definition watcher.hpp:20
nbool del(void *used, ncnt sz) override
Returns life object back to available pool.
id _genId(void *pt) const
Generates unique id for instance pointer.
const life * get(nidx n) const BY_CONST_FUNC(get(n)) const life *get(id new Id) const BY_CONST_FUNC(get(newId)) void *new 1() override
Allocates new life object from pre-allocated chunk.
nidx _getIdx(void *it) const
Calculates index in chunk from pointer address.
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34