- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include <dds/core/cond/Condition.hpp>
|
|
#include <dds/core/cond/GuardCondition.hpp>
|
|
#include <dds/core/cond/WaitSet.hpp>
|
|
#include <ddsgen_export.h>
|
|
#include <future>
|
|
#include <map>
|
|
|
|
namespace NGL
|
|
{
|
|
class INGLLogger;
|
|
}
|
|
|
|
namespace DDSGeneric
|
|
{
|
|
class DDSGEN_EXPORT WaitSetHandler final
|
|
{
|
|
public:
|
|
class CallbackInterface
|
|
{
|
|
public:
|
|
virtual ~CallbackInterface() = default;
|
|
virtual void dataAvailable() = 0;
|
|
};
|
|
|
|
WaitSetHandler();
|
|
~WaitSetHandler();
|
|
|
|
bool attachWaitSet(const dds::core::cond::Condition& cond, CallbackInterface* cb);
|
|
bool detachWaitSet(const dds::core::cond::Condition& cond, CallbackInterface* cb);
|
|
bool enableWaitSet(const dds::core::cond::Condition& cond, CallbackInterface* cb);
|
|
bool disableWaitSet(const dds::core::cond::Condition& cond, CallbackInterface* cb);
|
|
|
|
int attachedConditionCount() const;
|
|
|
|
private:
|
|
NGL::INGLLogger& m_logger;
|
|
|
|
struct WaitSetData final
|
|
{
|
|
dds::core::cond::Condition condition;
|
|
CallbackInterface* callback = nullptr;
|
|
bool enabled = true;
|
|
bool needWaitSetAttach = false;
|
|
|
|
WaitSetData(const dds::core::cond::Condition& cond, CallbackInterface* cb) : condition(cond), callback(cb) {}
|
|
};
|
|
|
|
private:
|
|
NGL::INGLLogger& m_logger;
|
|
void waitSetTask();
|
|
|
|
private:
|
|
NGL::INGLLogger& m_logger;
|
|
dds::core::cond::WaitSet m_waitSet;
|
|
dds::core::cond::GuardCondition m_abortCondition;
|
|
std::future<void> m_task;
|
|
std::mutex m_accessMutex;
|
|
std::map<const DDS_Condition*, WaitSetData> m_waitSetData;
|
|
};
|
|
} // namespace DDSGeneric
|