dxd - dynax driver framework 2.7.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dxd::promoted< value_t, server_t > Class Template Reference

kernel-mode promoted value, mirroring dx::promoted's server/commit/notify shape More...

#include <dxd_promoted.h>

Inheritance diagram for dxd::promoted< value_t, server_t >:
Collaboration diagram for dxd::promoted< value_t, server_t >:

Public Types

typedef lock< mutex > lock_t

Public Member Functions

void commit (lock_t &&lock, const value_t &value)
 server calls this once it has decided on (and, if needed, persisted) the actual value to accept - wakes every registered listener.
 operator const value_t & ()
promotedoperator= (const value_t &value)
 promoted (const value_t &value, server_t &&server)
 promoted (server_t &&server)

Public Attributes

broadcast broadcast
 listeners (dxd::event<dxd::kernel|dxd::user>) woken on every commit()
bool initialized = false
 indicates the value has been initialized
bool transient = false
 indicates the value is in transition - does not have the new value yet

Protected Member Functions

 operator const::IOLock * () const
 operator::IOLock * ()

Protected Attributes

os_result status =not_initialized

Detailed Description

template<typename value_t, typename server_t>
class dxd::promoted< value_t, server_t >

kernel-mode promoted value, mirroring dx::promoted's server/commit/notify shape

Same concept as dx::promoted (dx_value.h): a value that funnels every write through a pluggable server callback (validate/align/persist, then commit()), caches the committed value for reads, and notifies interested parties of every change - without dx::promoted's std::mutex/std::function/dx::listen, none of which are kernel-safe.

Two differences in kind, both forced by the kernel environment rather than a narrowing of the concept:

  • server_t is a template parameter (the caller's lambda/functor type), not a std::function value - the same "inject arbitrary validation logic per promoted member" pattern, resolved at compile time instead of via a type-erased, heap-allocating closure.
  • notify is dxd::broadcast::signal() (wake registered listeners, who then re-read the value themselves), not dx::listen's std::function<void(value_t)> push - listeners here are as likely to be a dxd::event<dxd::user> bridging into a different process as an in-process callback, and a pushed value has no meaning across that boundary the way a signal-then-pull does.

No C++ exceptions (kernel code doesn't use them - see dxd/CLAUDE.md): the server callback is expected to call commit() itself when a value is accepted, exactly like dx::promoted's server contract already documents; a server that declines a change simply doesn't call commit(), leaving the previous value in place - there is no thrown rejection to report back to operator=()'s caller. Reentrancy (writing while a write is already in flight) is defended against by no-op'ing rather than throwing.

Member Typedef Documentation

◆ lock_t

template<typename value_t, typename server_t>
typedef lock<mutex> dxd::promoted< value_t, server_t >::lock_t

Constructor & Destructor Documentation

◆ promoted() [1/2]

template<typename value_t, typename server_t>
dxd::promoted< value_t, server_t >::promoted ( server_t && server)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ promoted() [2/2]

template<typename value_t, typename server_t>
dxd::promoted< value_t, server_t >::promoted ( const value_t & value,
server_t && server )
inline
Here is the call graph for this function:

Member Function Documentation

◆ commit()

template<typename value_t, typename server_t>
void dxd::promoted< value_t, server_t >::commit ( lock_t && lock,
const value_t & value )
inline

server calls this once it has decided on (and, if needed, persisted) the actual value to accept - wakes every registered listener.

Here is the call graph for this function:

◆ operator const value_t &()

template<typename value_t, typename server_t>
dxd::promoted< value_t, server_t >::operator const value_t & ( )
inline
Here is the call graph for this function:

◆ operator const::IOLock *()

dxd::mutex::operator const::IOLock * ( ) const
inlineinherited

◆ operator::IOLock *()

dxd::mutex::operator::IOLock * ( )
inlineinherited

◆ operator=()

template<typename value_t, typename server_t>
promoted & dxd::promoted< value_t, server_t >::operator= ( const value_t & value)
inline

<reentrant write while one is already in flight: no-op rather than throw

Here is the call graph for this function:

Member Data Documentation

◆ broadcast

template<typename value_t, typename server_t>
broadcast dxd::promoted< value_t, server_t >::broadcast

listeners (dxd::event<dxd::kernel|dxd::user>) woken on every commit()

◆ initialized

template<typename value_t, typename server_t>
bool dxd::promoted< value_t, server_t >::initialized = false

indicates the value has been initialized

◆ status

os_result dxd::mutex::status =not_initialized
inherited

◆ transient

template<typename value_t, typename server_t>
bool dxd::promoted< value_t, server_t >::transient = false

indicates the value is in transition - does not have the new value yet


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.