dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::service::client::_device< desc_t, preference_t, stream_t, group_t > Class Template Reference

service client streaming device interface class More...

#include <dx_service_client_device.h>

Inheritance diagram for dx::service::client::_device< desc_t, preference_t, stream_t, group_t >:
Collaboration diagram for dx::service::client::_device< desc_t, preference_t, stream_t, group_t >:

Classes

struct  mirror
 the transport settings' mirror (dx::stream::settings, a hosted device's): born with the pipe, the setting mapped to the service's request More...

Public Types

typedef desc_t desc_t
typedef shared::event event_t
typedef promoted< uint32_t >::template preference< decltype(dx::device< std::string, preference_t >::preference)> source_t

Public Member Functions

void attach (channel_t **io[dx::stream::direction::directions][2], const std::vector< bool >(&channel_map)[2])
void conclude () noexcept override
 conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.
void exception (const dx::exception &exception, bool filtered=false) const noexcept override
 notification exception handler
virtual uint64_t frame () const
void hw_clock (abstract::event *event, uint32_t iosize) override
virtual bool hw_clock () const noexcept
void info (std::ostream &os) noexcept override
 log object class information
void launch () override
 launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.
virtual deviceoperator>> (std::ostream &) const
group_toperator[] (const typename desc_t::stream::desc &stream)
 the stream's group, created on first use
_devicereset ()
virtual void sleep ()
 notify system will sleep stub
virtual std::pair< source_t &, bool > source (const struct desc_t::stream &stream)
 the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources
std::string string (uint32_t idx)
bool try_conclude () noexcept
 atomically conclude()s if currently launched; returns whether this call did it
bool try_launch ()
 atomically launch()es if not already launched; returns whether this call did it
void wake () override
 ~_device () override

Public Attributes

dx::promoted< typename super::client_map > clients
dx::shared::guard< std::map< abstract::event *, dx::stream::clock::consumer > > clock
 event -> its own iosize and sample counter
client::promoted< uint32_t, requestclocksource {pipe, request::id::clocksource}
client::promoted< desc_t, requestdesc {pipe, request::id::desc}
 the service's desc, asked over the pipe at launch()
dx::driver< decltype(id), preference_t > & driver
std::map< decltype(desc_t::stream::group), group_tgroup
 streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first
