dxd - dynax driver framework 2.7.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::key_value_tree< tree_t > Class Template Reference

hierarchical key/value navigation over a flat persistent store More...

#include <dx_key_value_tree.h>

Inheritance diagram for dx::key_value_tree< tree_t >:
Collaboration diagram for dx::key_value_tree< tree_t >:

Classes

class  iterator

Public Member Functions

iterator begin () const
 catch (...)
 catch (...)
 catch (...)
 catch (...)
 catch (...)
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN catch (const dx::exception &__dx_exception)
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN catch (const dx::exception &__dx_exception)
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN catch (const dx::exception &__dx_exception)
 catch (const std::exception &__std_exception)
 catch (const std::exception &__std_exception)
 catch (const std::exception &__std_exception)
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END bool container () const
iterator end () const
DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_treeerase () noexcept
key_value_treeerase (const std::string &key)
 key_value_tree (const key_value_tree &key_value_tree)
 key_value_tree (const key_value_tree &key_value_tree, const std::string &key)
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END operator bool () const noexcept try
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t> && !std::is_same_v<bool, value_t> && !is_initializer_list_v<value_t> && (is_string_container_v<value_t> || key_value_tree_enabled<tree_t, value_t>::value), value_t>::type>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END operator value_t () const try
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type>
DX_PRAGMA_IGNORE_RETURN_VALUE_END value_t operator() (value_t dflt) const try
key_value_treeoperator= (const key_value_tree &key_value_tree) try
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type>
key_value_treeoperator= (const value_t &value) try
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_tree operator[] (const char *key) const
key_value_tree operator[] (const std::string &key) const
size_t size () const
DX_PRAGMA_IGNORE_RETURN_VALUE_END ~key_value_tree ()

Public Attributes

std::shared_ptr< key_value_treeparent

Detailed Description

template<typename tree_t>
class dx::key_value_tree< tree_t >

hierarchical key/value navigation over a flat persistent store

Every node beyond the true root (parent==nullptr) exists purely in memory until a leaf is actually read/written/erased/enumerated - operator[] never touches the underlying store. At that point tree_t decides, in whatever way fits its own backing store, how to realize the operation - macOS recursively fetches/mutates/writes back a natively-nesting property list up to its flat domain; a plain-key-per-value store (dxd/interface/windows/dx_registry.h) instead joins every ancestor's bare name into one path and issues a single real call. Either way the persisted result for a leaf never depends on how many separate key_value_tree nodes were used to reach it.

requires of tree_t (see dx::registry for a concrete implementation):

tree_t(const tree_t& tree_t, const std::string& key); // cheap: no I/O, just extends identity
void operator =(const tree_t&); // copy identity
template<typename value_t, typename self_t> static bool fetch(const self_t& self, value_t&); // read into value_t& - false (not thrown) if self is simply absent; a genuine error (wrong stored type etc.) still throws
template<typename value_t, typename self_t> static void assign(const self_t& self, const value_t&); // write
template<typename self_t> static void purge(const self_t& self) noexcept; // erase, auto-pruning any now-empty ancestor
template<typename self_t> static bool nested(const self_t& self); // true if self holds named children
template<typename self_t> static size_t size(const self_t& self); // self's own immediate child count
template<typename container_t, typename self_t> static container_t children(const self_t& self); // self's own immediate child names, any string container
std::string key;
key_value_tree & operator=(const key_value_tree &key_value_tree) try
Definition dx_key_value_tree.h:164
size_t size() const
Definition dx_key_value_tree.h:232

Constructor & Destructor Documentation

◆ key_value_tree() [1/2]

template<typename tree_t>
dx::key_value_tree< tree_t >::key_value_tree ( const key_value_tree< tree_t > & key_value_tree)
inline
Here is the caller graph for this function:

◆ key_value_tree() [2/2]

template<typename tree_t>
dx::key_value_tree< tree_t >::key_value_tree ( const key_value_tree< tree_t > & key_value_tree,
const std::string & key )
inline

◆ ~key_value_tree()

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::key_value_tree< tree_t >::~key_value_tree ( )
inline

a scheduled erase must resolve the whole parent chain, which the flat base's own destructor no longer can - so discharge it here first

Member Function Documentation

◆ begin()

template<typename tree_t>
iterator dx::key_value_tree< tree_t >::begin ( ) const
inline

◆ catch() [1/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( ...)
inline

◆ catch() [2/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( ...)
inline

◆ catch() [3/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( ...)
inline

◆ catch() [4/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( ...)
inline

◆ catch() [5/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( ...)
inline

◆ catch() [6/11]

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::key_value_tree< tree_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [7/11]

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::key_value_tree< tree_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [8/11]

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::key_value_tree< tree_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [9/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( const std::exception & __std_exception)
inline

◆ catch() [10/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( const std::exception & __std_exception)
inline

◆ catch() [11/11]

template<typename tree_t>
dx::key_value_tree< tree_t >::catch ( const std::exception & __std_exception)
inline

◆ container()

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END bool dx::key_value_tree< tree_t >::container ( ) const
inline
Here is the caller graph for this function:

◆ end()

template<typename tree_t>
iterator dx::key_value_tree< tree_t >::end ( ) const
inline

◆ erase() [1/2]

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_tree & dx::key_value_tree< tree_t >::erase ( )
inlinenoexcept
Here is the caller graph for this function:

◆ erase() [2/2]

template<typename tree_t>
key_value_tree & dx::key_value_tree< tree_t >::erase ( const std::string & key)
inline

◆ operator bool()

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::key_value_tree< tree_t >::operator bool ( ) const
inlinenoexcept

the fetched bool if self holds one; else container(), which correctly reports a registry position holding only subkeys (RegQueryValueExA's value namespace is separate from the subkey one) and, for cf::tree, simply re-derives what property_list() already resolved.

◆ operator value_t()

template<typename tree_t>
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t> && !std::is_same_v<bool, value_t> && !is_initializer_list_v<value_t> && (is_string_container_v<value_t> || key_value_tree_enabled<tree_t, value_t>::value), value_t>::type>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::key_value_tree< tree_t >::operator value_t ( ) const
inline

value_t a string container routes to tree_t::children() below, folded into this same operator template (MSVC treats two separately-SFINAE- gated operator T() templates as redeclarations of each other).

◆ operator()()

template<typename tree_t>
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type>
DX_PRAGMA_IGNORE_RETURN_VALUE_END value_t dx::key_value_tree< tree_t >::operator() ( value_t dflt) const
inline

always succeeds, falling back to dflt for a genuine fetch<> error too - the try/catch is purely a safety net around that.

◆ operator=() [1/2]

template<typename tree_t>
key_value_tree & dx::key_value_tree< tree_t >::operator= ( const key_value_tree< tree_t > & key_value_tree)
inline

◆ operator=() [2/2]

template<typename tree_t>
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type>
key_value_tree & dx::key_value_tree< tree_t >::operator= ( const value_t & value)
inline

◆ operator[]() [1/2]

template<typename tree_t>
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_tree dx::key_value_tree< tree_t >::operator[] ( const char * key) const
inline

◆ operator[]() [2/2]

template<typename tree_t>
key_value_tree dx::key_value_tree< tree_t >::operator[] ( const std::string & key) const
inline
Here is the caller graph for this function:

◆ size()

template<typename tree_t>
size_t dx::key_value_tree< tree_t >::size ( ) const
inline
Here is the caller graph for this function:

Member Data Documentation

◆ parent

template<typename tree_t>
std::shared_ptr<key_value_tree> dx::key_value_tree< tree_t >::parent

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.