dxd - dynax driver framework 3.0.2
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 dxd::broadcast::listener listener
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.
os_result exchange(const void* in, size_t size_in, void* out, size_t size_out, size_t& size)
 the value as an IOCTL: in the wish, out the value - either may be absent
 operator const value_t&()
promoted& operator ++()
value_t operator ++(int)
promoted& operator +=(const value_t& delta)
 a counted value steps under the lock: concurrent steps never lose one, a step below zero stops at it, the postfix forms return what they stepped from
promoted& operator --()
value_t operator --(int)
promoted& operator -=(const value_t& delta)
promoted& operator =(const value_t& value)
 promoted(class broadcast& broadcast, const value_t& value, server_t&& server)
 promoted(class broadcast& broadcast, server_t&& server)

Public Attributes

class broadcast& broadcast
 the device's: its clients' listeners, woken on every commit() of any of its values
bool initialized{}
 indicates the value has been initialized
bool transient{}
 indicates the value is in transition - does not have the new value yet

Protected Member Functions

 operator ::IOLock*()
promoted& set(lock<mutex>&& lock, const value_t& value)
 every write funnels through here: the server decides under the lock handed over; a write in flight makes it a no-op rather than a throw

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

◆ listener

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

◆ 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(class broadcast& broadcast, 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(class broadcast& broadcast, 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:
Here is the caller graph for this function:

◆ exchange()

template<typename value_t, typename server_t>
os_result dxd::promoted<value_t, server_t>::exchange(const void* in, size_t size_in, void* out, size_t size_out, size_t& size)
inline

the value as an IOCTL: in the wish, out the value - either may be absent

Here is the caller 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

◆ operator ++() [1/2]

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

◆ operator ++() [2/2]

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

◆ operator +=()

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

a counted value steps under the lock: concurrent steps never lose one, a step below zero stops at it, the postfix forms return what they stepped from

Here is the call graph for this function:

◆ operator --() [1/2]

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

◆ operator --() [2/2]

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

◆ operator -=()

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

◆ 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
Here is the call graph for this function:

◆ set()

template<typename value_t, typename server_t>
promoted& dxd::promoted<value_t, server_t>::set(lock<mutex>&& lock, const value_t& value)
inlineprotected

every write funnels through here: the server decides under the lock handed over; a write in flight makes it a no-op rather than a throw

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ broadcast

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

the device's: its clients' listeners, woken on every commit() of any of its values

◆ initialized

template<typename value_t, typename server_t>
bool dxd::promoted<value_t, server_t>::initialized{}

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{}

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


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