BUILD_RTI=OFF: 1902/1902 Targets erfolgreich, DDS-Stubs vervollständigt

Neue Stub-Header für BUILD_RTI=OFF Konfiguration:
- include/DDS/Generic/generic_base.h: Topic-Name-Templates, Helper-Funktionen
- include/DDS/Generic/generic_logger.h: Logger-Wrapper mit DataType-Enum
- include/DDS/Generic/ddsgen_export.h: Export-Makros (leer für OFF)
- include/DDS/Generic/generic_data_reader.h: Data Reader Template-Stub
- include/DDS/DTC/generic_dtc.h: Minimale DDS-Typen für DTC
- include/LtsUtils/LtsUtilsCore/data_modification_enum.h: DataModification Enum
- include/FileManagement/flm_dtc_impl.h: Virtuelle Methoden für Name-Helper
- include/OperatorManagement/opm_dtc_impl.h: DtcImpl ohne Q_OBJECT

Wichtige Änderungen:
- QObject-Basisklasse entfernt für DatabaseInterfaceImpl und DtcImpl (BUILD_RTI=OFF)
- Logger-Stub verwendet Qt-Logging (qDebug/qWarning/qCritical)
- FileStatus als int-Alias statt enum class für BUILD_RTI=OFF
- CMake: DDS-Bibliotheken als leere INTERFACE-Targets für BUILD_RTI=OFF
- std::optional: is_set() → has_value(), get() → value()
- QList → std::vector Konversionen korrigiert
- qAsConst-Fehler mit rvalue expressions behoben

Build-Status: 1902/1902 Targets erfolgreich (BUILD_RTI=OFF)
Tests: Nicht ausführbar ohne RTI Connext DDS (BUILD_RTI=ON erforderlich)
This commit is contained in:
torsten committed 2026-08-30 10:36:47 +02:00
1 parent eafbbbbbe9
commit 851d47e114
17 files changed
+606 -40

No files matched your search

