dxd - dynax driver framework 2.5.0d148
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
 promoted::preference with default and optional alignment function More...
 

Public Types

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

Public Member Functions

 catch (...)
 
 catch (...)
 
 catch (...)
 
 catch (const dx::exception &__dx_exception)
 
 catch (const dx::exception &__dx_exception)
 
 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
 
 operator const value_t & () try
 
promotedoperator= (const value_t &value) try
 
bool operator== (const value_t &value) noexcept
 
 promoted ()=default
 
 promoted (const decltype(listen)&listen)
 
 promoted (const decltype(server)&server)
 
 promoted (const decltype(server)&server, const decltype(listen)&listen)
 
 promoted (const value_t &value)
 
 promoted (const value_t &value, const decltype(listen)&listen)
 

Public Attributes

bool initialized {}
 
std::deque< std::function< void(const value_t &)> listen )
 
std::function< void(lock_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.emblace_back(listener); 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

Constructor & Destructor Documentation

◆ promoted() [1/6]

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

◆ promoted() [2/6]

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

◆ promoted() [3/6]

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

◆ promoted() [4/6]

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

◆ promoted() [5/6]

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

◆ promoted() [6/6]

template<typename value_t >
dx::promoted< value_t >::promoted ( const value_t & value,
const decltype(listen)& 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::promoted< value_t >::catch ( const dx::exception & __dx_exception)
inline

◆ catch() [5/9]

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

◆ catch() [6/9]

template<typename value_t >
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::promoted< value_t >::operator const value_t & ( )
inline

◆ operator=()

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==()

template<typename value_t >
bool dx::promoted< value_t >::operator== ( const value_t & value)
inlinenoexcept

Member Data Documentation

◆ initialized

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

◆ listen

template<typename value_t >
std::deque<std::function<void(const value_t&)> dx::promoted< value_t >::listen)

◆ server

template<typename value_t >
std::function<void(lock_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 it needs to handle these case: not initialized and not in transation: initialze and commit the value not initialized and in transation: 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 Fri Aug 22 2025

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.