MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Facets Class Reference

Arbitrary typed attributes keyed by Facet objects. More...

#include <Facets.hpp>

Collaboration diagram for MayaFlux::Facets:

Classes

struct  Entry
struct  EntryBase

Public Member Functions

void clear () noexcept
 Removes all entries.
bool empty () const noexcept
template<typename T>
bool erase (const Facet< T > &key)
 Removes the value under key.
template<typename T>
const T * get () const
 Returns the struct stored under its type, or nullptr.
template<typename U>
std::shared_ptr< U > get (const Facet< std::shared_ptr< U > > &key) const
 The shared pointer under key, or an empty one when absent.
template<typename T>
const T * get (const Facet< T > &key) const
 The value under key, or nullptr when absent.
template<auto Member>
const FacetMember< Member >::value_type * get (FacetMember< Member >) const
 The value under the member key key, or nullptr when absent.
template<typename T>
bool has (const Facet< T > &key) const
 True when key has a value.
void merge (const Facets &source)
 Adds entries from source, replacing values for shared keys.
template<typename T>
void set (const Facet< T > &key)
 Stores the key's initial value under key.
template<typename T>
void set (const Facet< T > &key, std::type_identity_t< T > value)
 Stores value under key, replacing any previous value.
template<auto Member>
void set (FacetMember< Member >, std::type_identity_t< typename FacetMember< Member >::value_type > value)
 Stores value under the member key key, replacing any previous value.
template<typename T>
void set (T value)
 Stores a struct under its type identity.
size_t size () const noexcept

Static Public Member Functions

template<typename S>
requires requires { Reflect::Generated::Description<S>::members(); }
static Facets from (const S &value)
 Builds a bag holding every data member of value.

Private Attributes

Memory::FlatMap< const void *, std::shared_ptr< const EntryBase > > m_entries
std::unordered_map< std::type_index, std::shared_ptr< const EntryBase > > m_struct_entries

Detailed Description

Arbitrary typed attributes keyed by Facet objects.

Values are held as shared immutable entries, so copying a Facets copies pointers and never the values. Writing replaces an entry; get() returns a const view that stays valid until that entry is replaced or erased. Any struct may also be stored whole by its type, separately from Facet keys.

Definition at line 103 of file Facets.hpp.


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