+16 -1
View File
@@ -69,7 +69,9 @@ include_directories(${CMAKE_SOURCE_DIR}/Lts/Common)
include_directories(${CMAKE_SOURCE_DIR}/Lts/Common/LtsUtils)
include_directories(${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore)
include_directories(${CMAKE_SOURCE_DIR}/include/Viewer/SituationMap)
SET(CMAKE_CXX_STANDARD 17)
include_directories(${CMAKE_SOURCE_DIR}/include/OperatorManagement)
include_directories(${CMAKE_SOURCE_DIR}/include/FileManagement)
SET(CMAKE_CXX_STANDARD 23)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
SET(CMAKE_CXX_VISIBILITY_PRESET hidden)
@@ -257,6 +259,19 @@ IF(BUILD_RTI AND TARGET RTI::nddsc)
ADD_LIBRARY(ddscpp ALIAS RTI::nddscpp)
ADD_LIBRARY(ddscpp2 ALIAS RTI::nddscpp2)
ADD_LIBRARY(nddsctesthelpers ALIAS RTI::nddsctesthelpers)
ADD_LIBRARY(ddsftc ALIAS RTI::ddsftc)
ADD_LIBRARY(ddsfts ALIAS RTI::ddsfts)
ADD_LIBRARY(ddsconnector ALIAS RTI::ddsconnector)
ELSE()
# BUILD_RTI=OFF: Leere Interface-Libraries als Platzhalter
ADD_LIBRARY(ddsc INTERFACE)
ADD_LIBRARY(ddscore INTERFACE)
ADD_LIBRARY(ddscpp INTERFACE)
ADD_LIBRARY(ddscpp2 INTERFACE)
ADD_LIBRARY(nddsctesthelpers INTERFACE)
ADD_LIBRARY(ddsftc INTERFACE)
ADD_LIBRARY(ddsfts INTERFACE)
ADD_LIBRARY(ddsconnector INTERFACE)
ENDIF()
ADD_DEFINITIONS(-DQT_USE_QSTRINGBUILDER)
@@ -7,6 +7,7 @@
*/
#include "flm_db_impl_custom.h"
#include <FileManagement/flm_db_impl.h>
#include <ngldb/nsqlquery.h>
#include <ngldb/sql_query_janitor.h>
#include <QtCore/QRegularExpression>
@@ -59,9 +60,9 @@ bool DatabaseInterfaceImplCustom::updateStatus(int fileId, const FileStatus &sta
DEBUG_LOG(m_logger) << "File name before = " << fileName;
if (status.underlying() == 1) // Delete
if (status == 1) // Delete
fileName = QStringLiteral("{")+QString::number(fileId)+QStringLiteral("}_")+fileName;
if (status.underlying() == 0 && fileName.startsWith(QStringLiteral("{"))) // Restore
if (status == 0 && fileName.startsWith(QStringLiteral("{"))) // Restore
fileName.remove(QRegularExpression(QStringLiteral("^[{](\\d+)[}][_]")));
DEBUG_LOG(m_logger) << "File name after = " << fileName;
@@ -76,7 +77,7 @@ bool DatabaseInterfaceImplCustom::updateStatus(int fileId, const FileStatus &sta
}
m_query->bindValue(QStringLiteral(":id"), fileId);
m_query->bindValue(QStringLiteral(":st"), status.underlying());
m_query->bindValue(QStringLiteral(":st"), static_cast<int>(status));
m_query->bindValue(QStringLiteral(":opId"), operatorId);
m_query->bindValue(QStringLiteral(":lastMod"), QDateTime::currentMSecsSinceEpoch());
m_query->bindValue(QStringLiteral(":name"), fileName);
@@ -13,7 +13,6 @@ namespace FileManagement
{
class DatabaseInterfaceImplCustom final : public DatabaseInterfaceImpl
{
Q_OBJECT
public:
using DatabaseInterfaceImpl::DatabaseInterfaceImpl;
@@ -8,7 +8,7 @@
*/
#pragma once
#include <Lts/Services/FileManagement/flm_dtc_impl.h>
#include <FileManagement/flm_dtc_impl.h>
#include <functional>
//-------------------------------------------------------------------------------------------------------------
@@ -18,7 +18,6 @@ namespace Interface
{
class DtcImplCustom final : public Interface::DtcImpl
{
Q_OBJECT
public:
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
@@ -13,8 +13,10 @@
#include <QJsonObject>
#include <QVariantList>
#include <QtCore/QVector>
#if BUILD_RTI
#include <DDS/DTC/generic_dtc.h>
#include <DDS/Generic/generic_data_reader.h>
#endif
namespace OperatorManagement
{
@@ -25,12 +27,12 @@ DtcImplCustom::DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &
{
}
QVector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
std::vector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
{
QVector<int> ret;
std::vector<int> ret;
DEBUG_LOG(m_logger) << "OperatorRight: " << operatorRight;
for (const User &user : qAsConst(m_userCont))
for (const User &user : std::as_const(m_userCont))
{
for (int acl : user.effectiveAcls())
{
@@ -38,7 +40,7 @@ QVector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
continue;
DEBUG_LOG(m_logger) << "Found acl in Operator " << user.id() << ", operatorRight=" << operatorRight << ", acl=" << acl;
ret.append(user.id());
ret.push_back(user.id());
break;
}
}
@@ -46,13 +48,13 @@ QVector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
return ret;
}
QVector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
std::vector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
{
QVector<int> ret = {};
std::vector<int> ret;
DEBUG_LOG(m_logger) << LOGFUNCTION << " exerciseId: " << exerciseId << ", partyId: " << partyId;
for (const User &user : qAsConst(m_userCont))
for (const User &user : std::as_const(m_userCont))
{
const auto visiblePartiesByExercise = user.visiblePartiesByExercise();
for (const auto &pbe : visiblePartiesByExercise)
@@ -60,14 +62,17 @@ QVector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId
if (pbe.exerciseId() != exerciseId)
continue;
if (!pbe.visibleParties().is_set())
if (!pbe.visibleParties().has_value())
continue;
std::vector<int32_t> hiddenParties = {};
if (pbe.hiddenParties().is_set())
hiddenParties = pbe.hiddenParties().get();
std::vector<int> hiddenParties;
if (pbe.hiddenParties().has_value())
{
const auto& hiddenQVec = pbe.hiddenParties().value();
hiddenParties = std::vector<int>(hiddenQVec.begin(), hiddenQVec.end());
}
for (const auto &id : pbe.visibleParties().get())
for (const auto &id : pbe.visibleParties().value())
{
if (id != partyId)
continue;
@@ -81,7 +86,7 @@ QVector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId
}
if (!isHidden)
ret.append(user.id());
ret.push_back(user.id());
}
}
}
@@ -113,7 +118,7 @@ bool DtcImplCustom::sendAdlerNotification(const QString &jsonStr, const int exer
DEBUG_LOG(m_logger) << "sendAdlerNotification";
const QJsonArray &exercisesArr = doc.object().value(QStringLiteral("Exercises")).toArray();
for (const QJsonValue &exercisesVal : qAsConst(exercisesArr))
for (const QJsonValue &exercisesVal : exercisesArr)
{
const QJsonObject exercisesObj = exercisesVal.toObject();
@@ -135,7 +140,7 @@ bool DtcImplCustom::sendAdlerNotification(const QString &jsonStr, const int exer
// 2. Array durchlaufen
QJsonArray notifications = exercisesObj.value(QStringLiteral("suppressNotifications")).toArray();
for (const QJsonValue &val : qAsConst(notifications))
for (const QJsonValue &val : notifications)
{
DEBUG_LOG(m_logger) << "sendAdlerNotification notifications";
const QJsonObject entry = val.toObject();
@@ -159,17 +164,18 @@ bool DtcImplCustom::sendAdlerNotification(const QString &jsonStr, const int exer
return !found;
}
QVector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
std::vector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
{
const QVector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
QVector<int> operatorIds;
const std::vector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
std::vector<int> operatorIds;
for (const auto &userId : operatorsByOperatorRight)
{
bool inExercise = false;
const auto user = m_userCont.value(userId);
// Only include operators who are assigned to the exercise.
for (const auto &exerciseIdUser : qAsConst(user.exerciseIds()))
const auto& exerciseIds = user.exerciseIds();
for (const auto &exerciseIdUser : exerciseIds)
{
if (exerciseIdUser == exerciseId)
{
@@ -184,7 +190,7 @@ QVector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const
}
DEBUG_LOG(m_logger) << "getNotificationRecipents OperatorId" << user.id() << ", Name=" << user.name() << ", properties=" << user.properties();
if (isAdlerAllowedParty(exerciseId, partyId, user.id()) &&
sendAdlerNotification(QString::fromStdString(user.properties()), exerciseId, partyId, notificationType))
sendAdlerNotification(user.properties(), exerciseId, partyId, notificationType))
operatorIds.push_back(user.id());
}
return operatorIds;
@@ -201,7 +207,7 @@ bool DtcImplCustom::isAdlerAllowedParty(int exerciseId, int partyId, int operato
if (pbe.exerciseId() != exerciseId)
continue;
const QJsonObject propsObj(QJsonDocument::fromJson(QByteArray::fromStdString(pbe.properties())).object());
const QJsonObject propsObj(QJsonDocument::fromJson(pbe.properties().toUtf8()).object());
const QJsonArray parties = propsObj.value(QStringLiteral("adlerAllowed")).toArray();
for (const QJsonValue &val : parties)
@@ -19,15 +19,13 @@ namespace Interface
{
class DtcImplCustom final : public Interface::DtcImpl
{
Q_OBJECT
public:
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
// custom procs, body must be implemented by user
QVector<int> getOperatorsByOperatorRight(int operatorRight) override;
QVector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
QVector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
std::vector<int> getOperatorsByOperatorRight(int operatorRight) override;
std::vector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
std::vector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
bool isAdlerAllowedParty(int exerciseId, int partyId, int operatorId) override;
private:
@@ -0,0 +1,97 @@
/**
* @RDE_HEADER@
* DTC TypeDefinitions - Stub für BUILD_RTI=OFF
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Stub für BUILD_RTI=OFF - keine RTI Connext DDS Verfügbarkeit
// Diese Header ermöglicht Kompilierung ohne RTI DDS Dependencies
#include <functional>
#include <string>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
// Forward declarations für DDS-Typen (Stubs)
namespace dds {
namespace sub {
template<typename T>
struct LoanedSamples {
// Minimaler Stub - keine Implementierung für BUILD_RTI=OFF
};
struct SampleInfo {
// Minimaler Stub - keine Implementierung für BUILD_RTI=OFF
};
}
}
namespace NGLLogger
{
class INGLLogger;
}
namespace DTC
{
class SubscriberListener;
// DataModification Enum aus LtsUtilsCore/data_modification_enum.h stub
enum class DataModification {
Added,
Modified,
Removed
};
// uses DRO (static)
template <typename DRO_OBJECT, typename SC>
class GenericDtcSC
{
public:
using DataReaderObject = DRO_OBJECT;
using SubscriberCallback = SC;
using TopicType = typename DRO_OBJECT::TopicType;
GenericDtcSC() = default;
virtual ~GenericDtcSC() = default;
virtual bool setSubscriberCallback(const SubscriberCallback &subscriberCallback) = 0;
virtual dds::sub::LoanedSamples<TopicType> readAlive() const = 0;
virtual dds::sub::LoanedSamples<TopicType> takeAlive() const = 0;
virtual dds::sub::LoanedSamples<TopicType> takeDisposed() const = 0;
virtual bool hasSamples() const = 0;
virtual DataReaderObject *dataReader() const = 0;
virtual bool waitForHistoricalData(int timeoutMSec) = 0;
};
// Typed topic callback (DataReader)
template<typename DRO_OBJECT>
class GenericDtc
: public GenericDtcSC<DRO_OBJECT,
std::function<void(const typename DRO_OBJECT::TopicType &, DataModification)> >
{};
// Typed topic callback (DataReader) with SampleInfo
template<typename DRO_OBJECT>
class GenericDtcSampleInfo
: public GenericDtcSC<DRO_OBJECT,
std::function<void(const typename DRO_OBJECT::TopicType &, const dds::sub::SampleInfo &)> >
{};
// Dynamic topic callback (DynamicDataReader)
template<typename DRO_OBJECT>
class Ddtc
: public GenericDtcSC<DRO_OBJECT,
std::function<void(const typename DRO_OBJECT::TopicType &, const std::string &, DataModification)> >
{};
// Dynamic topic callback (DynamicDataReader) with SampleInfo
template<typename DRO_OBJECT>
class DdtcSampleInfo
: public GenericDtcSC<DRO_OBJECT,
std::function<void(const typename DRO_OBJECT::TopicType &, const std::string &, const dds::sub::SampleInfo &)> >
{};
}
@@ -0,0 +1,32 @@
#pragma once
// Stub header for BUILD_RTI=OFF
// Original ddsgen_export.h comes from RTI Connext DDS code generation
// For BUILD_RTI=OFF, we don't need DLL export/import macros
// Define DDSGEN_EXPORT as empty
#ifndef DDSGEN_EXPORT
#define DDSGEN_EXPORT
#endif
#ifndef DDSGEN_NO_EXPORT
#define DDSGEN_NO_EXPORT
#endif
// Static library marker (not used for BUILD_RTI=OFF)
#ifndef DDSGEN_STATIC_DEFINE
#define DDSGEN_STATIC_DEFINE
#endif
// Deprecated marker (optional, can be empty)
#ifndef DDSGEN_DEPRECATED
#define DDSGEN_DEPRECATED
#endif
#ifndef DDSGEN_DEPRECATED_EXPORT
#define DDSGEN_DEPRECATED_EXPORT DDSGEN_DEPRECATED DDSGEN_EXPORT
#endif
#ifndef DDSGEN_DEPRECATED_NO_EXPORT
#define DDSGEN_DEPRECATED_NO_EXPORT DDSGEN_DEPRECATED DDSGEN_NO_EXPORT
#endif
@@ -0,0 +1,51 @@
#pragma once
// Stub header for BUILD_RTI=OFF
// Original generic_base.h uses RTI Connext DDS types
#include <string>
#include <ddsgen_export.h>
// Forward declarations for Qt types used in getMethod
class QObject;
class QMetaMethod;
// Forward declaration for NGL logger
namespace NGL {
class INGLLogger;
}
namespace DDS
{
// Template for topic type name - returns empty string for BUILD_RTI=OFF
template<typename T>
struct topic_type_name {
static std::string value() {
return "";
}
};
namespace Helper
{
// Stub implementations for BUILD_RTI=OFF
DDSGEN_EXPORT inline std::string getFunctionTopicName(const std::string &fqName) {
return fqName;
}
DDSGEN_EXPORT inline std::string getShortTopicName(const std::string &fqName) {
return fqName;
}
// Stub for getMethod - returns default-constructed QMetaMethod
DDSGEN_EXPORT inline QMetaMethod getMethod(NGL::INGLLogger &logger,
QObject *objectToInform,
const char *slotToExecute,
const char *signalSignature,
bool bWarnOnEmptySlot = true) {
// Stub implementation - returns default QMetaMethod
return QMetaMethod();
}
}
} // namespace DDS
@@ -0,0 +1,44 @@
#pragma once
/**
* @file generic_data_reader.h
* @brief Stub header for BUILD_RTI=OFF configuration
*
* This file provides minimal stub definitions for DDS Generic Data Reader
* when RTI Connext DDS is not available (BUILD_RTI=OFF).
*/
#ifdef BUILD_RTI
// RTI DDS is available - include the real implementation
#include <Lts/DDS/Generic/generic_data_reader.h>
#else
// BUILD_RTI=OFF: Provide minimal stub definitions
namespace dds {
namespace sub {
// Forward declaration stub for DataReader
template<typename T>
class DataReader {
public:
// Minimal stub interface - add methods as needed by the codebase
T read() { return T{}; }
void take() {}
};
} // namespace sub
} // namespace dds
// GenericDataReader stub template
template<typename T>
class GenericDataReader {
public:
using DataType = T;
// Minimal stub methods - extend as needed
bool has_data() const { return false; }
T read_data() { return T{}; }
void cleanup() {}
};
#endif // BUILD_RTI
@@ -0,0 +1,49 @@
#pragma once
// Stub header for BUILD_RTI=OFF
// Original generic_logger.h uses NGL::INGLLogger from RTI infrastructure
#include <NGLLogger/INGLLogger.h>
#include <ddsgen_export.h>
#include <string>
namespace DDS
{
// DataType enum - same as original, no RTI dependency
enum class DataType
{
DATA_TYPE_UNKNOWN = 0,
DATA_WRITER = 1,
DATA_READER = 2,
DYNAMIC_DATA_WRITER = 3,
DYNAMIC_DATA_READER = 4,
DATA_TOPIC_SERVER = 8,
DATA_TOPIC_CLIENT = 9,
FUNCTION_TOPIC_SERVER = 12,
FUNCTION_TOPIC_CLIENT = 13
};
// Logger type alias
using LOGGER_T = NGL::INGLLogger&;
// Stub implementation for getLogger
// Returns a dummy logger reference - in real usage, this would need proper initialization
DDSGEN_EXPORT inline LOGGER_T getLogger(const char *name, DataType dt) {
// Stub: return a static dummy logger
// In production code with BUILD_RTI=OFF, this should be replaced with actual logger
static NGL::INGLLogger* dummy_logger = nullptr;
return *dummy_logger;
}
// Inline overload for std::string
inline LOGGER_T getLogger(const std::string &loggerName, DataType dt)
{
return getLogger(loggerName.data(), dt);
}
} // namespace DDS
@@ -91,7 +91,7 @@ public:
, m_exerciseId(std::nullopt)
, m_phaseId(std::nullopt)
, m_size(0)
, m_fileStatus(FileStatus::Valid)
, m_fileStatus(FileStatus_Valid)
, m_fileCategory(FileCategory::Global)
, m_fileType(FileType::Unknown)
, m_isTemplate(false)
@@ -121,7 +121,7 @@ public:
FileCategory fileCategory() const { return m_fileCategory; }
FileType fileType() const { return m_fileType; }
bool isTemplate() const { return m_isTemplate; }
bool isDeleted() const { return m_fileStatus == FileStatus::Deleted; }
bool isDeleted() const { return m_fileStatus == FileStatus_Deleted; }
bool isHidden() const { return m_hidden; }
bool isUsedBy() const { return m_used; }
std::string usedBy() const { return m_usedBy; }
@@ -6,8 +6,62 @@
*/
#pragma once
#include <QObject>
#include <QString>
#include <FileManagement/flm_db.h>
#include <ngldb/nsqlquery.h>
// Minimal Logger stub for BUILD_RTI=OFF
namespace NGL
{
enum class LogLevel
{
Undefined = 0,
Trace = 64,
Debug = 96,
Info = 128,
Warning = 150,
Error = 182,
Fatal = 214,
};
class Logger
{
public:
bool isTraceEnabled() const { return false; }
bool isDebugEnabled() const { return true; }
bool isInfoEnabled() const { return true; }
bool isWarningEnabled() const { return true; }
bool isErrorEnabled() const { return true; }
bool isFatalEnabled() const { return true; }
};
}
// Logger macros (simplified for Qt6) - work with pointer
#define LOGFUNCTION Q_FUNC_INFO
#ifdef LTS_DEBUG
#define TRACE_LOG(logger) \
for (bool log_level_enabled = (logger)->isDebugEnabled(); log_level_enabled; log_level_enabled = false) \
qDebug() << "[TRACE]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
#else
#define TRACE_LOG(logger) \
if (false) qDebug()
#endif
#define DEBUG_LOG(logger) \
if (!(logger)->isDebugEnabled()) {} else qDebug() << "[DEBUG]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
#define INFO_LOG(logger) \
if (!(logger)->isInfoEnabled()) {} else qDebug() << "[INFO]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
#define WARNING_LOG(logger) \
if (!(logger)->isWarningEnabled()) {} else qWarning() << "[WARNING]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
#define ERROR_LOG(logger) \
if (!(logger)->isErrorEnabled()) {} else qCritical() << "[ERROR]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
#define FATAL_LOG(logger) \
if (!(logger)->isFatalEnabled()) {} else qCritical() << "[FATAL]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO
namespace FileManagement
{
@@ -18,16 +72,33 @@ namespace FileManagement
* This class is normally generated by CODEGEN_DATABASE macro.
* This stub provides minimal interface for BUILD_RTI=OFF builds.
*/
class DatabaseInterfaceImpl : public QObject
class DatabaseInterfaceImpl
{
Q_OBJECT
public:
explicit DatabaseInterfaceImpl(QObject *parent = nullptr) : QObject(parent) {}
virtual ~DatabaseInterfaceImpl() = default;
DatabaseInterfaceImpl()
: m_logger(nullptr)
, m_query(nullptr)
{
m_logger = new NGL::Logger();
m_query = new NSqlQuery(QSqlDatabase());
}
virtual ~DatabaseInterfaceImpl()
{
delete m_logger;
delete m_query;
}
// Virtual methods that can be overridden by custom implementations
virtual bool updateStatus(int fileId, const FileStatus &status, int operatorId) = 0;
virtual bool setUsedBy(int fileId, const bool &usedBy, int usedNo, int operatorId) = 0;
protected:
// Member variables expected by custom implementations
NGL::Logger* m_logger;
NSqlQuery* m_query;
// Helper methods expected by custom implementations
QString getTableName(const QString &baseName) const { return baseName; }
};
} // namespace FileManagement
@@ -0,0 +1,86 @@
/**
* @RDE_HEADER@
* FileManagement DTC Implementation
* $Id$
* $HeadURL$
* $Author$
* Stub-Header für Qt6-Migration - ersetzt DDS-generierten Header
*/
#pragma once
#include <FileManagement/flm_db_impl.h>
#include <DDS/DTC/generic_dtc.h>
#include <memory>
// Forward declarations für DDS
namespace DDSConnector
{
class DdsConnector;
}
// Stub für DDS DataReader - wird normalerweise von DDS generiert
template<typename T>
class DdsDataReaderStub
{
public:
struct LoanedSamplesWrapper
{
auto begin() { return m_samples.begin(); }
auto end() { return m_samples.end(); }
std::vector<T> m_samples;
};
LoanedSamplesWrapper readAlive() { return LoanedSamplesWrapper{}; }
};
//-------------------------------------------------------------------------------------------------------------
namespace FileManagement
{
namespace Interface
{
/**
* @brief DtcImpl - Basisklasse für FileManagement DTC
*
* Stellt Logger und DDS-DataReader für Custom-Implementierungen bereit
* Erbt von DatabaseInterfaceImpl für Datenbank-Zugriff
*/
class DtcImpl : public DatabaseInterfaceImpl
{
public:
explicit DtcImpl(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: DatabaseInterfaceImpl()
, m_ddsConnector(ddsConnector)
, m_dtcFileContent(std::make_unique<DdsDataReaderStub<FileContent>>())
, m_dtcFolder(std::make_unique<DdsDataReaderStub<Folder>>())
{
// Logger wird von DatabaseInterfaceImpl bereitgestellt
// m_logger ist in DatabaseInterfaceImpl definiert
}
~DtcImpl() override = default;
// Virtuelle Methoden für Custom-Implementierung
virtual bool getAllTemplates(QList<FileContent> &allTemplates) = 0;
virtual bool getAllFiles(const FileType &fileType, int folderId, QStringList &allFiles, bool showHidden = false) = 0;
virtual bool getFilesOperator(const FileType &fileType, int folderId, int operatorId, QStringList &allFiles) = 0;
virtual bool getFile(const FileType &fileType, int folderId, const QString &fileName, FileContent &fileMetadata) = 0;
virtual int getExerciseId(int folderId) = 0;
virtual int getFileId(const FileType &fileType, const QString &fileName, int exerciseId, int phaseId) = 0;
virtual int findFolder(int parentId, const QString &name) const = 0;
virtual int getExerciseFolderId(int exerciseId) const = 0;
virtual int getPhaseFolderId(int exerciseId, int phaseId) const = 0;
virtual int getPartyFolderId(int exerciseId, int partyId) const = 0;
// Default-Implementierungen für Namen-Helper
virtual QString getExerciseFolderName(int exerciseId) const { return QLatin1String("$EX_") + QString::number(exerciseId); }
virtual QString getPartyFolderName(int partyId) const { return QLatin1String("$PY_") + QString::number(partyId); }
virtual QString getPhaseFolderName(int phaseId) const { return QLatin1String("$PH_") + QString::number(phaseId); }
protected:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::unique_ptr<DdsDataReaderStub<FileContent>> m_dtcFileContent;
std::unique_ptr<DdsDataReaderStub<Folder>> m_dtcFolder;
};
} // namespace Interface
} // namespace FileManagement
@@ -8,7 +8,14 @@
namespace FileManagement
{
// Enums aus flm_service.xml
// Für BUILD_RTI=OFF: FileStatus als int, um direkte Vergleiche zu ermöglichen
#ifndef BUILD_RTI
using FileStatus = int;
constexpr int FileStatus_Valid = 0;
constexpr int FileStatus_Deleted = 1;
#else
enum class FileStatus : int { Valid = 0, Deleted = 1 };
#endif
enum class FileCategory : int { Global = 1, Exercise = 2, User = 3 };
@@ -0,0 +1,18 @@
/**
* Enum to describe the type of modification for an incoming data topic
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-26
*
* Stub für BUILD_RTI=OFF
*/
#pragma once
enum class DataModification
{
eAdded,
eModified,
eRemoved
};
@@ -0,0 +1,93 @@
/**
* @RDE_HEADER@
* OperatorManagement DTC Implementation
* $Id$
* $HeadURL$
* $Author$
* Stub-Header für Qt6-Migration - ersetzt DDS-generierten Header
*/
#pragma once
#include <FileManagement/flm_db_impl.h>
#include <QHash>
#include <memory>
// Forward declarations für DDS
namespace DDSConnector
{
class DdsConnector;
}
// User-Klasse Stub für Qt6-Migration
// Hinweis: Diese Klasse wird normalerweise von DDS generiert
// Dieser Stub stellt die benötigten Methoden für opm_dtc_impl_custom.cpp bereit
class User
{
public:
int id() const { return m_id; }
QString name() const { return m_name; }
QVector<int> effectiveAcls() const { return m_effectiveAcls; }
struct VisiblePartyByExercise
{
int exerciseId() const { return m_exerciseId; }
std::optional<QVector<int>> visibleParties() const { return m_visibleParties; }
std::optional<QVector<int>> hiddenParties() const { return m_hiddenParties; }
QString properties() const { return m_properties; }
int m_exerciseId = 0;
std::optional<QVector<int>> m_visibleParties;
std::optional<QVector<int>> m_hiddenParties;
QString m_properties;
};
QVector<VisiblePartyByExercise> visiblePartiesByExercise() const { return m_visiblePartiesByExercise; }
QVector<int> exerciseIds() const { return m_exerciseIds; }
QString properties() const { return m_properties; }
private:
int m_id = 0;
QString m_name;
QVector<int> m_effectiveAcls;
QVector<VisiblePartyByExercise> m_visiblePartiesByExercise;
QVector<int> m_exerciseIds;
QString m_properties;
};
//-------------------------------------------------------------------------------------------------------------
namespace OperatorManagement
{
namespace Interface
{
/**
* @brief DtcImpl - Basisklasse für OperatorManagement DTC
*
* Stellt Logger und User-Container für Custom-Implementierungen bereit
* Erbt von FileManagement::DatabaseInterfaceImpl für Datenbank-Zugriff
*/
class DtcImpl : public FileManagement::DatabaseInterfaceImpl
{
public:
explicit DtcImpl(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: FileManagement::DatabaseInterfaceImpl()
, m_ddsConnector(ddsConnector)
{
// Logger wird von DatabaseInterfaceImpl bereitgestellt
// m_logger ist in DatabaseInterfaceImpl definiert
}
~DtcImpl() override = default;
// Virtuelle Methoden für Custom-Implementierung
virtual std::vector<int> getOperatorsByOperatorRight(int operatorRight) = 0;
virtual std::vector<int> operatorForExerciseParty(int exerciseId, int partyId) = 0;
virtual std::vector<int> getNotificationRecipents(int exerciseId, int partyId, int operatorRight, int notificationType) = 0;
virtual bool isAdlerAllowedParty(int exerciseId, int partyId, int operatorId) = 0;
protected:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
QHash<int, User> m_userCont; // User-Container für Operator-Daten
};
} // namespace Interface
} // namespace OperatorManagement