Wait.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// Wait.h
//
// Cross-platform abstract base class for objects we
// want to be able to wait for.
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Wait_H
#define _Wait_H
#include <list>
#include "platform/Ref.h"
namespace OpenZWave
{
class WaitImpl;
class Wait: public Ref
{
friend class WaitImpl;
friend class ThreadImpl;
public:
enum
{
Timeout_Immediate = 0,
Timeout_Infinite = -1
};
typedef void (*pfnWaitNotification_t)( void* _context );
void AddWatcher( pfnWaitNotification_t _callback, void* _context );
void RemoveWatcher( pfnWaitNotification_t _callback, void* _context );
static int32 Single( Wait* _object, int32 _timeout = -1 ){ return Multiple( &_object, 1, _timeout ); }
static int32 Multiple( Wait** _objects, uint32 _numObjects, int32 _timeout = -1 );
protected:
Wait();
virtual ~Wait();
void Notify();
virtual bool IsSignalled() = 0;
private:
Wait( Wait const& ); // prevent copy
Wait& operator = ( Wait const& ); // prevent assignment
WaitImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of a Wait object.
};
} // namespace OpenZWave
#endif //_Wait_H
OpenZWave::WaitImpl
Windows specific implementation of Wait objects.
Definition: windows/WaitImpl.h:42
OpenZWave::Wait::Timeout_Infinite
Definition: Wait.h:50
OpenZWave
Definition: Bitfield.h:34
OpenZWave::Wait::Notify
void Notify()
Definition: Wait.cpp:112
OpenZWave::Wait::Multiple
static int32 Multiple(Wait **_objects, uint32 _numObjects, int32 _timeout=-1)
Definition: Wait.cpp:123
OpenZWave::Wait::pfnWaitNotification_t
void(* pfnWaitNotification_t)(void *_context)
Definition: Wait.h:53
OpenZWave::Wait::AddWatcher
void AddWatcher(pfnWaitNotification_t _callback, void *_context)
Definition: Wait.cpp:73
int32
signed int int32
Definition: Defs.h:79
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::Wait::Single
static int32 Single(Wait *_object, int32 _timeout=-1)
Definition: Wait.h:77
OpenZWave::Wait
Platform-independent definition of Wait objects.
Definition: Wait.h:41
OpenZWave::Wait::RemoveWatcher
void RemoveWatcher(pfnWaitNotification_t _callback, void *_context)
Definition: Wait.cpp:96
Ref.h
OpenZWave::Wait::Timeout_Immediate
Definition: Wait.h:49
OpenZWave::Ref
Definition: Ref.h:45
OpenZWave::Wait::~Wait
virtual ~Wait()
Definition: Wait.cpp:62
OpenZWave::Wait::Wait
Wait()
Definition: Wait.cpp:51
OpenZWave::ThreadImpl
Windows-specific implementation of the Thread class.
Definition: windows/ThreadImpl.h:42
OpenZWave::Wait::IsSignalled
virtual bool IsSignalled()=0