CVB++ 14.0
DeviceFactory Class Referencefinal

Factory object for creating device objects. More...

#include <cvb/device_factory.hpp>

Static Public Member Functions

template<class T >
static std::shared_ptr< T > Open (const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)
 Opens a device with the given provider with its default board and port (if applicable). More...
 
static DevicePtr Open (const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)
 Opens a device with the given provider with its default board and port (if applicable). More...
 
template<class T >
static std::shared_ptr< T > Open (const String &provider, int port, int board)
 Opens a device with the given provider. More...
 
static DevicePtr Open (const String &provider, int port, int board)
 Opens a device with the given provider. More...
 
template<class T >
static std::shared_ptr< T > OpenBoard (const String &provider, int board)
 Open a device with the given provider and board. More...
 
static DevicePtr OpenBoard (const String &provider, int board)
 Open a device with the given provider and board. More...
 
template<class T >
static std::shared_ptr< T > OpenPort (const String &provider, int port)
 Open a device with the given provider and port. More...
 
static DevicePtr OpenPort (const String &provider, int port)
 Open a device with the given provider and port. More...
 
static std::vector< DiscoveryInformationDiscover ()
 Discovers available devices (not vins) with a default time span of 300ms. More...
 
static std::vector< DiscoveryInformationDiscover (DiscoverFlags flags)
 Discovers available devices/nodes depending on the given flags, with a default time span of 300ms. More...
 
template<class Rep , class Period >
static std::vector< DiscoveryInformationDiscover (DiscoverFlags flags, const std::chrono::duration< Rep, Period > &timeSpan)
 Discovers available devices/nodes depending on the given flags. More...
 
template<class Rep , class Period >
static std::vector< DiscoveryInformationDiscover (const String &accessToken, DiscoverFlags flags, const std::chrono::duration< Rep, Period > &timeSpan)
 Discovers available nodes starting on level of the given access token. More...
 
static std::vector< DiscoveryInformationDiscover (const String &accessToken, DiscoverFlags flags)
 Discovers available nodes starting on level of the given access token with a default time span of 300ms. More...
 
static std::vector< DiscoveryInformationDiscover (const String &accessToken)
 Discovers available nodes starting on level of the given access token with a default time span of 300ms. More...
 
static std::vector< DiscoveryInformationDiscover (const DiscoveryInformation &info)
 Discovers available nodes starting on level of the given discovery info with a default time span of 300ms. More...
 
static std::vector< DiscoveryInformationDiscover (const DiscoveryInformation &info, DiscoverFlags flags)
 Discovers available nodes starting on level of the given info with a default time span of 300ms. More...
 
template<class Rep , class Period >
static std::vector< DiscoveryInformationDiscover (const DiscoveryInformation &info, DiscoverFlags flags, const std::chrono::duration< Rep, Period > &timeSpan)
 Discovers available nodes starting on level of the given info. More...
 

Detailed Description

Factory object for creating device objects.

Member Function Documentation

◆ Discover() [1/9]

static std::vector< DiscoveryInformation > Discover ( )
inlinestatic

Discovers available devices (not vins) with a default time span of 300ms.

Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method behaves like the CVB Management Console when discovering devices: It lists all GenICam devices (like GigE Vision and USB3 Vision) and filters out the STEMMER IMAGING Socket Driver devices for GigE Vision (only shows Filter Driver devices).

This method does not throw if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

Examples
Cvb/CppPointCloudAcquisition, and Cvb/QtStatisticsDisplay.

◆ Discover() [2/9]

static std::vector< DiscoveryInformation > Discover ( const DiscoveryInformation info)
inlinestatic

Discovers available nodes starting on level of the given discovery info with a default time span of 300ms.

Parameters
[in]infoStart level and parameter set for query.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [3/9]

static std::vector< DiscoveryInformation > Discover ( const DiscoveryInformation info,
DiscoverFlags  flags 
)
inlinestatic

Discovers available nodes starting on level of the given info with a default time span of 300ms.

Parameters
[in]infoStart level and parameter set for query.
[in]flagsDiscovery control flags.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [4/9]

static std::vector< DiscoveryInformation > Discover ( const DiscoveryInformation info,
DiscoverFlags  flags,
const std::chrono::duration< Rep, Period > &  timeSpan 
)
inlinestatic

Discovers available nodes starting on level of the given info.

Parameters
[in]info
[in]flagsDiscovery control flags.
[in]timeSpanTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [5/9]

static std::vector< DiscoveryInformation > Discover ( const String accessToken)
inlinestatic

Discovers available nodes starting on level of the given access token with a default time span of 300ms.

Parameters
[in]accessTokenStart level and parameter set for query.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [6/9]

static std::vector< DiscoveryInformation > Discover ( const String accessToken,
DiscoverFlags  flags 
)
inlinestatic

Discovers available nodes starting on level of the given access token with a default time span of 300ms.

Parameters
[in]accessTokenStart level and parameter set for query.
[in]flagsDiscovery control flags.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [7/9]

static std::vector< DiscoveryInformation > Discover ( const String accessToken,
DiscoverFlags  flags,
const std::chrono::duration< Rep, Period > &  timeSpan 
)
static

Discovers available nodes starting on level of the given access token.

Parameters
[in]accessToken
[in]flagsDiscovery control flags.
[in]timeSpanTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [8/9]

