dxd - dynax driver framework 3.0.1d223
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::map::driver< _device_t, holder_t > Class Template Referenceabstract

device mapping driver interface class More...

#include <dx_driver.h>

Inheritance diagram for dx::map::driver< _device_t, holder_t >:
Collaboration diagram for dx::map::driver< _device_t, holder_t >:

Public Types

typedef std::conditional_t< held, typename view::template iterator< typename holders::const_iterator >, typename holders::const_iterator > const_iterator
typedef std::conditional_t< held, typename view::template iterator< typename holders::iterator >, typename holders::iterator > iterator
typedef driver map
typedef driver_settings< dx::promoted< dx::log >::preference< decltype(_device_t::preference) > > settings
typedef std::conditional_t< held, typename view::value_type, typename holders::value_type > value_type

Public Member Functions

const_iterator begin () const noexcept
iterator begin () noexcept
virtual bool boot ()
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.
template<typename product_id_t, typename... args_t>
requires std::is_convertible_v<product_id_t, const char*>
 driver (product_id_t &&product_id, args_t &&... args)
const_iterator end () const noexcept
iterator end () noexcept
void exception (const class exception &exception, bool filtered=false) const noexcept override
 notification exception handler
virtual void exception (const exception &exception, bool filtered=false) const noexcept=0
 notification exception handler
iterator find (const device_id_t &device_id)
const_iterator find (const device_id_t &device_id) const
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 driver & operator<< (const char *file)
virtual driver & operator<< (std::ifstream &)
 restores device settings
virtual driver & operator>> (const char *file) const
virtual driver & operator>> (std::ostream &ostream) const
 saves device tree
virtual bool shutdown ()
 client driver::shutdown/boot(): override to shutdown/boot host driver
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. A launch() that throws is concluded before the exception leaves: the object never claims a launch it did not finish

Public Attributes

T elements
 STL member.
K keys
 STL member.
std::atomic< bool > launched
dx::log log
 cached local log level, mirrors settings::log
decltype(_device_t::preference) preference
const char * product_id
promoted< os_result > status
 the driver's condition, promoted so a host follows it without polling
uint32_t version

Protected Types

typedef decltype(device_t::id) device_id_t
typedef _device_t device_t
typedef std::map< device_id_t, std::shared_ptr< holder_t > > holders

Protected Member Functions

virtual void add (const decltype(_device_t::id) &)=0
 adds a new device to the device list
void add (const device_id_t &device_id) override
 adds a new device to the device list
virtual void arrived ()
 notify device arrivals completed stub
virtual void arrived (device_t &)
 notify specific device arrival stub
virtual void clear () noexcept
 replaces std::map::clear to call virtual notification methods
virtual void remove (const decltype(_device_t::id) &)=0
 finds and removes a device from the device list
void remove (const device_id_t &device_id) override
 finds and removes a device from the device list
virtual void removed () noexcept
 notify device removals completed stub
virtual void removed (device_t &) noexcept
 notify specific device removal stub
void sleep () override
 < notify system will sleep
void wake () override

Detailed Description

template<typename _device_t, typename holder_t = _device_t>
class dx::map::driver< _device_t, holder_t >

device mapping driver interface class

The device mapping driver class is a common driver helper to create consistently device objects and to bind and keep the device to the driver identified by the set of matching device IDs.

device arrival/removal is initiated by launch/conclude at driver start/end and as IOService notification. Therefor manipulating the device std::deque needs to be locked.

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

Member Typedef Documentation

◆ const_iterator

template<typename _device_t, typename holder_t = _device_t>
typedef std::conditional_t<held, typename view::template iterator<typename holders::const_iterator>, typename holders::const_iterator> dx::map::driver< _device_t, holder_t >::const_iterator

◆ device_id_t

template<typename _device_t, typename holder_t = _device_t>
typedef decltype(device_t::id) dx::map::driver< _device_t, holder_t >::device_id_t
protected

