pylon/WaitObject.h#
Namespaces#
| Name |
|---|
| Pylon Contains definitions of pylon types. |
Classes#
| Name | |
|---|---|
| class | Pylon::WaitObject A platform independent wait object. |
| class | Pylon::WaitObjectEx A wait object that the user may signal. |
Source code#
//-----------------------------------------------------------------------------
// Basler pylon SDK
// Copyright (c) 2006-2022 Basler AG
// http://www.baslerweb.com
// Author: Urs Helmig
//-----------------------------------------------------------------------------
#ifndef __WAITOBJECT_H__
#define __WAITOBJECT_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <pylon/Platform.h>
#ifdef _MSC_VER
# pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */
#include <pylon/stdinclude.h>
#include <pylon/PylonBase.h>
#if defined (PYLON_UNIX_BUILD)
struct _WaitObjectPosix_t;
#endif
namespace Pylon
{
// -------------------------------------------------------------------------
// enum EWaitExResult
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
enum EWaitExResult
{
waitex_timeout = 0,
waitex_signaled = 1,
waitex_abandoned = 2,
waitex_alerted = -1
};
#if defined(PYLON_WIN_BUILD)
typedef HANDLE WaitObject_t;
#elif defined(PYLON_UNIX_BUILD)
typedef struct _WaitObjectPosix_t* WaitObject_t;
#endif
#if defined (PYLON_UNIX_BUILD)
// -------------------------------------------------------------------------
// enum ready_mask_t
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
enum ready_mask_t
{
ready_none = 0x00,
ready_read = 0x01,
ready_write = 0x02,
ready_except = 0x04
};
#endif
// ----------------------------------------------------------------------
const unsigned int waitForever = 0xFFFFFFFF;
#if defined (PYLON_UNIX_BUILD)
# ifndef INFINITE
# define INFINITE waitForever
# endif
#endif
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
class PYLONBASE_API WaitObject
{
// -------------------------------
// Platform independent
// -------------------------------
public:
WaitObject();
virtual ~WaitObject();
WaitObject( const WaitObject& );
WaitObject& operator=( const WaitObject& );
static void Sleep( unsigned long ms );
public:
bool IsValid() const;
public:
bool Wait( unsigned int timeout ) const;
EWaitExResult WaitEx( unsigned int timeout, bool bAlertable ) const;
// -------------------------------
// Windows-specific stuff
// -------------------------------
public:
WaitObject( WaitObject_t h, bool duplicate = true );
#if defined(PYLON_WIN_BUILD)
operator WaitObject_t() const;
protected:
WaitObject_t Duplicate( WaitObject_t h ) const;
protected:
WaitObject_t m_Native;
#endif
#if defined (PYLON_UNIX_BUILD)
void Destroy();
protected:
WaitObject_t m_pWaitObjectPosix;
// -------------------------------
// Linux specific stuff
// -------------------------------
public:
int GetFd( void ) const;
ready_mask_t GetReadyMask() const;
operator struct _WaitObjectPosix_t* () const;
WaitObject_t& GetWaitObject();
#endif
};
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
class PYLONBASE_API WaitObjectEx : public WaitObject
{
// -------------------------------
// Platform independent
// -------------------------------
public:
static WaitObjectEx Create( bool initiallySignalled = false );
WaitObjectEx();
virtual ~WaitObjectEx()
{
}
public:
void Signal();
void Reset();
public:
// -------------------------------
// Windows and OSX specific stuff
// -------------------------------
#if defined(PYLON_WIN_BUILD) || defined(PYLON_OSX_BUILD)
explicit WaitObjectEx( WaitObject_t h, bool duplicate = true );
#endif
// -------------------------------
// Linux specific stuff
// -------------------------------
#if defined(PYLON_UNIX_BUILD)
explicit WaitObjectEx( int fd );
#endif
};
}
#ifdef _MSC_VER
# pragma pack(pop)
#endif /* _MSC_VER */
#endif //__WAITOBJECT_H__
Updated on 5 July 2022 at 15:30:01