|
EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
|
A participant in a runtime object model with a numerically unique identifier and display name. More...
#include <Object.hpp>
Classes | |
| struct | CopyTag |
| Tag despatch discriminator for copying the base object, preserving uniqueness of IDs. More... | |
Public Member Functions | |
| ~Object ()=default | |
| Non-virtual base destructor. | |
| id_type | get_id () const noexcept |
| bool | is_valid () const noexcept |
| void | set_name (const std::string_view new_name) |
| std::string_view | get_name () const noexcept |
| const char * | get_imgui_name () const noexcept |
| Object (const Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object & | operator= (Object &&)=delete |
| bool | operator== (const Object &other) const noexcept |
| Determine shallow equality between two Object instances. | |
Static Public Member Functions | |
| static std::string_view | get_class_name () noexcept |
Protected Member Functions | |
| Object () | |
| Create a new Object with an auto-allocated ID and default display name. | |
| Object (const std::string_view object_name) | |
| Create a new Object with an auto-allocated ID and custom display name. | |
| Object (Object &&other) noexcept | |
| Object (CopyTag tag, const Object &old) | |
| Copy an existing Object. | |
| Object (CopyTag tag, const Object &old, const std::string_view new_name) | |
| Copy an existing Object. | |
| void | move_identity_from (Object &&other) noexcept |
| Helper for derived classes to provide move-assignment operations. | |
Private Attributes | |
| id_type | id |
| Primary numerical ID. | |
| std::size_t | copy_count = 0 |
| Number of times the object has been copied; used only for display names. | |
| std::string | name |
| Display name for the object. | |
Static Private Attributes | |
| static constexpr std::string_view | class_name = "Object" |
| Display name for objects of the type determined by the templated class. | |
A participant in a runtime object model with a numerically unique identifier and display name.
A design invariant, which is not realistically possible to enforce, requires that no two objects of the same class co-exist for any non-trivial duration with matching IDs. In this context, a "non-trivial lifetime" would be any state that outlives a function as a member or global variable.
In general, users should refer to objects by their stable numerical ID as opposed to iterators, pointers, or references. Transparent hashing on ordered and unordered STL containers allows fast and convenient lookup in the ID.
| Derived | The concrete derived type, used for CRTP static polymorphism. |
Definition at line 35 of file Object.hpp.
|
default |
|
inlineprotected |
Create a new Object with an auto-allocated ID and default display name.
Definition at line 111 of file Object.hpp.
|
inlineexplicitprotected |
Create a new Object with an auto-allocated ID and custom display name.
| object_name | The display name of the object. If empty, uses a sensible default based on the ID. |
Definition at line 122 of file Object.hpp.
|
inlineprotectednoexcept |
Definition at line 130 of file Object.hpp.
|
inlineprotected |
Copy an existing Object.
The new Object receives a newly allocated ID and a sensible default display name.
Definition at line 155 of file Object.hpp.
|
inlineprotected |
|
inlinestaticnodiscardnoexcept |
Definition at line 77 of file Object.hpp.
|
inlinenodiscardnoexcept |
Definition at line 46 of file Object.hpp.
|
inlinenodiscardnoexcept |
Definition at line 71 of file Object.hpp.
|
inlinenodiscardnoexcept |
Definition at line 65 of file Object.hpp.
|
inlinenodiscardnoexcept |
Definition at line 52 of file Object.hpp.
|
inlineprotectednoexcept |
Helper for derived classes to provide move-assignment operations.
For example,
| other | The Object being moved from, to have its state invalidated. |
Definition at line 211 of file Object.hpp.
|
inlinenodiscardnoexcept |
Determine shallow equality between two Object instances.
Equality is solely determined by the primary ID.
| other | The Object to compare against. |
Definition at line 94 of file Object.hpp.
|
inline |
Definition at line 57 of file Object.hpp.
|
staticconstexprprivate |
Display name for objects of the type determined by the templated class.
Inheriting classes should override the class name by doing something equivalent to:
Definition at line 235 of file Object.hpp.
|
mutableprivate |
Number of times the object has been copied; used only for display names.
Definition at line 238 of file Object.hpp.
|
private |
Primary numerical ID.
Definition at line 237 of file Object.hpp.
|
private |
Display name for the object.
Definition at line 239 of file Object.hpp.