Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::utils::UuidReference< RegistryT > Class Template Reference

A reference-counted RAII wrapper for a UUID in a registry. More...

#include <src/utils/uuid_identifiable_object.h>

Public Types

using UuidType = typename RegistryT::UuidType
using VariantType = typename RegistryT::VariantType

Public Member Functions

 UuidReference (RegistryT &registry)
 UuidReference (const UuidType &id, RegistryT &registry)
 UuidReference (const UuidReference &other)
UuidReferenceoperator= (const UuidReference &other)
 UuidReference (UuidReference &&other)
UuidReferenceoperator= (UuidReference &&other)
const UuidTypeid () const
void set_id (const UuidType &id)
 To be used when using the Registry-only constructor.
VariantType get_object () const
template<typename ObjectT>
requires IsInVariant<ObjectT *, VariantType>
ObjectT * get_object_as () const
template<typename... Args>
UuidReference clone_new_identity (Args &&... args) const
auto get_iterator_in_registry () const
auto get_iterator_in_registry ()

Static Public Attributes

static constexpr auto kIdKey = "id"sv

Friends

void to_json (nlohmann::json &j, const UuidReference &ref)
void from_json (const nlohmann::json &j, UuidReference &ref)
bool operator== (const UuidReference &lhs, const UuidReference &rhs)

Detailed Description

template<typename RegistryT>
class zrythm::utils::UuidReference< RegistryT >

A reference-counted RAII wrapper for a UUID in a registry.

Objects that refer to an object's UUID must use this wrapper.

TODO: actually use this

Template Parameters
RegistryT

Definition at line 130 of file uuid_identifiable_object.h.

Member Typedef Documentation

◆ UuidType

template<typename RegistryT>
using zrythm::utils::UuidReference< RegistryT >::UuidType = typename RegistryT::UuidType

Definition at line 133 of file uuid_identifiable_object.h.

◆ VariantType

template<typename RegistryT>
using zrythm::utils::UuidReference< RegistryT >::VariantType = typename RegistryT::VariantType

Definition at line 134 of file uuid_identifiable_object.h.

Constructor & Destructor Documentation

◆ UuidReference() [1/4]

template<typename RegistryT>
zrythm::utils::UuidReference< RegistryT >::UuidReference ( RegistryT & registry)
inline

Definition at line 139 of file uuid_identifiable_object.h.

◆ UuidReference() [2/4]

template<typename RegistryT>
zrythm::utils::UuidReference< RegistryT >::UuidReference ( const UuidType & id,
RegistryT & registry )
inline

Definition at line 141 of file uuid_identifiable_object.h.

◆ UuidReference() [3/4]

template<typename RegistryT>
zrythm::utils::UuidReference< RegistryT >::UuidReference ( const UuidReference< RegistryT > & other)
inline

Definition at line 147 of file uuid_identifiable_object.h.

◆ UuidReference() [4/4]

template<typename RegistryT>
zrythm::utils::UuidReference< RegistryT >::UuidReference ( UuidReference< RegistryT > && other)
inline

Definition at line 166 of file uuid_identifiable_object.h.

◆ ~UuidReference()

template<typename RegistryT>
zrythm::utils::UuidReference< RegistryT >::~UuidReference ( )
inline

Definition at line 190 of file uuid_identifiable_object.h.

Member Function Documentation

◆ clone_new_identity()

template<typename RegistryT>
template<typename... Args>
UuidReference zrythm::utils::UuidReference< RegistryT >::clone_new_identity ( Args &&... args) const
inline

Definition at line 226 of file uuid_identifiable_object.h.

◆ get_iterator_in_registry() [1/2]

template<typename RegistryT>
auto zrythm::utils::UuidReference< RegistryT >::get_iterator_in_registry ( )
inline

Definition at line 240 of file uuid_identifiable_object.h.

◆ get_iterator_in_registry() [2/2]

template<typename RegistryT>
auto zrythm::utils::UuidReference< RegistryT >::get_iterator_in_registry ( ) const
inline

Definition at line 235 of file uuid_identifiable_object.h.

◆ get_object()

template<typename RegistryT>
VariantType zrythm::utils::UuidReference< RegistryT >::get_object ( ) const
inline

Definition at line 212 of file uuid_identifiable_object.h.

◆ get_object_as()

template<typename RegistryT>
template<typename ObjectT>
requires IsInVariant<ObjectT *, VariantType>
ObjectT * zrythm::utils::UuidReference< RegistryT >::get_object_as ( ) const
inline

Definition at line 219 of file uuid_identifiable_object.h.

◆ id()

template<typename RegistryT>
const UuidType & zrythm::utils::UuidReference< RegistryT >::id ( ) const
inline

Definition at line 192 of file uuid_identifiable_object.h.

◆ operator=() [1/2]

template<typename RegistryT>
UuidReference & zrythm::utils::UuidReference< RegistryT >::operator= ( const UuidReference< RegistryT > & other)
inline

Definition at line 155 of file uuid_identifiable_object.h.

◆ operator=() [2/2]

template<typename RegistryT>
UuidReference & zrythm::utils::UuidReference< RegistryT >::operator= ( UuidReference< RegistryT > && other)
inline

Definition at line 174 of file uuid_identifiable_object.h.

◆ set_id()

template<typename RegistryT>
void zrythm::utils::UuidReference< RegistryT >::set_id ( const UuidType & id)
inline

To be used when using the Registry-only constructor.

This is useful when deserializing UuidReference types: First construct with just the registry, then from_json() should call this to set the ID and acquire a reference.

Definition at line 201 of file uuid_identifiable_object.h.

◆ from_json

template<typename RegistryT>
void from_json ( const nlohmann::json & j,
UuidReference< RegistryT > & ref )
friend

Definition at line 271 of file uuid_identifiable_object.h.

◆ operator==

template<typename RegistryT>
bool operator== ( const UuidReference< RegistryT > & lhs,
const UuidReference< RegistryT > & rhs )
friend

Definition at line 279 of file uuid_identifiable_object.h.

◆ to_json

template<typename RegistryT>
void to_json ( nlohmann::json & j,
const UuidReference< RegistryT > & ref )
friend

Definition at line 266 of file uuid_identifiable_object.h.

Field Documentation

◆ kIdKey

template<typename RegistryT>
auto zrythm::utils::UuidReference< RegistryT >::kIdKey = "id"sv
staticconstexpr

Definition at line 136 of file uuid_identifiable_object.h.


The documentation for this class was generated from the following file: