dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::virtuel::driver< device_t > Class Template Referenceabstract

virtual driver interface class More...

#include <dx_virtual_driver.h>

Inheritance diagram for dx::virtuel::driver< device_t >:
Collaboration diagram for dx::virtuel::driver< device_t >:

Classes

struct  property
 this bus's own preference keys: the store's subtree the device tree lives in More...

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 super::match match
typedef driver_settings<dx::promoted<dx::log>::preference<preference_t>> settings
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()
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.
bool contains(const std::string& id) noexcept
virtual driver& create(const std::string& id, const typename super::device_t::desc_t& desc)
 a device made and removed by its desc: the bus driver's own where it has one
super& create(const std::string& device_id, const typename device_t::desc_t& desc) override
super& destroy(const std::string& id) override
 destroy: to be used to permamently eliminate a virtual device
 driver(const char* product_id, dx::log log= {})
 driver(const match& matching_ids, const char* id, decltype(super::preference)&& preferencepreference, dx::log log= {})
 the virtual driver interface class constructor
 driver(const match& matching_ids, const char* product_id, dx::log log= {})
const_iterator end() const noexcept
iterator end() noexcept
void exception(const class exception& exception, bool filtered= false) const noexcept override
 notification exception handler
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
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 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
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_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
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
std::shared_ptr<typename super::device_t> wait(const std::string& id) noexcept

Public Attributes

promoted<uint32_t> connection_id{1}
T elements
 STL member.
T elements
 STL member.
K keys
 STL member.
K keys
 STL member.
std::atomic<bool> launched
std::atomic<bool> launched{}
dx::log log{}
 cached local log level, mirrors settings::log
dx::log log
 cached local log level, mirrors settings::log
redirect::pipe pipe
 where the process's lines go: the log's pipes, files under its path named after the product
redirect::pipe pipe
 where the process's lines go: the log's pipes, files under its path named after the product
preference_t preference
decltype(device_t::preference) preference
const char* product_id
const char* product_id
promoted<os_result> status{driver_not_connected}
 the driver's condition, promoted so a host follows it without polling
promoted<os_result> status
 the driver's condition, promoted so a host follows it without polling
uint32_t version{DX_VERSION32}
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<device_t>> holders

Protected Member Functions

virtual bool add(const device_id_t &)= 0
 adds a new device to the device list
virtual bool add(const decltype(device_t::id) &)= 0
 adds a new device to the device list
bool add(const device_id_t& device_id) override
 a device whose bus states nothing of it: an empty match takes it
bool add(const device_id_t& device_id, const lookup_t& lookup)
 adds a new device to the device list where the match takes it, asked ahead of the device - lookup(verb) what the bus's system or a desc it holds states of the device, none where neither does
virtual void arrived()
 notify device arrivals completed stub
void arrived(super::device_t& device) override
virtual void clear() noexcept
 replaces std::map::clear to call virtual notification methods
virtual void remove(const device_id_t &)= 0
 finds and removes a device from the device list
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
virtual void scan()
 the device tree as the store holds it: every key under devices is a device, one arrives that the store gained and one leaves that it lost - the whole device arrival mechanism of this bus
void sleep() override
 < notify system will sleep
void wake() override

Protected Attributes

match matching_ids
 which devices of the bus this driver takes

Detailed Description

template<class device_t>
class dx::virtuel::driver< device_t >

virtual driver interface class

This is the interface to a virtual driver identified by a set of matching string IDs. The driver class is a helper to create device objects and to bind the device to the driver identified by the set of matching dictionaries.

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

typedef std::conditional_t<held, typename view::template iterator<typename holders::const_iterator>, typename holders::const_iterator> dx::map::driver<device_t, device_t>::const_iterator
inherited

◆ device_id_t

typedef decltype(device_t::id) dx::map::driver<device_t, device_t>::device_id_t
protectedinherited

◆ device_t

typedef device_t dx::map::driver<device_t, device_t>::device_t
protectedinherited

◆ holders

typedef std::map<device_id_t, std::shared_ptr<device_t>> dx::map::driver<device_t, device_t>::holders
protectedinherited

◆ iterator

typedef std::conditional_t<held, typename view::template iterator<typename holders::iterator>, typename holders::iterator> dx::map::driver<device_t, device_t>::iterator
inherited

◆ map

typedef driver dx::map::driver<device_t, device_t>::map
inherited

◆ match

◆ settings [1/2]

template<typename device_id_t, typename preference_t>
typedef driver_settings<dx::promoted<dx::log>::preference<preference_t>> dx::driver<device_id_t, preference_t>::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

◆ settings [2/2]

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

typedef std::conditional_t<held, typename view::value_type, typename holders::value_type> dx::map::driver<device_t, device_t>::value_type
inherited

Constructor & Destructor Documentation

◆ driver() [1/3]

template<class device_t>
dx::virtuel::driver<device_t>::driver(const match& matching_ids, const char* id, decltype(super::preference)&& preference, dx::log log= {})
inline

the virtual driver interface class constructor

Parameters
matching_idsthe matching dictionaries identifying the devices
idvirtual driver ID
preferencepreference
loglog settings

