- generic_base.h: Fix dds::topic namespace issue, move RTI includes inside BUILD_RTI guard - wait_set_handler.h: Remove duplicate m_logger declarations (3→1) - pub_sub_base.cpp: Fix constructor initializer list syntax (.→,), add m_logger initialization - training_area_telegrams.h: Fix field naming (m_ prefix) for accessor methods - PdmComboBox CMakeLists.txt: Add BUILD_RTI AND TARGET guards for svcPdmCommon/svcPdmClient - PdmDataPlugin CMakeLists.txt: Wrap svcPdmClient link in BUILD_RTI guard - CMakeLists.txt: Add RTI_UNIX, RTI_POSIX_THREADS compile definitions, remove duplicate add_subdirectory - alm_types.h, ppm_types.h: Copy missing type headers from include/ directories Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
60 lines
1.5 KiB
C++
60 lines
1.5 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;
|
|
void waitSetTask();
|
|
|
|
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) {}
|
|
};
|
|
|
|
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
|