84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/IEvent.h
|
|
*
|
|
* @brief Header file for the event interface class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_IEVENT_H)
|
|
#define ACTIV_BASE_IEVENT_H
|
|
|
|
#include "ActivMiddleware/ActivBase/External.h"
|
|
#include "ActivMiddleware/Misc/TypeSafeFlags.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
/**
|
|
* @brief Abstract base event class.
|
|
*/
|
|
class IEvent : private Boost::noncopyable
|
|
{
|
|
public:
|
|
//! Flags for event creation.
|
|
class Flags : public TypeSafeFlags::Underlying<uint32_t>
|
|
{
|
|
public:
|
|
typedef TypeSafeFlags::Value<Flags, 0x00000000> None;
|
|
typedef TypeSafeFlags::Value<Flags, 0x00000001> Manual; ///< Manual reset event.
|
|
typedef TypeSafeFlags::Value<Flags, 0x00000002> OverrideIpcGroupId; ///< Use group id as set in environment variable as owner of the mapped memory file (Posix only).
|
|
|
|
typedef TypeSafeFlags::Type<Flags, None> Type;
|
|
};
|
|
|
|
//! Destructor.
|
|
virtual ~IEvent() = 0;
|
|
|
|
/**
|
|
* @brief Set the event.
|
|
*
|
|
* @retval STATUS_CODE_SUCCESS
|
|
* @retval STATUS_CODE_FAILURE
|
|
*/
|
|
virtual StatusCode Set() = 0;
|
|
|
|
/**
|
|
* @brief Clear the event.
|
|
*
|
|
* @retval STATUS_CODE_SUCCESS
|
|
* @retval STATUS_CODE_FAILURE
|
|
*/
|
|
virtual StatusCode Clear() = 0;
|
|
|
|
/**
|
|
* @brief Wait for the event to be signaled.
|
|
*
|
|
* @param timeout how long to wait for the event, in ms.
|
|
*
|
|
* @retval STATUS_CODE_SUCCESS
|
|
* @retval STATUS_CODE_FAILURE
|
|
* @retval STATUS_CODE_TIMEOUT
|
|
*/
|
|
virtual StatusCode Wait(const TimeoutPeriod timeout = ACTIV_WAIT_INFINITE) = 0;
|
|
|
|
/**
|
|
* @brief Get the underlying handle, if available.
|
|
*
|
|
* @param handle reference to receive the handle.
|
|
*
|
|
* @retval STATUS_CODE_SUCCESS
|
|
* @retval STATUS_CODE_NOT_SUPPORTED the object does not support an exportable handle.
|
|
*/
|
|
virtual StatusCode GetHandle(HANDLE &handle) const = 0;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline IEvent::~IEvent()
|
|
{
|
|
}
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_IEVENT_H)
|