◆ driver() [2/3]

template<class device_t>
dx::virtuel::driver<device_t>::driver(const match& matching_ids, const char* product_id, dx::log log= {})
inline

◆ driver() [3/3]

template<class device_t>
dx::virtuel::driver<device_t>::driver(const char* product_id, dx::log log= {})
inline

Member Function Documentation

◆ add() [1/4]

template<typename device_id_t, typename preference_t>
virtual bool dx::driver<device_id_t, preference_t>::add(const device_id_t&)
protectedpure virtualinherited

adds a new device to the device list

Returns
the device was taken
Exceptions
dx::exception

◆ add() [2/4]

virtual bool 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

Returns
the device was taken
Exceptions
dx::exception

◆ add() [3/4]

bool dx::map::driver<device_t, device_t>::add(const device_id_t& device_id)
inlineoverrideprotectedinherited

a device whose bus states nothing of it: an empty match takes it

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

◆ add() [4/4]

bool dx::map::driver<device_t, device_t>::add(const device_id_t& device_id, const lookup_t& lookup)
inlineprotectedinherited

adds a new device to the device list where the match takes it, asked ahead of the device - lookup(verb) what the bus's system or a desc it holds states of the device, none where neither does

Returns
the device was taken
Exceptions
dx::exception
Here is the call graph for this function:

◆ arrived() [1/2]

()
protectedvirtualinherited

notify device arrivals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

◆ arrived() [2/2]

void dx::stream::driver<dx::map::driver<device_t>>::arrived(super::device_t& device)
inlineoverrideprotectedvirtualinherited

Reimplemented from dx::map::driver< device_t >.

◆ begin() [1/2]

const_iterator dx::map::driver<device_t, device_t>::begin() const
inlinenoexceptinherited

◆ begin() [2/2]

iterator dx::map::driver<device_t, device_t>::begin()
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boot() [1/2]

template<typename device_id_t, typename preference_t>
virtual bool dx::driver<device_id_t, preference_t>::boot()
inlinevirtualinherited

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

Here is the caller graph for this function:

◆ boot() [2/2]

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

◆ clear()

virtual void dx::map::driver<device_t, device_t>::clear()
inlineprotectedvirtualnoexceptinherited

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

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

◆ conclude()

void dx::map::driver<device_t, device_t>::conclude()
inlineoverridevirtualnoexceptinherited

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::service::client::driver< device_t >, and dx::wasapi::client::driver< device_t >.

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

◆ contains()

bool dx::stream::driver<dx::map::driver<device_t>>::contains(const std::string& id)
inlinenoexceptinherited

◆ create() [1/2]

virtual driver& dx::stream::driver<dx::map::driver<device_t>>::create(const std::string& id, const typename super::device_t::desc_t& desc)
inlinevirtualinherited

a device made and removed by its desc: the bus driver's own where it has one

◆ create() [2/2]

template<class device_t>
super& dx::virtuel::driver<device_t>::create(const std::string& device_id, const typename device_t::desc_t& desc)
inlineoverride

◆ destroy()

template<class device_t>
super& dx::virtuel::driver<device_t>::destroy(const std::string& id)
inlineoverridevirtual

destroy: to be used to permamently eliminate a virtual device

Reimplemented from dx::stream::driver< dx::map::driver< device_t > >.

◆ end() [1/2]

const_iterator dx::map::driver<device_t, device_t>::end() const
inlinenoexceptinherited

◆ end() [2/2]

iterator dx::map::driver<device_t, device_t>::end()
inlinenoexceptinherited
Here is the caller graph for this function:

◆ exception() [1/4]

template<typename device_id_t, typename preference_t>
void dx::driver<device_id_t, preference_t>::exception(const class exception& exception, bool filtered= false) const
inlineoverridenoexceptinherited

notification exception handler

Here is the caller graph for this function:

◆ exception() [2/4]

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() [3/4]

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

notification exception handler

◆ exception() [4/4]

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

notification exception handler

Implemented in dx::asio::client::_device< desc_t, preference_t, stream_t, group_t >, dx::asio::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::asio::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::device< id_t, preference_t >, dx::device< dx::guid, preference >, dx::device< std::string, dx::preference >, dx::device< std::string, preference >, dx::device< std::string, preference_t >, dx::device<::AudioObjectID, cf::preference >, dx::device<::io_service_t, dx::preference >, dx::device<::io_service_t, preference_t >, dx::device<::MIDIDeviceRef, cf::preference >, dx::device<>, dx::proxy::device< preference_t >, dx::proxy::device< preference_t >, dx::proxy::device< dx::preference >, dx::proxy::device<>, dx::registry::device< preference_t >, dx::registry::device< dx::preference >, dx::service::app, dx::service::app, dx::service::client::_device< desc_t, preference_t, stream_t, group_t >, dx::service::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::service::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::stream::object< _device_t >, dx::stream::object< device<> >, dx::stream::pin< device_t, _circular_t >, dx::usb::device< preference_t >, dx::usb::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::stream::pipe< device_t, circular_t, stream_t >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t, group_t >, dx::virtuel::stream::_device< desc, dx::preference, dx::stream::shared::stream< device< desc, dx::preference, dx::stream::shared::stream, group > >, group< device< desc, dx::preference, dx::stream::shared::stream, group > > >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, and dx::wasapi::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >.

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

