Files

61 lines
1.5 KiB
C++

/**
* @file include/ActivMiddleware/ActivBase/Posix/PrivateSocketEventFactory.h
*
* @brief Header file for the private socket based event factory class.
*/
#if (!defined ACTIV_BASE_POSIX_PRIVATE_SOCKET_EVENT_FACTORY_H)
#define ACTIV_BASE_POSIX_PRIVATE_SOCKET_EVENT_FACTORY_H
#include "ActivMiddleware/ActivBase/External.h"
#include "ActivMiddleware/ActivBase/IEvent.h"
#include "ActivMiddleware/Misc/Singleton.h"
#if (!defined ACTIV_PLATFORM_POSIX)
#error Only available on posix
#endif
//! Activ namespace.
namespace Activ
{
/**
* @brief Private socket based event factory class.
*
* A private event cannot be shared across process boundaries.
*/
class PrivateSocketEventFactory : public Singleton<PrivateSocketEventFactory>
{
public:
/**
* @brief Create an event.
*
* @param flags creation flags.
* @param initialState whether the event is initially set upon creation.
*
* @return pointer to an object providing an IEvent interface.
*/
ACTIV_BASE_API IEvent *Create(const IEvent::Flags::Type flags = IEvent::Flags::None(), const bool initialState = false);
/**
* @brief Get a reference to the singleton instance.
*
* @return Reference.
*/
ACTIV_BASE_API static PrivateSocketEventFactory &GetInstance();
private:
//! Default constructor.
ACTIV_BASE_API PrivateSocketEventFactory();
#if (defined ACTIV_PLATFORM_LINUX)
const bool m_shouldUseEventFd;
#endif
friend class Singleton<PrivateSocketEventFactory>;
};
} // namespace Activ
#endif // (!defined ACTIV_BASE_POSIX_PRIVATE_SOCKET_EVENT_FACTORY_H)