Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_data_dds.h
T
torstenandCopilot d7c8c9e6bd BUILD_RTI=ON: Fix DDS header includes and logger initialization
- dynamic_data_reader.h: Add #include <rti/core/xtypes/DynamicDataImpl.hpp>
  to resolve incomplete type error when deleting DynamicDataImpl pointers

- generic_dts_impl.h: Add m_logger member variable declaration (LOGGER_T&)

- dynamic_data_reader.h: Add m_logger member variable declaration (LOGGER_T&)

- pub_sub_base.cpp: Fix logger initialization to use
  NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger() instead of
  non-existent NGL::getNGLLogger()

- lts_session_data_dds.h: Add DataPluginBase::Interface forward declaration
  to both #ifdef BUILD_RTI and #else blocks for consistent compilation

- LtsUtilsCore/CMakeLists.txt: Fix include path from /.. to /../..
  for LtsUtilsCoreHeaderOnly target

- tests/CMakeLists.txt: Move Grantlee test filtering BEFORE executable
  creation to prevent build failures when Grantlee is disabled

Build validation:
- BUILD_RTI=OFF: ✅ 0 errors (previously completed)
- BUILD_RTI=ON: ✅ DDS core components compile successfully
  - libddsconnector.so created successfully
  - Remaining build errors in unrelated modules (IsmDataPluginInterface,
    IsmShared, BuildingControlBsm) are pre-existing dependency issues

C++ Standard: Enforcing C++17 across all builds due to RTI Connext DDS 7.7.0
incompatibility with C++20/C++23 (known header bugs with newer standards).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-23 21:21:10 +02:00

178 lines
5.1 KiB
C++

/**
* @RDE_HEADER@
* DDS specific parts for a session
* $Id$
* $HeadURL$
* $Author$
*
* Created by Christian Ehrlicher, SLSE, 2017-02-27
*/
#pragma once
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QUrl>
#include <memory>
#include <QtCore/QMap>
// Export macro for shared library
#include "ltssessiondatadds_export.h"
#ifdef BUILD_RTI
#include <dds/domain/DomainParticipant.hpp>
namespace DDSConnector { class DdsConnector; }
namespace DTC { template<typename T> class GenericDTCImpl; }
namespace Core { struct PartitionTime; }
namespace NGL { class INGLLogger; }
namespace DataPluginBase { class Interface; }
class Fetcher;
#else
// Forward declarations for stub types
namespace DataPluginBase { class Interface; }
#endif
namespace LtsSession
{
// Stub enum for PartitionType
enum class PartitionType {
Any = 0,
Exercise,
Replay,
AllExercises,
Global,
Invalid = -1
};
struct DdsConnectionParams
{
int domainId = -1;
int partitionId = 0;
int exerciseId = 0;
PartitionType partitionType = PartitionType::Any;
QUrl tcpConnectionUrl;
QStringList qos_file;
DdsConnectionParams() = default;
bool isValid() const
{
return domainId >= 0 && partitionType != PartitionType::Any;
}
bool operator==(const DdsConnectionParams& o) const
{
return domainId == o.domainId && partitionId == o.partitionId && exerciseId == o.exerciseId &&
qos_file == o.qos_file && partitionType == o.partitionType && tcpConnectionUrl == o.tcpConnectionUrl;
}
bool operator!=(const DdsConnectionParams& o) const
{
return !operator==(o);
}
bool operator<(const DdsConnectionParams& o) const
{
if (domainId != o.domainId)
return domainId < o.domainId;
if (partitionId != o.partitionId)
return partitionId < o.partitionId;
if (exerciseId != o.exerciseId)
return exerciseId < o.exerciseId;
if (qos_file != o.qos_file)
return qos_file < o.qos_file;
if (partitionType != o.partitionType)
return partitionType < o.partitionType;
return tcpConnectionUrl.toString() < o.tcpConnectionUrl.toString();
}
#ifdef BUILD_RTI
bool hasSameDomainParams(const DdsConnectionParams& o) const
{
return domainId == o.domainId && partitionType == o.partitionType;
}
#endif
};
// Base class for session DDS data - always compiled, but RTI functionality guarded
class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds : public QObject
{
Q_OBJECT
public:
explicit LtsSessionDataDds(QObject* parent = nullptr);
~LtsSessionDataDds();
// Initialization
#ifdef BUILD_RTI
bool init(const DdsConnectionParams& connParams);
bool init(const dds::domain::DomainParticipant& dp, const DdsConnectionParams& connParams);
Fetcher* fetcher(const QString& yourPluginsName);
#else
virtual bool init(const DdsConnectionParams& connParams);
virtual bool init(const void* dp, const DdsConnectionParams& connParams);
virtual void* fetcher(const QString& yourPluginsName);
#endif
// Accessors
int domainId() const;
int exerciseId() const;
int partitionId() const;
PartitionType partitionType() const;
static QString partitionTypeString(PartitionType partitionType);
QStringList qosFile() const;
QUrl tcpConnectionUrl() const;
DdsConnectionParams connParams() const;
bool isExercisePartition() const { return partitionType() == PartitionType::Exercise; }
bool isReplayPartition() const { return partitionType() == PartitionType::Replay; }
QString toString() const;
qint64 partitionTime() const { return m_emittedTime; }
// Data plugin interfaces
#ifdef BUILD_RTI
QMap<QString, std::shared_ptr<DataPluginBase::Interface>> availableDataPluginInterfaces() const;
void addAvailablaeDataPluginInterfaces(const QMap<QString, std::shared_ptr<DataPluginBase::Interface>>& dataPlugins);
#else
// Stub returns empty map - void* doesn't work well in QMap template
QMap<QString, void*> availableDataPluginInterfaces() const { return QMap<QString, void*>(); }
void addAvailablaeDataPluginInterfaces(const QMap<QString, void*>& /*dataPlugins*/) {}
#endif
signals:
void partitionTimeChanged(qint64 newPartitionTime);
void partitionTimeChangedInternal();
protected:
#ifdef BUILD_RTI
bool initInternal();
void onPartitionTimeChangedInternal();
// Member variables - only with RTI
int m_exerciseId;
qint64 m_emittedTime;
qint64 m_curMSecSinceEpoch;
bool m_active;
Fetcher* m_fetcher;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnectorGlobal;
std::shared_ptr<DTC::GenericDTCImpl<Core::PartitionTime>> m_dtcPartitionTime;
NGL::INGLLogger& m_logger;
#else
// Stub implementation - minimal members
bool initInternal();
void onPartitionTimeChangedInternal();
int m_exerciseId;
qint64 m_emittedTime;
qint64 m_curMSecSinceEpoch;
bool m_active;
void* m_fetcher;
#endif
};
} // namespace LtsSession