|
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 321 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::BaseType = BaseT |
Definition at line 326 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::UuidType = typename UuidIdentifiableObject<BaseT>::Uuid |
Definition at line 324 of file uuid_identifiable_object.h.
| using zrythm::utils::OwningObjectRegistry< VariantT, BaseT >::VariantType = VariantT |
Definition at line 325 of file uuid_identifiable_object.h.
|
inline |
Definition at line 328 of file uuid_identifiable_object.h.
|
inline |
Definition at line 333 of file uuid_identifiable_object.h.
|
inline |
Definition at line 475 of file uuid_identifiable_object.h.
|
inline |
Definition at line 366 of file uuid_identifiable_object.h.
|
inline |
Definition at line 426 of file uuid_identifiable_object.h.
|
inline |
Definition at line 351 of file uuid_identifiable_object.h.
|
inlinenoexcept |
Returns an object by id.
Definition at line 399 of file uuid_identifiable_object.h.
|
inline |
Definition at line 420 of file uuid_identifiable_object.h.
|
inline |
Definition at line 409 of file uuid_identifiable_object.h.
|
inline |
Definition at line 495 of file uuid_identifiable_object.h.
|
inline |
Definition at line 386 of file uuid_identifiable_object.h.
|
inline |
Definition at line 378 of file uuid_identifiable_object.h.
|
inline |
Returns a list of all UUIDs of the objects in the registry.
Definition at line 500 of file uuid_identifiable_object.h.
|
inline |
Returns the reference count of an object.
Mainly intended for debugging.
Definition at line 468 of file uuid_identifiable_object.h.
|
inline |
Definition at line 457 of file uuid_identifiable_object.h.
|
inline |
Registers an object.
This takes ownership of the object.
Definition at line 438 of file uuid_identifiable_object.h.
|
inline |
Definition at line 482 of file uuid_identifiable_object.h.
|
inline |
Definition at line 507 of file uuid_identifiable_object.h.
|
friend |
Definition at line 523 of file uuid_identifiable_object.h.
|
friend |
Definition at line 514 of file uuid_identifiable_object.h.