struct { 
   dx::shared::guard< std::map< abstract::event *, dx::stream::clock::consumer > >   clock 
 event -> its own iosize and sample counter More...
   uint32_t   iosize 
 staging value for registration paths without their own iosize argument (macOS CF property bridge) More...
hw
promoted< std::string >::preference< decltype(super::preference)> icon
const std::string id
promoted< uint32_t >::preference< decltype(super::preference)> iosize
uint32_t iosize
 staging value for registration paths without their own iosize argument (macOS CF property bridge)
std::atomic< bool > launched
dx::stream::device::monitor monitor
preference_t preference
std::string puid
 persistent UID - system unique - could change with location
std::string puuid
 persistent universal UID - universally unique ID (i.e. serial number)
dx::shared::reference reference
 this process' crash-safe hold on the puuid's client-local preference store
client::promoted< uint32_t, requestsamplerate {pipe, request::id::samplerate}
 < the service's device settings, mirrored: born with the pipe as their server, the service's broadcasts commit them, nothing of them persists here
std::map< decltype(desc_t::stream::target.idx()), source_tsources
promoted< structdesc_t::stream * >::template preference< decltype(super::preference), uint32_tsync_reference
dx::stream::device::monitor version

Static Public Attributes

static constexpr bool hosted {true}

Protected Types

typedef service::request< service::stream::data< desc_t > > request

Protected Member Functions

virtual void grouped (group_t &)
 operator[](): a group just came into existence, a host wires its per-group transports here

Protected Attributes

pipe< requestpipe {std::string{this->driver.product_id}+ "/"+ this->id}

Friends

template<typename>
class client::group
 the app wraps this bus's own group, so friendship has to name it, not just the device's group_t ////////////////////////////////////////////////////////////////////////////

Detailed Description

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
class dx::service::client::_device< desc_t, preference_t, stream_t, group_t >

service client streaming device interface class

Exceptions
Incase of an error returned by the underlaying API the device class throws a dx::exception.

Member Typedef Documentation

◆ desc_t

typedef desc_t dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::desc_t
inherited

◆ event_t

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
typedef shared::event dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::event_t

◆ request

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
typedef service::request<service::stream::data<desc_t> > dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::request
protected

◆ source_t

typedef promoted<uint32_t>::template preference<decltype(dx::device< std::string, preference_t >::preference)> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::source_t
inherited

Constructor & Destructor Documentation

◆ ~_device()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::~_device ( )
inlineoverride

Member Function Documentation

◆ attach()

void dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::attach ( channel_t ** io[dx::stream::direction::directions][2],
const std::vector< bool >(&) channel_map[2] )
inlineinherited

◆ conclude()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::conclude ( )
inlineoverridevirtualnoexcept

conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

Here is the caller graph for this function:

◆ exception()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::exception ( const dx::exception & exception,
bool filtered = false ) const
inlineoverridevirtualnoexcept

notification exception handler

Reimplemented from dx::device< std::string, preference_t >.

◆ frame()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
virtual uint64_t dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::frame ( ) const
inlinevirtual

◆ grouped()

virtual void dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::grouped ( group_t & )
inlineprotectedvirtualinherited

operator[](): a group just came into existence, a host wires its per-group transports here

◆ hw_clock() [1/2]

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::hw_clock ( abstract::event * event,
uint32_t iosize )
inlineoverridevirtual

◆ hw_clock() [2/2]

virtual bool dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::hw_clock ( ) const
inlinevirtualnoexceptinherited
Here is the caller graph for this function:

◆ info()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::info ( std::ostream & os)
inlineoverridevirtualnoexcept

log object class information

Reimplemented from dx::device< std::string, preference_t >.

◆ launch()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::launch ( )
inlineoverridevirtual

launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

◆ operator>>()

virtual device & dx::device< std::string, preference_t >::operator>> ( std::ostream & ) const
inlinevirtualinherited

◆ operator[]()

group_t & dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::operator[] ( const typename desc_t::stream::desc & stream)
inlineinherited

the stream's group, created on first use

◆ reset()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
_device & dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::reset ( )
inline

◆ sleep()

virtual void dx::device< std::string, preference_t >::sleep ( )
inlinevirtualinherited

notify system will sleep stub

◆ source()

virtual std::pair< source_t &, bool > dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::source ( const struct desc_t::stream & stream)
inlinevirtualinherited

the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources

◆ string()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
std::string dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::string ( uint32_t idx)
inline

◆ try_conclude()

bool dx::object::try_conclude ( )
inlinenoexceptinherited

atomically conclude()s if currently launched; returns whether this call did it

◆ try_launch()

bool dx::object::try_launch ( )
inlineinherited

atomically launch()es if not already launched; returns whether this call did it

◆ wake()

void dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::wake ( )
inlineoverridevirtualinherited

◆ client::group

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
template<typename>
friend class client::group
friend

the app wraps this bus's own group, so friendship has to name it, not just the device's group_t ////////////////////////////////////////////////////////////////////////////

Member Data Documentation

◆ clients

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::promoted<typename super::client_map> dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::clients
Initial value:
{
[this](dx::promoted<typename super::client_map>::lock_t&& lock, const typename super::client_map& value, const typename super::client_map&){
dx::promoted<uint32_t>::lock_t tmp(std::move(lock));
if(clients.transient)
clients.commit(std::move(tmp), value);
else if(!clients.initialized)
clients.initialized= true;
}}
promoted< typename super::client_map > clients
Definition dx_asio_client_device.h:234
Definition dx_device.h:57
std::unique_lock< mutex_t > lock_t
Definition dx_value.h:75

◆ clock

dx::shared::guard<std::map<abstract::event*, dx::stream::clock::consumer> > dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::clock
inherited

event -> its own iosize and sample counter

◆ clocksource

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
client::promoted<uint32_t, request> dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::clocksource {pipe, request::id::clocksource}

◆ desc

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
client::promoted<desc_t, request> dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::desc {pipe, request::id::desc}

the service's desc, asked over the pipe at launch()

◆ driver

dx::driver<decltype(id), preference_t>& dx::device< std::string, preference_t >::driver
inherited

◆ group

std::map<decltype(desc_t::stream::group), group_t> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::group
inherited

streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first

◆ hosted

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
bool dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::hosted {true}
staticconstexpr

◆ [struct]

struct { ... } dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::hw
Todo
migrate hw clock generation/distribution into a dedicated clock class

◆ icon

promoted<std::string>::preference<decltype(super::preference)> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::icon
inherited

◆ id

const std::string dx::device< std::string, preference_t >::id
inherited

◆ iosize [1/2]

promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::iosize
inherited

◆ iosize [2/2]

uint32_t dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::iosize
inherited

staging value for registration paths without their own iosize argument (macOS CF property bridge)

◆ launched

std::atomic<bool> dx::object::launched
inherited

◆ monitor

dx::stream::device::monitor dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::monitor
inherited

◆ pipe

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
pipe<request> dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::pipe {std::string{this->driver.product_id}+ "/"+ this->id}
protected

◆ preference

preference_t dx::device< std::string, preference_t >::preference
inherited

◆ puid

std::string dx::device< std::string, preference_t >::puid
inherited

persistent UID - system unique - could change with location

◆ puuid

std::string dx::device< std::string, preference_t >::puuid
inherited

persistent universal UID - universally unique ID (i.e. serial number)

◆ reference

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::shared::reference dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::reference
Initial value:
{
std::string{this->driver.product_id}+ "/"+ driver<super>::property::bus+ "/"+ dx::process().name()+ "/"+ this->puuid}
std::string puuid
Definition dx_device.h:52
const char * product_id
Definition dx_driver.h:144
service client driver interface class
Definition dx_service_client_driver.h:99
process
Definition macOS/dx_sync.h:351
static constexpr auto bus
Definition dx_service_client_driver.h:149

this process' crash-safe hold on the puuid's client-local preference store

dx::device::preference (driver.preference[puuid]) is this client process' own settings cache for the device - distinct from the service's own copy (a different registry hive: the service runs as LocalSystem, clients as the interactive user). Live values (samplerate, iosize, ...) already reach this object independently via the chain<> pipe broadcast below; what preference persists here is only what should survive this process disconnecting and reconnecting later.

The preference path is namespaced per connecting application (see the driver constructor in dx_service_client_driver.h, via process::name()), not just per device: two different applications must not share one settings key, but several instances of the same application legitimately should - and can therefore hold that identical key open at the same time. conclude() must not simply erase it on every single instance's own disconnect (schedule_erase only ever fires for non-persistent devices to begin with) - that would delete settings a sibling instance still actively uses, racing its concurrent registry access.

reference is this instance's hold on that shared identity: holding it signals "I am interested" to every other process under the same name, with no protocol beyond its own construction/release() - the OS releases the underlying named mutex (Windows) / advisory lock (macOS) on process exit even on a crash, so this can never desync the way a value manually incremented/decremented in memory would (dx_shared_reference.h). release() reports whether this was the last holder; only then may conclude() erase.

◆ samplerate

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
client::promoted<uint32_t, request> dx::service::client::_device< desc_t, preference_t, stream_t, group_t >::samplerate {pipe, request::id::samplerate}

< the service's device settings, mirrored: born with the pipe as their server, the service's broadcasts commit them, nothing of them persists here

◆ sources

std::map<decltype(desc_t::stream::target.idx()), source_t> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::sources
inherited

source selectors by stream target: a stream with sources gets its own on first use

◆ sync_reference

promoted<structdesc_t::stream*>::template preference<decltype(super::preference), uint32_t> dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::sync_reference
inherited

◆ version

dx::stream::device::monitor dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >::version
inherited

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.