◆ device_t

template<typename _device_t, typename holder_t = _device_t>
typedef _device_t dx::map::driver< _device_t, holder_t >::device_t
protected

◆ holders

template<typename _device_t, typename holder_t = _device_t>
typedef std::map<device_id_t, std::shared_ptr<holder_t> > dx::map::driver< _device_t, holder_t >::holders
protected

◆ iterator

template<typename _device_t, typename holder_t = _device_t>
typedef std::conditional_t<held, typename view::template iterator<typename holders::iterator>, typename holders::iterator> dx::map::driver< _device_t, holder_t >::iterator

◆ map

template<typename _device_t, typename holder_t = _device_t>
typedef driver dx::map::driver< _device_t, holder_t >::map

◆ settings

typedef driver_settings<dx::promoted<dx::log>::preference<decltype(_device_t::preference)> > dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::settings
inherited

the driver's own settings: the log a promoted::preference on the store's dx::log::id node, resolved like a stream desc (dx::log's DX_TREE_SERIALIZE), the constructor's log its default - stored as no entry, reloaded on the store's change

◆ value_type

template<typename _device_t, typename holder_t = _device_t>
typedef std::conditional_t<held, typename view::value_type, typename holders::value_type> dx::map::driver< _device_t, holder_t >::value_type

Constructor & Destructor Documentation

◆ driver()

template<typename _device_t, typename holder_t = _device_t>
template<typename product_id_t, typename... args_t>
requires std::is_convertible_v<product_id_t, const char*>
dx::map::driver< _device_t, holder_t >::driver ( product_id_t && product_id,
args_t &&... args )
inline

Member Function Documentation

◆ add() [1/2]

virtual void dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::add ( const decltype(_device_t::id) & )
protectedpure virtualinherited

adds a new device to the device list

Exceptions
dx::exception

◆ add() [2/2]

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_t >::add ( const device_id_t & device_id)
inlineoverrideprotected

adds a new device to the device list

Exceptions
dx::exception

◆ arrived() [1/2]

template<typename _device_t, typename holder_t = _device_t>
virtual void dx::driver< device_id_t, decltype(device_t::preference) >::arrived ( )
inlineprotectedvirtual

notify device arrivals completed stub

Reimplemented from dx::driver< decltype(_device_t::id), decltype(_device_t::preference)>.

◆ arrived() [2/2]

template<typename _device_t, typename holder_t = _device_t>
virtual void dx::map::driver< _device_t, holder_t >::arrived ( device_t & )
inlineprotectedvirtual

◆ begin() [1/2]

template<typename _device_t, typename holder_t = _device_t>
const_iterator dx::map::driver< _device_t, holder_t >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename _device_t, typename holder_t = _device_t>
iterator dx::map::driver< _device_t, holder_t >::begin ( )
inlinenoexcept
Here is the caller graph for this function:

◆ boot()

virtual bool dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::boot ( )
inlinevirtualinherited

◆ clear()

template<typename _device_t, typename holder_t = _device_t>
virtual void dx::map::driver< _device_t, holder_t >::clear ( )
inlineprotectedvirtualnoexcept

replaces std::map::clear to call virtual notification methods

◆ conclude()

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_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.

Reimplemented in dx::midi::services::driver< device_t >, dx::proxy::driver< device_t >, dx::service::client::driver< device_t >, and dx::wasapi::client::driver< device_t >.

◆ end() [1/2]

template<typename _device_t, typename holder_t = _device_t>
const_iterator dx::map::driver< _device_t, holder_t >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename _device_t, typename holder_t = _device_t>
iterator dx::map::driver< _device_t, holder_t >::end ( )
inlinenoexcept
Here is the caller graph for this function:

◆ exception() [1/2]

void dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::exception ( const class exception & exception,
bool filtered = false ) const
inlineoverridenoexceptinherited

notification exception handler

◆ exception() [2/2]

virtual void dx::object::exception ( const exception & exception,
bool filtered = false ) const
pure virtualnoexceptinherited

notification exception handler

◆ find() [1/2]

template<typename _device_t, typename holder_t = _device_t>
iterator dx::map::driver< _device_t, holder_t >::find ( const device_id_t & device_id)
inline

◆ find() [2/2]

template<typename _device_t, typename holder_t = _device_t>
const_iterator dx::map::driver< _device_t, holder_t >::find ( const device_id_t & device_id) const
inline

◆ info()

◆ launch()

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_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.

Reimplemented in dx::midi::services::driver< device_t >, dx::proxy::driver< device_t >, dx::proxy::driver< device_t >, dx::service::client::driver< device_t >, dx::virtuel::driver< device_t >, dx::virtuel::driver< device<> >, and dx::wasapi::client::driver< device_t >.

◆ operator<<() [1/2]

template<typename _device_t, typename holder_t = _device_t>
virtual driver & dx::map::driver< _device_t, holder_t >::operator<< ( const char * file)
inlinevirtual

◆ operator<<() [2/2]

template<typename _device_t, typename holder_t = _device_t>
virtual driver & dx::map::driver< _device_t, holder_t >::operator<< ( std::ifstream & )
inlinevirtual

restores device settings

Reimplemented in dx::coreaudio::driver< device_t >, and dx::coremidi::driver< device_t >.

◆ operator>>() [1/2]

template<typename _device_t, typename holder_t = _device_t>
virtual driver & dx::map::driver< _device_t, holder_t >::operator>> ( const char * file) const
inlinevirtual

◆ operator>>() [2/2]

template<typename _device_t, typename holder_t = _device_t>
virtual driver & dx::map::driver< _device_t, holder_t >::operator>> ( std::ostream & ostream) const
inlinevirtual

saves device tree

Reimplemented in dx::coreaudio::driver< device_t >.

◆ remove() [1/2]

virtual void dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::remove ( const decltype(_device_t::id) & )
protectedpure virtualinherited

finds and removes a device from the device list

◆ remove() [2/2]

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_t >::remove ( const device_id_t & device_id)
inlineoverrideprotected

finds and removes a device from the device list

Exceptions
dx::exception

◆ removed() [1/2]

template<typename _device_t, typename holder_t = _device_t>
virtual void dx::driver< device_id_t, decltype(device_t::preference) >::removed ( )
inlineprotectedvirtualnoexcept

notify device removals completed stub

Reimplemented from dx::driver< decltype(_device_t::id), decltype(_device_t::preference)>.

◆ removed() [2/2]

template<typename _device_t, typename holder_t = _device_t>
virtual void dx::map::driver< _device_t, holder_t >::removed ( device_t & )
inlineprotectedvirtualnoexcept

notify specific device removal stub

◆ shutdown()

virtual bool dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::shutdown ( )
inlinevirtualinherited

client driver::shutdown/boot(): override to shutdown/boot host driver

◆ sleep()

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_t >::sleep ( )
inlineoverrideprotected

< notify system will sleep

notify system wake completed stub

◆ 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. A launch() that throws is concluded before the exception leaves: the object never claims a launch it did not finish

◆ wake()

template<typename _device_t, typename holder_t = _device_t>
void dx::map::driver< _device_t, holder_t >::wake ( )
inlineoverrideprotected

Member Data Documentation

◆ elements

T std::map< K, T >::elements
inherited

STL member.

◆ keys

K std::map< K, T >::keys
inherited

STL member.

◆ launched

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

◆ log

dx::log dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::log
inherited

cached local log level, mirrors settings::log

◆ preference

decltype(_device_t::preference) dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::preference
inherited

◆ product_id

const char* dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::product_id
inherited

◆ status

promoted<os_result> dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::status
inherited

the driver's condition, promoted so a host follows it without polling

◆ version

uint32_t dx::driver< decltype(_device_t::id), decltype(_device_t::preference) >::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.