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)
UuidReference & operator= (const UuidReference &other)
 UuidReference (UuidReference &&other)
UuidReference & operator= (UuidReference &&other)
auto id () const -> UuidType
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
RegistryT::BaseType * get_object_base () const
template<typename... Args>
UuidReference clone_new_identity (Args &&... args) const
auto get_iterator_in_registry () const
auto get_iterator_in_registry ()

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.

Template Parameters
RegistryT

Definition at line 137 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 140 of file uuid_identifiable_object.h.

◆ VariantType

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

Definition at line 141 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 144 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 146 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 152 of file uuid_identifiable_object.h.

◆ UuidReference() [4/4]

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

Definition at line 171 of file uuid_identifiable_object.h.

◆ ~UuidReference()

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

Definition at line 195 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 236 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 250 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 245 of file uuid_identifiable_object.h.

◆ get_object()

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

Definition at line 217 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 224 of file uuid_identifiable_object.h.

◆ get_object_base()

template<typename RegistryT>
RegistryT::BaseType * zrythm::utils::UuidReference< RegistryT >::get_object_base ( ) const
inline

Definition at line 230 of file uuid_identifiable_object.h.

◆ id()

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

Definition at line 197 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 160 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 179 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 206 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 281 of file uuid_identifiable_object.h.

◆ operator==

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

Definition at line 289 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 276 of file uuid_identifiable_object.h.


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