All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
Pylon::WaitObject Class Reference

A platform independent wait object. More...

#include <pylon/WaitObject.h>

Inheritance diagram for Pylon::WaitObject:
Inheritance graph
[legend]

Public Member Functions

 WaitObject ()
 Constructs an "empty" wait object, i.e., the wait object is not attached to a platform dependent wait object (IsValid() == false) More...
 
virtual ~WaitObject ()
 Destructor.
 
 WaitObject (const WaitObject &)
 Copy constructor (duplicates the wrapped handle/file descriptor)
 
WaitObjectoperator= (const WaitObject &)
 Assignment operator (duplicates the wrapped handle/file descriptor)
 
bool IsValid () const
 Checks if the wait object is valid. More...
 
bool Wait (unsigned int timeout) const
 Wait for the object to be signaled. More...
 
EWaitExResult WaitEx (unsigned int timeout, bool bAlertable) const
 Wait for the object to be signaled (interruptible) More...
 
 WaitObject (WaitObject_t h, bool duplicate=true)
 Constructor taking existing handle (duplicate=false -> take ownership like std:auto_ptr) More...
 
void Destroy ()
 Invalidates the internal wait object.
 
int GetFd (void) const
 Getter for file descriptor. More...
 
ready_mask_t GetReadyMask () const
 Indicates to what kind of file descriptor set the wrapped file descriptor must be put for usage with the select() or poll() function.
 
 operator struct _WaitObjectPosix_t * () const
 conversion operator More...
 
WaitObject_t & GetWaitObject ()
 Accessor to internal wait object (not supported by pylon for Windows)
 

Static Public Member Functions

static void Sleep (unsigned long ms)
 Suspend calling thread for specified time. More...
 

Detailed Description

A platform independent wait object.

Wait objects are used by the Pylon::IStreamGrabber and Pylon::IEventGrabber interfaces to provide a platform independent mechanism for allowing an application to wait for data buffers to be filled.

For the Windows version of pylon, WaitObjects are wrappers for Win32 objects that can be used with WaitForSingleObject() and WaitForMultipleObjects().

For the Linux version of pylon, WaitObjects are implemented based on file descriptors. The wait operation is implemented using the poll() function.

Although the class provides a default constructor, the default constructor doesn't create a "usable" wait objects wrapping a handle resp. file descriptor. Valid instances of Pylon::WaitObject cannot be created by the application, instead the pylon libraries return fully created wait objects. The Pylon::WaitObjectEx class can be used to create wait objects that can be controlled by the application.

The Pylon::WaitObject class provides access to the wrapped handle resp. file descriptor. This allows to use to allow use pylon wait objects as input for "native" APIs like WaitForMultipleObjects() (Windows), and poll() (Linux).

Multiple Pylon::WaitObjects can be put in the Pylon::WaitObjects container class allowing to wait "simultaneously" for multiple events.

Constructor & Destructor Documentation

Pylon::WaitObject::WaitObject ( )

Constructs an "empty" wait object, i.e., the wait object is not attached to a platform dependent wait object (IsValid() == false)

The Pylon::WaitObjectEx class can be used to create wait objects controllable by an application.

Pylon::WaitObject::WaitObject ( WaitObject_t  h,
bool  duplicate = true 
)

Constructor taking existing handle (duplicate=false -> take ownership like std:auto_ptr)

This method allows to wrap an existing windows handle that can be used with the WaitForSingleObject() and WaitForMultipleObjects methods.

Member Function Documentation

int Pylon::WaitObject::GetFd ( void  ) const

Getter for file descriptor.

Returns
the file descriptor wrapped by the WaitObject. When the file descriptor is added to the file descriptor set indicated by the GetReadyMask() method, the select() or poll() function can be used to wait for pylon and non-pylon events simultaneously.
bool Pylon::WaitObject::IsValid ( ) const

Checks if the wait object is valid.

Don't call the Wait methods() for an invalid wait object. Wait objects returned by the pylon libraries are valid.

Returns
true if the object contains a valid handle/file descriptor
Pylon::WaitObject::operator struct _WaitObjectPosix_t * ( ) const

conversion operator

Returns
the internal wait object handle. (Not supported by pylon4Windows)
static void Pylon::WaitObject::Sleep ( unsigned long  ms)
static

Suspend calling thread for specified time.

Parameters
mswait time in ms
bool Pylon::WaitObject::Wait ( unsigned int  timeout) const

Wait for the object to be signaled.

Parameters
timeouttimeout in ms
Returns
false when the timeout has been expired, true when the waiting was successful before the timeout has been expired.
EWaitExResult Pylon::WaitObject::WaitEx ( unsigned int  timeout,
bool  bAlertable 
) const

Wait for the object to be signaled (interruptible)

Parameters
timeouttimeout in ms
bAlertableWhen the bAlertable parameter is set to true, the function waits until either the timeout elapses, the object enters the signaled state, or the wait operation has been interrupted. For Windows, the wait operation is interrupted by queued APCs or I/O completion routines. For Linux, the wait operation can be interrupted by signals.
Returns
The returned Pylon::EWaitExResult value indicates the result of the wait operation.

The documentation for this class was generated from the following file:

pylon 5.0.9
Copyright © 2006-2017 Basler AG (Tue May 30 2017 17:24:58)