Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/AreaEffectSimulation/ModuleTests/aes_test_base.h
T
torstenandCopilot 7a6be7474e Qt6 migration: Fix BUILD_RTI=OFF build errors in TrainingAreaBase
- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document

C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+

Build status: BUILD_RTI=OFF successful (0 errors, warnings only)

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

82 lines
2.5 KiB
C++
Executable File

/**
* AES Function Topic Client test executable
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <AreaEffectSimulation/aes_ftc.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <AreaEffectSimulation/logger.h>
#include <QtCore/QObject>
#include <DDS/DDSConnector/dds_connector.h>
#include <memory>
#include "aes_test_base_export.h"
namespace AreaEffectSimulation
{
class AES_TEST_BASE_EXPORT TestBase : public QObject
{
Q_OBJECT
protected:
explicit TestBase(const char *loggerName, QObject *parent);
public:
bool testsSuccessful() const { return m_bTestsSuccessful; }
virtual bool init(int domainId, int exerciseId, int testId);
public Q_SLOTS:
virtual void startTest() = 0;
protected:
static bool waitForData(const std::function<bool()> &func);
bool checkAesItem(const AreaEffectSimulation::AesItem &a,
const AreaEffectSimulation::AesItem &b) const;
void failExit();
void onAesCreateReply(const Core::FunctionReplyObject &replyObject);
void onAesModifyReply(const Core::FunctionReplyObject &replyObject);
void onAesRemoveReply(const Core::FunctionReplyObject &replyObject);
void onAesTriggerReply(const Core::FunctionReplyObject &replyObject);
template <typename T>
void onAesChanged(const T &dataIn, DataModification modType, T &dataOut)
{
INFO_LOG(m_logger) << "Got " << m_aesTypeName << " with mod type " << (int)modType
<< ", id: " << dataIn.id() << ", chargeType: " << dataIn.chargeStruct().chargeTypeId()
<< ", effectState: " << dataIn.effectStateId();
if (m_expectedAesId == dataIn.id())
{
DEBUG_LOG(m_logger) << "Expected aes id - updating data for " << m_aesTypeName;
dataOut = dataIn;
}
if (modType == DataModification::eRemoved && dataOut.id() == dataIn.id())
{
DEBUG_LOG(m_logger) << "Removed " << m_aesTypeName << " with id " << dataIn.id();
m_expectedAesId = dataIn.id();
}
}
protected:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtc;
int m_expectedAesId; //!< contains the id of the created aes
bool m_bIsCreatedRequest;
bool m_bExpectedFailure;
bool m_replyError;
bool m_bTestsSuccessful;
int m_testId;
QString m_aesTypeName;
};
int AES_TEST_BASE_EXPORT mainBase(int argc, char **argv,
const std::function<TestBase*()> &createFunc);
} // namespace AreaEffectSimulation