|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A registry that owns and manages objects identified by a UUID. More...
#include <src/utils/uuid_identifiable_object.h>


Public Types | |
| using | UuidType = typename UuidIdentifiableObject<BaseT>::Uuid |
| using | VariantType = VariantT |
| using | BaseType = BaseT |
Public Member Functions | |
| OwningObjectRegistry (QObject *parent=nullptr) | |
| template<typename CreateType, typename... Args> requires std::derived_from<CreateType, BaseT> | |
| auto | create_object (Args &&... args) -> UuidReference< OwningObjectRegistry > |
| template<typename CreateType, typename... Args> requires std::derived_from<CreateType, BaseT> | |
| auto | clone_object (const CreateType &other, Args &&... args) -> UuidReference< OwningObjectRegistry > |
| auto | get_iterator_for_id (const UuidType &id) const |
| auto | get_iterator_for_id (const UuidType &id) |
| std::optional< VariantT > | find_by_id (const UuidType &id) const noexcept |
| Returns an object by id. | |
| auto | find_by_id_or_throw (const UuidType &id) const |
| BaseT * | find_by_id_as_base_or_throw (const UuidType &id) const |
| bool | contains (const UuidType &id) const |
| void | register_object (VariantT obj_ptr) |
| Registers an object. | |
| template<typename ObjectT> requires std::derived_from<ObjectT, BaseT> | |
| void | register_object (ObjectT &obj) |
| auto | reference_count (const UuidType &id) const |
| Returns the reference count of an object. | |
| void | acquire_reference (const UuidType &id) |
| void | release_reference (const UuidType &id) |
| auto & | get_hash_map () const |
| auto | get_uuids () const |
| Returns a list of all UUIDs of the objects in the registry. | |
| size_t | size () const |
Friends | |
| void | to_json (nlohmann::json &j, const OwningObjectRegistry &obj) |
| template<ObjectBuilder BuilderT> | |
| void | from_json_with_builder (const nlohmann::json &j, OwningObjectRegistry &obj, const BuilderT &builder) |
A registry that owns and manages objects identified by a UUID.
This class provides methods to register, unregister, and find objects by their UUID. When an object is registered, this class takes ownership of it and sets the parent to this. When an object is unregistered, the ownership is released and the caller is responsible for deleting the object.
Intended to be used with variants of pointers to QObjects.
| VariantT | A variant of raw pointers to QObject-derived classes. |
| BaseT | The common base class of the objects in the variant. |
Definition at line 325 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::BaseType = BaseT |
Definition at line 330 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::UuidType = typename UuidIdentifiableObject<BaseT>::Uuid |
Definition at line 328 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::VariantType = VariantT |
Definition at line 329 of file uuid_identifiable_object.h.
|
inline |
Definition at line 332 of file uuid_identifiable_object.h.
|
inline |
Definition at line 471 of file uuid_identifiable_object.h.
|
inline |
Definition at line 362 of file uuid_identifiable_object.h.
|
inline |
Definition at line 422 of file uuid_identifiable_object.h.
|
inline |
Definition at line 347 of file uuid_identifiable_object.h.
|
inlinenoexcept |
Returns an object by id.
Definition at line 395 of file uuid_identifiable_object.h.
|
inline |
Definition at line 416 of file uuid_identifiable_object.h.
|
inline |
Definition at line 405 of file uuid_identifiable_object.h.
|
inline |
Definition at line 488 of file uuid_identifiable_object.h.
|
inline |
Definition at line 382 of file uuid_identifiable_object.h.
|
inline |
Definition at line 374 of file uuid_identifiable_object.h.
|
inline |
Returns a list of all UUIDs of the objects in the registry.
Definition at line 493 of file uuid_identifiable_object.h.
|
inline |
Returns the reference count of an object.
Mainly intended for debugging.
Definition at line 464 of file uuid_identifiable_object.h.
|
inline |
Definition at line 453 of file uuid_identifiable_object.h.
|
inline |
Registers an object.
This takes ownership of the object.
Definition at line 434 of file uuid_identifiable_object.h.
|
inline |
Definition at line 478 of file uuid_identifiable_object.h.
|
inline |
Definition at line 500 of file uuid_identifiable_object.h.
|
friend |
Definition at line 517 of file uuid_identifiable_object.h.
|
friend |
Definition at line 507 of file uuid_identifiable_object.h.