User`s guide

Instantiating an Adaptor Object
4-11
Instantiating an Adaptor Object
Every adaptor must include a createInstance() function. The engine calls this
function to instantiate an object of your adaptor's class. This section includes the
following topics:
“Suggested Algorithm” on page 4-11
“Implementing Your Adaptor Class Constructor” on page 4-12
“Implementing Your Adaptor Class Destructor” on page 4-13
Suggested Algorithm
The algorithm for the createInstance() function is simple: call the adaptor class
constructor to instantiate an object of an adaptor class and return a handle to the object.
The engine passes these arguments to your adaptor's createInstance() function. The
createInstance() function accepts three arguments:
imaqkit::IAdaptor* createInstance(imaqkit::IEngine* engine,
imaqkit::DeviceInfo* deviceInfo,
const char* FormatName)
The following table describes these arguments. Your adaptor's createInstance()
function must return a handle to an IAdaptor object.
Argument Purpose
engine Handle to an IEngine object that enables your adaptor to
communicate with the engine.
deviceInfo Handle to an IDeviceInfo object that represents the
characteristics of a particular device. This object will be one of
the IDeviceInfo objects you created in your getAvailHW()
function.
formatName A text string that specifies the name of a video format supported
by the device or the full path of a device configuration file. If this
specifies a format, it must be one of the formats represented by
the IDeviceFormat objects you created in your getAvailHW()
function.