static std::vector< DiscoveryInformation > Discover ( DiscoverFlags  flags)
inlinestatic

Discovers available devices/nodes depending on the given flags, with a default time span of 300ms.

Parameters
[in]flagsDiscovery control flags.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Discover() [9/9]

static std::vector< DiscoveryInformation > Discover ( DiscoverFlags  flags,
const std::chrono::duration< Rep, Period > &  timeSpan 
)
inlinestatic

Discovers available devices/nodes depending on the given flags.

Parameters
[in]flagsDiscovery control flags.
[in]timeSpanTime to wait for discovery answers from devices.
Returns
The list of found devices/nodes.
Exceptions
Anyexception derived from std::exception including CvbException.

This method does not throw a if the wait time is exceeded: it just waits for the time span. If a device answers after this span it is not in the returned list.

◆ Open() [1/4]

static std::shared_ptr< T > Open ( const String provider,
AcquisitionStack  acquisitionStack = AcquisitionStack::PreferVin 
)
inlinestatic

Opens a device with the given provider with its default board and port (if applicable).

Parameters
[in]providerThe provider sting, which may be a path to vin-driver.
[in]acquisitionStackOptional flag to select which acquisition stack should be use for the device. If omitted the latest available stack is used.
Returns
A pointer to a device object (casted to the provided device type).
Exceptions
Anyexception derived from std::exception including CvbException.

The opened board/port need not necessary be 0 as this depends on the driver configuration!

Attention
The default value of AcquisitionStack::PreferVin will change in a future release to AcquisitionStack::PreferGenTL.
Examples
Cvb/CameraConfig, Cvb/CppStreamConsole, Cvb/QmlStreamDisplay, Cvb/QtPropertyGrid, Cvb/QtStatisticsDisplay, Cvb/QtStreamDisplay, Cvb/QtStreamDisplayPair, GevServer/QmlGevServer, Minos/QmlMinos, Movie2/QtMovie2, Polimago/QmlCookieClassification, ShapeFinder2/QtShapeFinder2, and Spectral/CubeAcquisition.

◆ Open() [2/4]

DevicePtr Open ( const String provider,
AcquisitionStack  acquisitionStack = AcquisitionStack::PreferVin 
)
inlinestatic

Opens a device with the given provider with its default board and port (if applicable).

Parameters
[in]providerThe provider sting, which may be a path to vin-driver.
[in]acquisitionStackOptional flag to select which acquisition stack should be use for the device. If omitted the latest available stack is used.
Returns
A pointer to a device object for given provider.
Exceptions
Anyexception derived from std::exception including CvbException.

The opened board/port need not necessary be 0 as this depends on the driver configuration!

Attention
The default value of AcquisitionStack::PreferVin will change in a future release to AcquisitionStack::PreferGenTL.
Example:
// CVB_LIT is only useful if your code must compile with wide strings and
// Unicode (usually on Windows and Linux), So it only makes sense
// together with a compatible path notation (lower-case and forward slash)!
auto device = Cvb::Device::Open(Cvb::ExpandPath(CVB_LIT("%CVB%/drivers/GenICam.vin")));

◆ Open() [3/4]

static std::shared_ptr< T > Open ( const String provider,
int  port,
int  board 
)
inlinestatic

Opens a device with the given provider.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]portPort number to open.
[in]boardBoard number to open.
Returns
A pointer to a device object (casted to the provided device type).
Exceptions
Anyexception derived from std::exception including CvbException.

For this method the provider is a vin-driver on which a specific board and port is to be opened.

If the driver does not support either one of the board / port interfaces, you can set the board or port parameters to 0. For non-zero values an exception will be thrown.

◆ Open() [4/4]

static DevicePtr Open ( const String provider,
int  port,
int  board 
)
inlinestatic

Opens a device with the given provider.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]portPort number to open.
[in]boardBoard number to open.
Returns
A pointer to a device object for given provider.
Exceptions
Anyexception derived from std::exception including CvbException.

For this method the provider is a vin-driver on which a specific board and port is to be opened.

If the driver does not support either one of the board/port select interfaces, you can set the board or port parameters to 0. For non-zero values an exception will be thrown.

◆ OpenBoard() [1/2]

static std::shared_ptr< T > OpenBoard ( const String provider,
int  board 
)
inlinestatic

Open a device with the given provider and board.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]boardBoard number to open.
Returns
A pointer to a device object (casted to the provided device type).
Exceptions
Anyexception derived from std::exception including CvbException.

◆ OpenBoard() [2/2]

static DevicePtr OpenBoard ( const String provider,
int  board 
)
inlinestatic

Open a device with the given provider and board.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]boardBoard number to open.
Returns
A pointer to a device object for given provider.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ OpenPort() [1/2]

static std::shared_ptr< T > OpenPort ( const String provider,
int  port 
)
inlinestatic

Open a device with the given provider and port.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]portPort number to open.
Returns
A pointer to a device object (casted to the provided device type).
Exceptions
Anyexception derived from std::exception including CvbException.

◆ OpenPort() [2/2]

static DevicePtr OpenPort ( const String provider,
int  port 
)
inlinestatic

Open a device with the given provider and port.

Parameters
[in]providerThe provider sting, which must be a path to vin-driver.
[in]portPort number to open.
Returns
A pointer to a device object for given provider.
Exceptions
Anyexception derived from std::exception including CvbException.