CVB.Net 14.0
DriverDeviceTracker Class Reference

Singleton class tracking all opened Device objects from drivers. More...

Inherits IDeviceSet.

Public Member Functions

IEnumerable< DeviceGetDevices ()
 Gets all currently tracked devices. More...
 
bool Add (Device device)
 Adds a device to the global driver set. More...
 
bool Remove (Device device)
 Removes the given device from the global driver set. More...
 
bool Contains (Device deviceToCheck, out Device presentDevice)
 Checks whether an instance equivalent to deviceToCheck is present in this set. More...
 
void Collect ()
 Collects dead weak references and trims the memory.
 
bool Add (Device device)
 Adds the given device to this set. More...
 
bool Remove (Device device)
 Removes the given device from this set. More...
 
bool Contains (Device deviceToCheck, out Device presentDevice)
 Checks whether an instance equivalent to deviceToCheck is present in this set. More...
 
IEnumerable< DeviceGetDevices ()
 Gets all currently tracked devices. More...
 
void Collect ()
 Checks this set for expired weak references and trims the set to the actually alive objects.
 

Protected Member Functions

void RaiseAdded (Device device)
 Raises the Added event. More...
 
void RaiseRemoved (Device device)
 Raises the Removed event. More...
 

Properties

int Count [get]
 Gets the number of tracked devices.
 
- Properties inherited from IDeviceSet
int Count [get]
 Gets the number of active devices in this set.
 

Events

EventHandler< DeviceEventArgsAdded
 Occurs when a device is added.
 
EventHandler< DeviceEventArgsRemoved
 Occurs when a device is removed. More...
 

Detailed Description

Singleton class tracking all opened Device objects from drivers.

This affects all devices loaded via the native ImgLib.LoadImageFileW method.

Member Function Documentation

◆ Add()

bool Add ( Device  device)

Adds a device to the global driver set.

Parameters
deviceDevice to add to the set.
Returns
true if device was not present and thus could be added; false if it was present and could not be added.

Implements IDeviceSet.

◆ Contains()

bool Contains ( Device  deviceToCheck,
out Device  presentDevice 
)

Checks whether an instance equivalent to deviceToCheck is present in this set.

Parameters
deviceToCheckDevice to be checked whether an equivalent device is available in this set.
presentDeviceContains the equivalent device which is present in this set if available; null otherwise.
Returns
true if equivalent device is present; false if not.

Implements IDeviceSet.

◆ GetDevices()

IEnumerable< Device > GetDevices ( )

Gets all currently tracked devices.

Returns
All currently tracked devices, alive or not.

Implements IDeviceSet.

◆ RaiseAdded()

void RaiseAdded ( Device  device)
protected

Raises the Added event.

Parameters
deviceDevice which is added.

◆ RaiseRemoved()

void RaiseRemoved ( Device  device)
protected

Raises the Removed event.

Parameters
deviceRemoved device.

◆ Remove()

bool Remove ( Device  device)

Removes the given device from the global driver set.

Parameters
deviceDevice to remove.
Returns
true if device was present and thus could be removed; false if it was not present.

Implements IDeviceSet.

Event Documentation

◆ Removed

EventHandler<DeviceEventArgs> Removed

Occurs when a device is removed.

Beware of using the associated object as it is either disposed or in the process of disposing.