dxd - dynax driver framework 3.0.1d223
cross platform open source driver development framework
Loading...
Searching...
No Matches
cf::tree< derived_t > Class Template Reference

dx::key_value_tree<derived_t> contract (dxd/interface/dx_key_value_tree.h), implemented once for every CF-backed preference store (cf::_preference, sc::_preference, dx::coreaudio::server::_preference) - inherit from this (CRTP: class _preference: public cf::tree<_preference>) instead of reimplementing it. More...

#include <cf_tree.h>

Public Member Functions

 catch (...)

Static Public Member Functions

template<typename value_t, typename self_t>
static void assign (const self_t &self, const value_t &value)
template<typename self_t>
static void assign_property (const self_t &self, ::CFPropertyListRef value, ::CFPropertyListRef baseline=nullptr)
template<typename container_t, typename self_t>
static container_t children (const self_t &self)
template<typename value_t>
static constexpr bool enabled ()
template<typename value_t, typename self_t>
static bool fetch (const self_t &self, value_t &value)
template<typename self_t>
static bool nested (const self_t &self)
template<typename self_t>
static ::CFPropertyListRef property_list (const self_t &self)
template<typename self_t>
static void purge (const self_t &self) noexcept
template<typename self_t>
static size_t size (const self_t &self)

Detailed Description

template<typename derived_t>
class cf::tree< derived_t >

dx::key_value_tree<derived_t> contract (dxd/interface/dx_key_value_tree.h), implemented once for every CF-backed preference store (cf::_preference, sc::_preference, dx::coreaudio::server::_preference) - inherit from this (CRTP: class _preference: public cf::tree<_preference>) instead of reimplementing it.

derived_t only ever has to provide the 10 position-only primitives below - operating on self's own key alone (empty meaning the whole domain, or, for a derived_t that documents no root support, throwing), never the parent chain:

operator ::CFPropertyListRef() const; // +1, throws if absent
::CFPropertyListRef operator ()(::CFPropertyListRef dflt) const; // +1, dflt (retained) if absent, never throws
operator ::CFArrayRef() const; // +1: this key's own child names
operator array<>::dx_container() const; // same, as the friendlier vector-of-cf::type<>
template<typename container_t> operator container_t() const; // same, as any string container (set<string>, vector<string>, ...)
bool container() const; // true if this key's value is a dictionary
size_t size() const; // this key's own immediate child count
operator bool() const; // true if this key exists
void operator =(::CFPropertyListRef value); // write-through
void erase(); // remove
Definition cf_array.h:38
static size_t size(const self_t &self)
Definition cf_tree.h:172
super & operator=(::BOOL value)
Definition dx_pipe.h:159

Everything else - resolving self's whole parent chain into the entire nested CFPropertyListRef subtree rooted at self - is identical for every CF-backed store and lives here, once (property_list()/assign_property(), plus size()/children() below). These reach derived_t's own, non-recursive primitives via self.derived_t::operator X(), never plain self.operator X(): dx::key_value_tree<derived_t> redeclares operator bool()/operator=/ operator value_t()/erase()/container()/size() itself (folding in this same parent-chain resolution), hiding those names inherited from derived_t - a plain unqualified access would otherwise recurse into the wrong (derived, chain-resolving) version instead of derived_t's own.

Member Function Documentation

◆ assign()

template<typename derived_t>
template<typename value_t, typename self_t>
void cf::tree< derived_t >::assign ( const self_t & self,
const value_t & value )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign_property()

template<typename derived_t>
template<typename self_t>
void cf::tree< derived_t >::assign_property ( const self_t & self,
::CFPropertyListRef value,
::CFPropertyListRef baseline = nullptr )
inlinestatic

downward write-back mirroring property_list()'s upward read, creating ancestor dictionaries as needed. baseline is the parent value this write's own value was computed from (passed down from the caller's own property_list() read) - at the root, a mismatch against the current stored value means a concurrent writer raced this one, and dx::busy is raised so assign()/purge() retry against fresh state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ catch()

template<typename derived_t>
cf::tree< derived_t >::catch ( ...)
inline

◆ children()

template<typename derived_t>
template<typename container_t, typename self_t>
container_t cf::tree< derived_t >::children ( const self_t & self)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enabled()

template<typename derived_t>
template<typename value_t>
constexpr bool cf::tree< derived_t >::enabled ( )
inlinestaticconstexpr

mirrors fetch<>'s supported value_t set, for key_value_tree_enabled's SFINAE (dx_key_value_tree.h) - cf's own POD/bridging or CFPropertyListRef-constructible types only.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch()

template<typename derived_t>
template<typename value_t, typename self_t>
bool cf::tree< derived_t >::fetch ( const self_t & self,
value_t & value )
inlinestatic

value_t is a cf POD/bridging type (see enabled() below) or a foreign type convertible from a CF pointer (e.g. cf::dictionary<>, routed via the third branch below); returns false for an absent self, throwing only for a genuinely malformed stored value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nested()

template<typename derived_t>
template<typename self_t>
bool cf::tree< derived_t >::nested ( const self_t & self)
inlinestatic
Here is the call graph for this function:

◆ property_list()

template<typename derived_t>
template<typename self_t>
::CFPropertyListRef cf::tree< derived_t >::property_list ( const self_t & self)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ purge()

template<typename derived_t>
template<typename self_t>
void cf::tree< derived_t >::purge ( const self_t & self)
inlinestaticnoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

template<typename derived_t>
template<typename self_t>
size_t cf::tree< derived_t >::size ( const self_t & self)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

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

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.