/** * @file include/ActivMiddleware/ActivBase/Windows/SharedCompletionPortEventFactory.h * * @brief Header file for the shared socket based event factory class. */ #if (!defined ACTIV_BASE_WINDOWS_SHARED_COMPLETION_PORT_EVENT_FACTORY_H) #define ACTIV_BASE_WINDOWS_SHARED_COMPLETION_PORT_EVENT_FACTORY_H #include "ActivMiddleware/ActivBase/External.h" #include "ActivMiddleware/ActivBase/IEvent.h" #include "ActivMiddleware/ActivBase/Timeout.h" #include "ActivMiddleware/Misc/Singleton.h" //! Activ namespace. namespace Activ { /** * @brief Shared completion-port based event factory class. */ class SharedCompletionPortEventFactory : public Singleton { public: /** * @brief Create an event. * * @param completionPortHandle completion port to use. * @param name the event name. * @param flags creation flags. * @param initialState whether the event is initially set upon creation. * * @return pointer to an object providing an IEvent interface. * * @throw Exception */ ACTIV_BASE_API IEvent *Create(const HANDLE completionPortHandle, const String &name, const IEvent::Flags::Type flags = IEvent::Flags::None(), const bool initialState = false); /** * @brief Open an existing event. * * @param name the event name. * @param timeout how long to wait for the object to exist, in ms. * * @return pointer to an object providing an IEvent interface. * * @throw Exception */ ACTIV_BASE_API IEvent *Open(const String &name, Timeout &timeout = Timeout::GetInfinite()); /** * @brief Get a reference to the singleton instance. * * @return Reference. */ ACTIV_BASE_API static SharedCompletionPortEventFactory &GetInstance(); private: /** * @brief Default constructor. */ ACTIV_BASE_API SharedCompletionPortEventFactory(); friend class Singleton; }; } // namespace Activ #endif // (!defined ACTIV_BASE_WINDOWS_SHARED_COMPLETION_PORT_EVENT_FACTORY_H)