◆ find() [1/2]

iterator dx::map::driver<device_t, device_t>::find(const device_id_t& device_id)
inlineinherited
Here is the caller graph for this function:

◆ find() [2/2]

const_iterator dx::map::driver<device_t, device_t>::find(const device_id_t& device_id) const
inlineinherited

◆ launch()

template<class device_t>
void dx::virtuel::driver<device_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::map::driver< device_t >.

◆ operator <<() [1/2]

virtual driver& dx::map::driver<device_t, device_t>::operator <<(const char* file)
inlinevirtualinherited

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

Here is the call graph for this function:

◆ operator <<() [2/2]

virtual driver& dx::map::driver<device_t, device_t>::operator <<(std::ifstream&)
inlinevirtualinherited

restores device settings

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

◆ operator >>() [1/2]

virtual driver& dx::map::driver<device_t, device_t>::operator >>(const char* file) const
inlinevirtualinherited

◆ operator >>() [2/2]

virtual driver& dx::map::driver<device_t, device_t>::operator >>(std::ostream& ostream) const
inlinevirtualinherited

saves device tree

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

◆ remove() [1/3]

template<typename device_id_t, typename preference_t>
virtual void dx::driver<device_id_t, preference_t>::remove(const device_id_t&)
protectedpure virtualinherited

finds and removes a device from the device list

◆ remove() [2/3]

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() [3/3]

void dx::map::driver<device_t, device_t>::remove(const device_id_t& device_id)
inlineoverrideprotectedinherited

finds and removes a device from the device list

Exceptions
dx::exception
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removed() [1/2]

()
protectedvirtualinherited

notify device removals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

◆ removed() [2/2]

virtual void dx::map::driver<device_t, device_t>::removed(device_t&)
inlineprotectedvirtualnoexceptinherited

notify specific device removal stub

Here is the caller graph for this function:

◆ scan()

template<class device_t>
virtual void dx::virtuel::driver<device_t>::scan()
inlineprotectedvirtual

the device tree as the store holds it: every key under devices is a device, one arrives that the store gained and one leaves that it lost - the whole device arrival mechanism of this bus

◆ shutdown() [1/2]

template<typename device_id_t, typename preference_t>
virtual bool dx::driver<device_id_t, preference_t>::shutdown()
inlinevirtualinherited

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

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

Here is the caller graph for this function:

◆ shutdown() [2/2]

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()

void dx::map::driver<device_t, device_t>::sleep()
inlineoverrideprotectedinherited

< notify system will sleep

notify system wake completed stub

◆ try_conclude() [1/2]

bool dx::object::try_conclude()
inlinenoexceptinherited

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

◆ try_conclude() [2/2]

bool dx::object::try_conclude()
inlinenoexceptinherited

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

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

◆ try_launch() [1/2]

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

◆ try_launch() [2/2]

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

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

◆ wait()

std::shared_ptr<typename super::device_t> dx::stream::driver<dx::map::driver<device_t>>::wait(const std::string& id)
inlinenoexceptinherited

◆ wake()

void dx::map::driver<device_t, device_t>::wake()
inlineoverrideprotectedinherited

Member Data Documentation

◆ connection_id

◆ elements [1/2]

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

STL member.

◆ elements [2/2]

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

STL member.

◆ keys [1/2]

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

STL member.

◆ keys [2/2]

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

STL member.

◆ launched [1/2]

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

◆ launched [2/2]

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

◆ log [1/2]

template<typename device_id_t, typename preference_t>
dx::log dx::driver<device_id_t, preference_t>::log{}
inherited

cached local log level, mirrors settings::log

◆ log [2/2]

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

cached local log level, mirrors settings::log

◆ matching_ids

match dx::map::driver<device_t, device_t>::matching_ids
protectedinherited

which devices of the bus this driver takes

◆ pipe [1/2]

template<typename device_id_t, typename preference_t>
redirect::pipe dx::driver<device_id_t, preference_t>::pipe
inherited

where the process's lines go: the log's pipes, files under its path named after the product

◆ pipe [2/2]

redirect::pipe dx::driver<decltype(device_t::id), decltype(device_t::preference)>::pipe
inherited

where the process's lines go: the log's pipes, files under its path named after the product

◆ preference [1/2]

template<typename device_id_t, typename preference_t>
preference_t dx::driver<device_id_t, preference_t>::preference
inherited

◆ preference [2/2]

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

◆ product_id [1/2]

template<typename device_id_t, typename preference_t>
const char* dx::driver<device_id_t, preference_t>::product_id
inherited

◆ product_id [2/2]

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

◆ status [1/2]

template<typename device_id_t, typename preference_t>
promoted<os_result> dx::driver<device_id_t, preference_t>::status{driver_not_connected}
inherited

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

◆ status [2/2]

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 [1/2]

template<typename device_id_t, typename preference_t>
uint32_t dx::driver<device_id_t, preference_t>::version{DX_VERSION32}
inherited

◆ version [2/2]

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: