dxd - dynax driver framework  2675
cross platform open source driver development framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dx::driver< exception_t, device_t > Class Template Reference

generic driver interface class More...

#include <dx_driver.h>

+ Inheritance diagram for dx::driver< exception_t, device_t >:
+ Collaboration diagram for dx::driver< exception_t, device_t >:

Public Member Functions

virtual void conclude () noexcept
 
virtual void conclude () noexcept
 
 driver (const ::CFDictionaryRef cf_match) throw (exception_t)
 the driver interface class constructor More...
 
 driver (const ::GUID &guid) throw (exception_t)
 the driver interface class constructor More...
 
device_t * find (std::string uid) const noexcept
 Finds the device by guid.
The user is responsible for making sure the device list cannot be modified during find(). More...
 
virtual void launch () throw (exception_t)
 
virtual void launch () throw (exception_t)
 
virtual ~driver ()=default
 
virtual ~driver () noexcept=default
 

Static Public Member Functions

static void idle (int64_t nsec) noexcept
 
static void idle (uint64_t timeout) noexcept
 

Public Attributes

elements
 STL member. More...
 
typedef::CFDictionaryRef match
 
typedef::GUID match
 

Protected Member Functions

virtual void arrived (device_t &) throw (exception_t)
 notify specific device arrival stub More...
 
virtual void arrived () throw (exception_t)
 notify device arrivals completed stub More...
 
virtual void arrived (device_t &) throw (exception_t)
 notify specific device arrival stub More...
 
virtual void arrived () throw (exception_t)
 notify device arrivals completed stub More...
 
virtual void clear () noexcept
 replaces non-virtual std::deque::clear to call virtual notification methods More...
 
virtual void clear () noexcept
 replaces non-virtual std::deque::clear to call virtual notification methods More...
 
virtual void exception (const exception_t &) const noexcept
 notification exception handler More...
 
virtual void exception (const exception_t &) const noexcept
 notification exception handler More...
 
virtual void removed (device_t &) noexcept
 notify specific device removal stub More...
 
virtual void removed () noexcept
 notify device removals completed stub More...
 
virtual void removed (device_t &) noexcept
 notify specific device removal stub More...
 
virtual void removed () noexcept
 notify device removals completed stub More...
 

Detailed Description

template<class exception_t = os_result, class device_t = device<exception_t>>
class dx::driver< exception_t, device_t >

generic driver interface class

this is the generic interface to a driver identified by an GUID. the template parameter defines the exception class to be thrown. the driver class is a helper to create a device object and to bind the device to the driver identified by the GUID.

example:

try() { // guard the block
// choose a driver
dx::driver<>driver(GUID_MYDEVICE);
// for your information enumerate all devices registered under this driver:
std::cout << driver.count() << " devices found." << std::endl;
// define the device reference focus
{
// create a device and select the first device
dx::reference<dx::device<> >device=*driver.begin()
// return an int from an IOCTL served by the driver
int my_data=device->ioctl<int>(kMyIoctl);
// by letting the reference run out of focus the device is freed and the
// driver object can release it as a reaction to a device removal notification
}
}
catch (dx::os_result result) { // with the default exception_t=dx::os_result template parameter an dx::os_result will be thrown
std::cerr << "OS aborted operation with error #" << result << std::endl;
}
Exceptions
incase of an error returned by the underlaying API the driver class throws an exception converted from HRESEULT. with the default exception_t=HRESULT template parameter the HRESULT itself will be thrown.
Todo:
distinguish between "driver not installed" and "no device"

Constructor & Destructor Documentation

template<class exception_t = os_result, class device_t = device<exception_t>>
dx::driver< exception_t, device_t >::driver ( const ::CFDictionaryRef  cf_match)
throw (exception_t
)
inline

the driver interface class constructor

Todo:
handle kext blocking https://developer.apple.com/library/content/technotes/tn2459/_index.html

checks if kext is installed at all

Parameters
cf_matchthe matching dictionary identifying the driver interface
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual dx::driver< exception_t, device_t >::~driver ( )
default
template<class exception_t = os_result, class device_t = device<exception_t>>
dx::driver< exception_t, device_t >::driver ( const ::GUID &  guid)
throw (exception_t
)
inline

the driver interface class constructor

Parameters
guidthe GUID identifying the driver interface
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual dx::driver< exception_t, device_t >::~driver ( )
defaultnoexcept

Member Function Documentation

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::arrived ( device_t &  )
throw (exception_t
)
inlineprotectedvirtual

notify specific device arrival stub

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::arrived ( )
throw (exception_t
)
inlineprotectedvirtual

notify device arrivals completed stub

Reimplemented in dx::coreaudio::plugin< io_t, bus_t, desc_t, exception_t >.

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::arrived ( device_t &  )
throw (exception_t
)
inlineprotectedvirtual

notify specific device arrival stub

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::arrived ( )
throw (exception_t
)
inlineprotectedvirtual

notify device arrivals completed stub

Reimplemented in dx::coreaudio::plugin< io_t, bus_t, desc_t, exception_t >.

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::clear ( )
inlineprotectedvirtualnoexcept

replaces non-virtual std::deque::clear to call virtual notification methods

Todo:
check if exception catching needed for device::conclude()

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::clear ( )
inlineprotectedvirtualnoexcept

replaces non-virtual std::deque::clear to call virtual notification methods

Todo:
check if exception catching needed for device::conclude()
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::conclude ( )
inlinevirtualnoexcept

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::conclude ( )
inlinevirtualnoexcept
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::exception ( const exception_t &  ) const
inlineprotectedvirtualnoexcept

notification exception handler

Reimplemented in dx::coreaudio::plugin< io_t, bus_t, desc_t, exception_t >, and dx::midi::plugin< io_t, bus_t, desc_t, exception_t >.

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::exception ( const exception_t &  ) const
inlineprotectedvirtualnoexcept
template<class exception_t = os_result, class device_t = device<exception_t>>
device_t* dx::driver< exception_t, device_t >::find ( std::string  uid) const
inlinenoexcept

Finds the device by guid.
The user is responsible for making sure the device list cannot be modified during find().

Exceptions
n/athis method does not throw exceptions
template<class exception_t = os_result, class device_t = device<exception_t>>
static void dx::driver< exception_t, device_t >::idle ( int64_t  nsec)
inlinestaticnoexcept

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
static void dx::driver< exception_t, device_t >::idle ( uint64_t  timeout)
inlinestaticnoexcept
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::launch ( )
throw (exception_t
)
inlinevirtual

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::launch ( )
throw (exception_t
)
inlinevirtual
template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::removed ( device_t &  )
inlineprotectedvirtualnoexcept

notify specific device removal stub

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::removed ( )
inlineprotectedvirtualnoexcept

notify device removals completed stub

Reimplemented in dx::coreaudio::plugin< io_t, bus_t, desc_t, exception_t >.

+ Here is the caller graph for this function:

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::removed ( device_t &  )
inlineprotectedvirtualnoexcept

notify specific device removal stub

template<class exception_t = os_result, class device_t = device<exception_t>>
virtual void dx::driver< exception_t, device_t >::removed ( )
inlineprotectedvirtualnoexcept

notify device removals completed stub

Reimplemented in dx::coreaudio::plugin< io_t, bus_t, desc_t, exception_t >.

Member Data Documentation

T std::deque< T >::elements
inherited

STL member.

template<class exception_t = os_result, class device_t = device<exception_t>>
typedef::CFDictionaryRef dx::driver< exception_t, device_t >::match
template<class exception_t = os_result, class device_t = device<exception_t>>
typedef::GUID dx::driver< exception_t, device_t >::match

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

(c) copyright 2009 dynamic acoustics e.U. generated on Tue Dec 4 2018

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.