CVB.Net 14.0
IDeviceSet Interface Reference

Interface for Device sets. More...

Inherited by DriverDeviceTracker, FileDriverDeviceSet, and VinDriverDeviceSet.

Public Member Functions

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.
 

Properties

int Count [get]
 Gets the number of active devices in this set.
 

Detailed Description

Interface for Device sets.

A set contains a sorted list of unique entries.

These sets are a bit special as new instances are to be checked against present instances. This is necessary as different native objects can reference the same native device. With this API only one managed object of a device must be available at one point in time.

Member Function Documentation

◆ Add()

bool Add ( Device  device)

Adds the given device to this set.

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

Implemented in VinDriverDeviceSet, FileDriverDeviceSet, and DriverDeviceTracker.

◆ 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.

Implemented in VinDriverDeviceSet, FileDriverDeviceSet, and DriverDeviceTracker.

◆ GetDevices()

IEnumerable< Device > GetDevices ( )

Gets all currently tracked devices.

Returns
All currently tracked devices, alive or not.

Implemented in VinDriverDeviceSet, FileDriverDeviceSet, and DriverDeviceTracker.

◆ Remove()

bool Remove ( Device  device)

Removes the given device from this set.

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

Implemented in VinDriverDeviceSet, FileDriverDeviceSet, and DriverDeviceTracker.