Files
externals/linux/include/ActivMiddleware/ActivBase/SharedEventFactory.h
T
2023-12-15 13:15:08 -05:00

70 lines
1.7 KiB
C++

/**
* @file include/ActivMiddleware/ActivBase/SharedEventFactory.h
*
* @brief Header file for the shared event factory class.
*/
#if (!defined ACTIV_BASE_SHARED_EVENT_FACTORY_H)
#define ACTIV_BASE_SHARED_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 event factory class.
*/
class SharedEventFactory : public Singleton<SharedEventFactory>
{
public:
/**
* @brief Create an event.
*
* @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 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 SharedEventFactory &GetInstance();
private:
/**
* @brief Default constructor.
*/
ACTIV_BASE_API SharedEventFactory();
friend class Singleton<SharedEventFactory>;
};
} // namespace Activ
#endif // (!defined ACTIV_BASE_SHARED_EVENT_FACTORY_H)