Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Tracking instances automatically on creation and disposal.
These helper templates can be used to provide a registry of all objects of some kind or type. The class to be used with instance tracking needs to cooperate, typically by inheriting from lib::AutoRegistered. Moreover, the instance lifecycle handling is assumed to utilise lumiera::P or a similar smart-ptr, which allows the registry to hold a safe reference. Thus, references won't be cleaned up automatically (as there is always at least one reference left) – rather we rely on invoking a dispose or unlink function explicitly.
The standard use case for this feature is the management of the structural facade assets Timeline and Sequence within the session. They're created automatically to reflect some internal structures within the model; with the help of lib::ElementTracker we can expose a list of all instances as part of the public Session interface.
Definition in file element-tracker.hpp.
#include "lib/p.hpp"
#include "lib/optional-ref.hpp"
#include "lib/util-foreach.hpp"
#include "lib/ref-array-impl.hpp"
Classes | |
class | AutoRegistered< TAR > |
Helper mixin template for implementing a type intended to participate in automatic element tracking. More... | |
class | ElementTracker< ELM > |
Registry for tracking object instances. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |