dxd - dynax driver framework 2.6.0d196
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::promoted< _value_t > Class Template Reference

promoted value More...

#include <dx_value.h>

+ Inheritance diagram for dx::promoted< _value_t >:
+ Collaboration diagram for dx::promoted< _value_t >:

Classes

class  chain
 
class  preference
 

Public Types

typedef std::unique_lock< mutex_tlock_t
 
typedef std::mutex mutex_t
 
typedef _value_t value_t
 

Public Member Functions

 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)
 
void commit (lock_t &&lock, const value_t &value) try
 
DX_PRAGMA_IGNORE_RETURN_VALUE_END operator const value_t & () try
 
promotedoperator++ () noexcept
 
value_t operator++ (int) noexcept
 
promotedoperator+= (const value_t &value) noexcept
 
promotedoperator-- () noexcept
 
value_t operator-- (int) noexcept
 
promotedoperator-= (const value_t &value) noexcept
 
const value_toperator-> ()
 
promotedoperator= (const value_t &value) try
 
promotedoperator= (promoted &promoted) noexcept
 
DX_PRAGMA_IGNORE_RETURN_VALUE_END bool operator== (const value_t &value) noexcept
 
bool operator== (promoted &promoted) noexcept
 
 promoted ()=default
 
 promoted (const value_t &value)
 
 promoted (const value_t &value, decltype(listen)&&listen)
 
 promoted (const value_t &value, decltype(listen)::mapped_type &&listen)
 
 promoted (decltype(listen)&&listen)
 
 promoted (decltype(listen)::mapped_type &&listen)
 
 promoted (decltype(server)&&server)
 
 promoted (decltype(server)&&server, decltype(listen)&&listen)
 
 promoted (decltype(server)&&server, decltype(listen)::mapped_type &&listen)
 

Public Attributes

bool initialized {}
 
std::map< void *, std::function< void(const value_t &)> listen )
 
std::function< void(lock_t &&, const value_t &, const value_t &) server ) {}
 \ indicate the value is in transition - does not have the new value yet
 
bool transient {}
 \ indicate the value has been initialized
 

Protected Attributes

value_t value
 

Detailed Description

template<typename _value_t>
class dx::promoted< _value_t >

promoted value

This works like any value_t except that interested parties can subscribe to get notified about changes. If a server has been given assigning a value forwards it to the server and expects the value to be commit()ed back, then all parties are notified. It features caching but ensures that always the actual server value are returned, if the server behaves correctly and promotes all value changes via commit() on its own. If the value has not been initialized the promoted value makes sure to request it from the server. If no server has been given requesting an unitialized value will except. The listener need to make sure to unsubscribe when deleted.

usage: dx::promoted<value_t> promoted_value; promoted_value= new value assignment; current value= promoted_value;

using value_t= decltype(promoted<value_t>::value); using server_t= decltype(promoted<value_t>::server); using listen_t= decltype(promoted<value_t>::listen::value_t);

promoted_value.listen[id]= std::function<void(const value_t&)>; promoted_value.server(server);

The server needs to take ownership of the unique_lock and has to make sure to callback commit() and unlock the lock.

Member Typedef Documentation

◆ lock_t

template<typename _value_t >
typedef std::unique_lock<mutex_t> dx::promoted< _value_t >::lock_t

◆ mutex_t

template<typename _value_t >
typedef std::mutex dx::promoted< _value_t >::mutex_t

◆ value_t

template<typename _value_t >
typedef _value_t dx::promoted< _value_t >::value_t

Constructor & Destructor Documentation

◆ promoted() [1/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( decltype(server)&& server)
inline

◆ promoted() [2/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( decltype(server)&& server,
decltype(listen)&& listen )
inline

◆ promoted() [3/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( decltype(server)&& server,
decltype(listen)::mapped_type && listen )
inline

◆ promoted() [4/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( )
default

◆ promoted() [5/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( const value_t & value)
inline
+ Here is the call graph for this function:

◆ promoted() [6/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( decltype(listen)&& listen)
inline

◆ promoted() [7/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( decltype(listen)::mapped_type && listen)
inline

◆ promoted() [8/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( const value_t & value,
decltype(listen)&& listen )
inline
+ Here is the call graph for this function:

◆ promoted() [9/9]

template<typename _value_t >
dx::promoted< _value_t >::promoted ( const value_t & value,
decltype(listen)::mapped_type && listen )
inline
+ Here is the call graph for this function:

Member Function Documentation

◆ catch() [1/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( ...)
inline

◆ catch() [2/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( ...)
inline

◆ catch() [3/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( ...)
inline

◆ catch() [4/9]

template<typename _value_t >
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::promoted< _value_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [5/9]

template<typename _value_t >
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::promoted< _value_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [6/9]

template<typename _value_t >
DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN dx::promoted< _value_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [7/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( const std::exception & __std_exception)
inline

◆ catch() [8/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( const std::exception & __std_exception)
inline

◆ catch() [9/9]

template<typename _value_t >
dx::promoted< _value_t >::catch ( const std::exception & __std_exception)
inline

◆ commit()

template<typename _value_t >
void dx::promoted< _value_t >::commit ( lock_t && lock,
const value_t & value )
inline
+ Here is the caller graph for this function:

◆ operator const value_t &()

template<typename _value_t >
DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::promoted< _value_t >::operator const value_t & ( )
inline

◆ operator++() [1/2]

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator++ ( )
inlinenoexcept
+ Here is the call graph for this function:

◆ operator++() [2/2]

template<typename _value_t >
value_t dx::promoted< _value_t >::operator++ ( int )
inlinenoexcept
+ Here is the call graph for this function:

◆ operator+=()

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator+= ( const value_t & value)
inlinenoexcept
+ Here is the call graph for this function:

◆ operator--() [1/2]

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator-- ( )
inlinenoexcept
+ Here is the call graph for this function:

◆ operator--() [2/2]

template<typename _value_t >
value_t dx::promoted< _value_t >::operator-- ( int )
inlinenoexcept
+ Here is the call graph for this function:

◆ operator-=()

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator-= ( const value_t & value)
inlinenoexcept
+ Here is the call graph for this function:

◆ operator->()

template<typename _value_t >
const value_t & dx::promoted< _value_t >::operator-> ( )
inline

◆ operator=() [1/2]

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator= ( const value_t & value)
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=() [2/2]

template<typename _value_t >
promoted & dx::promoted< _value_t >::operator= ( promoted< _value_t > & promoted)
inlinenoexcept
+ Here is the call graph for this function:

◆ operator==() [1/2]

template<typename _value_t >
DX_PRAGMA_IGNORE_RETURN_VALUE_END bool dx::promoted< _value_t >::operator== ( const value_t & value)
inlinenoexcept
+ Here is the caller graph for this function:

◆ operator==() [2/2]

template<typename _value_t >
bool dx::promoted< _value_t >::operator== ( promoted< _value_t > & promoted)
inlinenoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ initialized

template<typename _value_t >
bool dx::promoted< _value_t >::initialized {}

◆ listen

template<typename _value_t >
std::map<void*, std::function<void(const value_t&)> dx::promoted< _value_t >::listen)

◆ server

template<typename _value_t >
std::function<void(lock_t&&, const value_t&, const value_t&) dx::promoted< _value_t >::server) {}

\ indicate the value is in transition - does not have the new value yet

server: handle synchronous and asynchronous value updates and initialization lock: lock promoted value from access during update value: new value (if in transition) current: current value to allow discarding update and reverting to current value if update is not permitted

it needs to handle these case: not initialized and not in transition: initialze and commit the value not initialized and in transition: if dependent on external settings initialize a temporary and compare it with the new value and update the external setting if required make sure to commit the new value so listeners get notified either synchronously or asynchronously by external notification initialized and in transition: update external settings if any and make sure to commit the new value so listeners get notified either synchronously or asynchronousl by external notification

server will not be called with this state: initialized and not in transation

◆ transient

template<typename _value_t >
bool dx::promoted< _value_t >::transient {}

\ indicate the value has been initialized

◆ value

template<typename _value_t >
value_t dx::promoted< _value_t >::value
protected

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

(c) copyright 2009 dynamic acoustics e.U. generated on Sun Jan 25 2026

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.