Added test case and setting Test configuration

This commit is contained in:
berrux-dev committed 2026-09-11 13:41:20 +02:00
1 parent f815271486
commit a86f9b5bac
48 files changed
+423 -168

No files matched your search

@@ -54,6 +54,7 @@ TARGET_COMPILE_DEFINITIONS(ddscore PRIVATE
RTI_UNIX
RTI_LINUX
RTI_64BIT
MAKE_DDSCORE_LIB
)
# Skip AUTOMOC for generated header - it will be processed manually with correct dependencies
@@ -105,6 +106,7 @@ SET(SRCS_client
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
NGL_ADD_LIBRARY2(AAR SV WS HLA svcCoreClient SHARED ${SRCS_client})
TARGET_COMPILE_DEFINITIONS(svcCoreClient PRIVATE MAKE_SVCCORECLIENT_LIB)
NGL_TARGET_INCLUDE_DIRECTORIES(svcCoreClient
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../
@@ -10,6 +10,8 @@
// filename: core_dtc.h
#pragma once
#include <compare>
#include <QtCore/qcompare.h>
#include <QMap>
#include <QObject>
#include <functional>
@@ -15,7 +15,7 @@ namespace Core
{
Pacemaker::Pacemaker(DDSConnector::DdsConnector *ddsConnector)
: QObject(nullptr)
, m_logger(NGL::INGLLoggerBootstrap::getNGLLogger("Core.Pacemaker"))
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Core.Pacemaker"))
{
init(ddsConnector);
}
@@ -9,11 +9,14 @@
// Forward declarations for moc compatibility (moc doesn't see BUILD_RTI guards)
namespace Core { enum class RunningState; enum class PortType; }
#if !BUILD_RTI
// Only needed when the generated core_dts_types.h (which defines this as an
// alias template instantiation) is not available.
namespace DTS { class CurrentRunningStateImpl; }
#endif
#if BUILD_RTI
#include <dds/core/core_dts_types.h>
#include <dds/core/types/CurrentRunningState.h>
#include <Core/core_dts_types.h>
#endif
namespace DDSConnector
@@ -65,7 +68,7 @@ class CORE_CLIENT_EXPORT Pacemaker final : public QObject
void addPortInternal(unsigned short number, Core::PortType portType,
const QString& properties = QStringLiteral(""));
CurrentRunningState m_state;
::Core::CurrentRunningState m_state;
DTS::CurrentRunningStateImpl* m_dtsCurrentRunningState = nullptr;
#else
void* m_reserved1 = nullptr;
@@ -32,12 +32,12 @@ bool TopicLockMaster::init(const std::shared_ptr<DDSConnector::DdsConnector> &dd
});
connect(m_coreDtc.get(), &Interface::Dtc::lockedEntityChanged, this,
[this] (const LockedEntity &data, DataModification modType)
[this] (const LockedEntity &data, ::DataModification modType)
{
key k(data.entityId(), data.exerciseId(), QString::fromStdString(data.entityTypeName()));
if (modType == DataModification::eAdded)
if (modType == ::DataModification::eAdded)
m_lockedEntitys << k;
else if (modType == DataModification::eRemoved)
else if (modType == ::DataModification::eRemoved)
m_lockedEntitys.remove(k);
} );
@@ -1,7 +1,10 @@
#pragma once
#include "svccoreclient_export.h"
#include <QtCore/QSet>
#include <QtCore/QString>
#include <QtCore/QObject>
#if BUILD_RTI
#include <Core/core_dtc.h>
@@ -70,7 +73,7 @@ public:
private:
QSet<key> m_lockedEntitys;
#if BUILD_RTI
std::shared_ptr<DDS::Core::Interface::Dtc> m_coreDtc;
std::shared_ptr<::Core::Interface::Dtc> m_coreDtc;
#endif
};
@@ -377,8 +377,13 @@ class GenericFtcImpl final : public GenericFtc<TOPICTYPE_REQUEST, TOPICTYPE_REPL
{
INFO_LOG(m_logger) << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
// Qt 6's Q_ARG yields QMetaMethodArgument, which cannot be mixed with
// the Qt 5 QArgument<T> used here. The topic type is registered under a
// runtime name (see qRegisterMetaType above), so Q_ARG's stringified
// type name is not usable; build the argument the way Q_ARG does.
request.replySlot.invoke(m_objToInform, Qt::QueuedConnection,
QArgument<ReplyTopic>(TopicNameHelper::replyTopicTypeName(), reply.data()),
QtPrivate::Invoke::argument<ReplyTopic>(
TopicNameHelper::replyTopicTypeName(), reply.data()),
Q_ARG(int, request.uniqueId), Q_ARG(bool, !inProgress));
}
else
@@ -503,6 +508,8 @@ class GenericFtcImpl final : public GenericFtc<TOPICTYPE_REQUEST, TOPICTYPE_REPL
bool m_dying{false};
std::string m_partitionType;
int m_partitionId;
// Declared after m_partitionId to match the constructor initialiser order.
DDS::LOGGER_T m_logger;
std::mutex m_requestMutex;
};
@@ -39,6 +39,7 @@ NGL_TARGET_LINK_LIBRARIES(ddsfts
ProjectConfig
ddsQoS
svcTabCommon
svcCoreClient
PUBLIC
Qt6::Core
RTI::nddsc
@@ -282,7 +282,7 @@ template <typename REQUEST, typename REPLY> class Requester final : public Reply
, m_dataReader(nullptr)
, m_contentFilteredTopic(nullptr)
, m_curInstanceHandle(dds::core::InstanceHandle::nil())
, m_logger(NGL::getNGLLogger("connext.requester"))
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("connext.requester"))
{
}
@@ -417,6 +417,8 @@ private:
dds::sub::DataReader<REPLY> m_dataReader;
dds::topic::ContentFilteredTopic<REPLY> m_contentFilteredTopic;
dds::core::InstanceHandle m_curInstanceHandle;
// Declared last to match the constructor initialiser order.
NGL::INGLLogger& m_logger;
};
template <typename REQUEST, typename REPLY> class Replier final : public ReplyRequestBase<REQUEST, REPLY>
@@ -431,7 +433,7 @@ template <typename REQUEST, typename REPLY> class Replier final : public ReplyRe
, m_dataReader(dds::sub::DataReader<REQUEST>(replierParams.subscriber(),
ReplyRequestBase<REQUEST, REPLY>::m_requestTopic,
replierParams.datareader_qos()))
, m_logger(NGL::getNGLLogger("connext.replier"))
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("connext.replier"))
{
}
@@ -500,6 +502,8 @@ private:
connext::ReplierParams<REQUEST, REPLY> m_replierParams;
dds::pub::DataWriter<REPLY> m_dataWriter;
dds::sub::DataReader<REQUEST> m_dataReader;
// Declared last to match the constructor initialiser order.
NGL::INGLLogger& m_logger;
};
} // namespace connext
@@ -12,6 +12,7 @@
#include <dds/topic/find.hpp>
#include <rti/core/xtypes/DynamicDataImpl.hpp>
#include <functional>
#include <type_traits>
namespace DDSGeneric
{
@@ -309,6 +310,19 @@ class DynamicDataReader final
callbackFunc(sample.data(), topicName, sample.info());
}
template<typename C>
static bool isValid(const C& callbackFunc)
{
// Generic version for any type - checks if callable/non-null
// Use simple pointer check for function pointers, true for other types
if constexpr (std::is_pointer_v<C>)
return callbackFunc != nullptr;
else if constexpr (std::is_function_v<std::remove_pointer_t<C>>)
return callbackFunc != nullptr;
else
return true; // Assume valid for functor objects, std::function, etc.
}
static bool isValid(const SubscriberCallback& callbackFunc)
{
return callbackFunc != nullptr;