User`s guide
Instantiating an Adaptor Object
4-13
imaqkit::IAdaptor* createInstance(imaqkit::IEngine* engine,
imaqkit::IDeviceInfo* deviceInfo,
char* formatName) {
// Instantiate an object of your IAdaptor-derived class
imaqkit::IAdaptor* adaptor = new
MyDeviceAdaptor(engine,deviceInfo,formatName);
return adaptor;
}
Implementing Your Adaptor Class Destructor
This destructor is invoked whenever the associated video input object in the MATLAB
software is deleted.
delete(vid);
A destructor for a class cannot take parameters or return a value. An adaptor class, as a
derived class, must contain a destructor and the destructor must be declared as virtual.
virtual ~MyAdaptor();
Suggested Algorithm
The design of your adaptor class and the requirements of your image acquisition device
will determine what tasks your class destructor must perform. Your class must contain
a destructor even if it is an empty implementation. Some examples of tasks a destructor
might perform include:
• Stopping the device, if it is currently acquiring frames — see “Suggested Algorithm
for stopCapture()” on page 5-17.
• Closing the connection with the device — see “Suggested Algorithm for closeDevice()”
on page 5-13.
• Deleting the critical section object — see “Using Critical Sections” on page 5-30.
Example
This example shows a skeletal implementation of a destructor. For a more complete
example, see the demo adaptor class.
MyAdaptor::~MyAdaptor(){