dxd - dynax driver framework 2.5.0d148
cross platform open source driver development framework
|
promoted value More...
#include <dx_value.h>
Classes | |
class | chain |
class | preference |
promoted::preference with default and optional alignment function More... | |
Public Types | |
typedef std::unique_lock< mutex_t > | lock_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 | |
promoted & | operator= (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 |
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.
typedef std::unique_lock<mutex_t> dx::promoted< value_t >::lock_t |
typedef std::mutex dx::promoted< value_t >::mutex_t |
|
inline |
|
inline |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
bool dx::promoted< value_t >::initialized {} |
std::deque<std::function<void(const value_t&)> dx::promoted< value_t >::listen) |
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
bool dx::promoted< value_t >::transient {} |
\ indicate the value has been initialized
|
protected |
(c) copyright 2009 dynamic acoustics e.U. | generated on Fri Aug 22 2025 |