itom 2.0.0
ito::AddInGrabber Class Reference

Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor. More...

Inheritance diagram for ito::AddInGrabber:
ito::AddInDataIO ito::AddInBase

List of all members.

Public Member Functions

 AddInGrabber ()
 constructor
 ~AddInGrabber ()
 destructor

Protected Member Functions

void timerEvent (QTimerEvent *event)
 if any live image has been connected to this camera, this event will be regularly fired.
virtual ito::RetVal checkData (ito::DataObject *externalDataObject=NULL)
 implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp...
virtual ito::RetVal retrieveData (ito::DataObject *externalDataObject=NULL)=0
 implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable.
ito::RetVal sendDataToListeners (int waitMS)
 sends m_image to all registered listeners.
int grabberStartedCount ()
void incGrabberStarted ()
void decGrabberStarted ()
void setGrabberStarted (int value)

Protected Attributes

ito::DataObject m_data

Private Attributes

int m_started
 counter indicating how many times startDevice has been called

Detailed Description

Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor.

This class contains important variables and helper methods which simplify the creation of a camera plugin. Please consider that you should implement the methods checkImage() and retriveImage() (pure virtual in this class) in your own class.

See also:
checkImage(), retrieveImage()

Member Function Documentation

ito::RetVal ito::AddInGrabber::checkData ( ito::DataObject externalDataObject = NULL) [protected, virtual]

implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp...

Call this method if the size or bitdepth of your camera has changed (e.g. in your constructor, too). In this method, compare if the new size is equal to the old one. If this is not the case, use the following example to set m_image to a newly allocated dataObject. The old dataObject is deleted automatically with respect to its internal reference counter:

m_image = ito::DataObject(futureHeight,futureWidth,futureType);

See also:
m_image
void ito::AddInGrabber::decGrabberStarted ( ) [inline, protected]

sets the number of started devices to a given value

See also:
m_started
int ito::AddInGrabber::grabberStartedCount ( ) [inline, protected]

returns the number of started devices

See also:
m_started increments the number of started devices
m_started
void ito::AddInGrabber::incGrabberStarted ( ) [inline, protected]

decrements the number of started devices

See also:
m_started
virtual ito::RetVal ito::AddInGrabber::retrieveData ( ito::DataObject externalDataObject = NULL) [protected, pure virtual]

implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable.

Call this method in getVal(...) in order to get the image from the camera and deeply copy it the the m_image variable. This method is equally called from timerEvent.

Returns:
retOk if copy operation was successfull, else retWarning or retError
See also:
getVal, timerEvent
ito::RetVal ito::AddInGrabber::sendDataToListeners ( int  waitMS) [protected]

sends m_image to all registered listeners.

sends m_data to all registered listeners.

This method is continuously called from timerEvent. Also call this method from your getVal-Method (usually with 0-timeout)

Parameters:
[in]waitMSindicates the time (in ms) that should be waiting until every registered live image source node received m_image. 0: no wait, -1: infinit waiting time, else time in milliseconds
Returns:
retOk if everything was ok, retWarning if live image could not be invoked
void ito::AddInGrabber::timerEvent ( QTimerEvent *  event) [protected]

if any live image has been connected to this camera, this event will be regularly fired.

this method is called every time when the auto-grabbing-timer is fired. Usually you don't have to overwrite this method.

This event is continoulsy fired if auto grabbing is enabled. At first, the image is acquired (method acquire). Then the image is retrieved (retrieveImage) and finally the newly grabbed image is send to all registered listeners (sendImagetoListeners)


Member Data Documentation

variable for the recently grabbed image

counter indicating how many times startDevice has been called

increment this variable every time startDevice is called (by incGrabberStarted()) decrement this variable every time stopDevice is called (by decGrabberStarted())

See also:
grabberStartedCount, incGrabberStarted, decGrabberStarted, setGrabberStarted

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends