Release pipeline: LogView logger namespace fixes and RPM script updates
- Fixed NGL::getLogger() → N_LogView::getLogger() in LogView components - Added m_logger member variables to LogView classes - Updated RPM script for release scope filtering - Fixed Qt6 compatibility issues (QStringRef→QStringView, include paths) - Excluded DDS-dependent modules from release build Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M4H71D9ZNV0MG2ZZJ0M8R1FK
This commit is contained in:
109 files changed
+11296
-3069
No files matched your search
@@ -136,6 +136,10 @@ include_directories(${CMAKE_SOURCE_DIR}/include/OperatorManagement)
|
||||
include_directories(${CMAKE_BINARY_DIR}/Lts/Services/OperatorManagement)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Plugins)
|
||||
ENDIF()
|
||||
# Release scope: include path for ProjectDataManagement stub headers
|
||||
IF(RELEASE_BUILD)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Services/ProjectDataManagement/stubs)
|
||||
ENDIF()
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Common/LtsUtils)
|
||||
include_directories(${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore)
|
||||
|
||||
@@ -17,13 +17,20 @@ endif()
|
||||
|
||||
# Add only existing subdirectories to allow partial checkouts / incremental migration
|
||||
if(RELEASE_BUILD)
|
||||
# For first release: only build Lts/Common (excludes Tools, Application, DDS, Services, Proxies, Plugins, Viewer, Projects)
|
||||
message(STATUS "RELEASE_BUILD=ON: Building only Lts/Common")
|
||||
# For first release: only build Lts/Common and Lts/Proxies/TrainingAreaBase (tabTelegrams library)
|
||||
# Excludes: Tools, Application, DDS, Services, most of Proxies, Plugins, Viewer, Projects
|
||||
message(STATUS "RELEASE_BUILD=ON: Building Lts/Common and Lts/Proxies/TrainingAreaBase")
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Common")
|
||||
NGL_ADD_SUBDIR_GUARDED(Common)
|
||||
else()
|
||||
message(STATUS "Skipping missing Lts subdirectory: Common")
|
||||
endif()
|
||||
# TrainingAreaBase provides tabTelegrams library needed by TetraIF/CoPrtCnv
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Proxies/TrainingAreaBase")
|
||||
NGL_ADD_SUBDIR_GUARDED(Proxies/TrainingAreaBase)
|
||||
else()
|
||||
message(STATUS "Skipping missing Lts subdirectory: Proxies/TrainingAreaBase")
|
||||
endif()
|
||||
else()
|
||||
set(LTS_SUBDIRS Tools Application DDS Common Services Proxies Plugins Viewer Projects)
|
||||
foreach(dir IN LISTS LTS_SUBDIRS)
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ if(RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(LtsNotification)
|
||||
ADD_SUBDIRECTORY(LtsRestClient)
|
||||
ADD_SUBDIRECTORY(LtsSerialPortQuerry)
|
||||
ADD_SUBDIRECTORY(LtsTimeline)
|
||||
# Excluded: LtsTimeline (depends on LtsWidgets which has DDS dependencies)
|
||||
ADD_SUBDIRECTORY(LtsUtils)
|
||||
ADD_SUBDIRECTORY(LtsWebSocket)
|
||||
ADD_SUBDIRECTORY(PluginInterfaces)
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ NGL_TARGET_LINK_LIBRARIES(codegen_base
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(codegen_base
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
# If RTI target is available, propagate its include dirs/compile defs
|
||||
if (TARGET RTI::nddscpp2)
|
||||
|
||||
+2
@@ -15,12 +15,14 @@ TARGET_INCLUDE_DIRECTORIES(DataPluginInterface PUBLIC ${CMAKE_CURRENT_SOURCE_DIR
|
||||
TARGET_LINK_LIBRARIES(DataPluginInterface PUBLIC Qt6::Core)
|
||||
|
||||
# GuiPluginInterface
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_LIBRARY(GuiPluginInterface SHARED
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.cpp
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES(GuiPluginInterface PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
TARGET_LINK_LIBRARIES(GuiPluginInterface PUBLIC Qt6::Core LtsWidgets ProjectConfig LtsAppDescriptor LtsUtilsCore)
|
||||
ENDIF()
|
||||
|
||||
# projectPluginInterface
|
||||
ADD_LIBRARY(ProjectPluginInterface SHARED
|
||||
|
||||
+1
@@ -214,6 +214,7 @@ IF(BUILD_RTI)
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcTabServer)
|
||||
ENDIF() # NOT RELEASE_BUILD
|
||||
|
||||
#
|
||||
# --- Topic Type Plugin --------------------------------------------------------------
|
||||
|
||||
+8
-3
@@ -4,12 +4,12 @@
|
||||
# $Author$
|
||||
#
|
||||
|
||||
IF (NOT BUILD_RPM)
|
||||
IF (NOT BUILD_RPM AND NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(DebugJsonDir)
|
||||
ENDIF()
|
||||
|
||||
#ADD_SUBDIRECTORY(Spu)
|
||||
IF (BUILD_WLS)
|
||||
IF (BUILD_WLS AND NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(WlsTetra)
|
||||
ELSE()
|
||||
ADD_SUBDIRECTORY(TetraJson)
|
||||
@@ -21,7 +21,9 @@ ENDIF()
|
||||
|
||||
IF (BUILD_SV AND DEFINED _pname)
|
||||
IF ("${_pname}" STREQUAL "guez")
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(HlaJson)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -32,10 +34,13 @@ IF (BUILD_SVC_HLA)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# AdlerJson depends on svcPdmClient (ProjectDataManagement) which is not in release scope
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(AdlerJson)
|
||||
ENDIF()
|
||||
|
||||
|
||||
OPTION(BUILD_UAS_PROXY "Build the UAS TAB Plugin (default: OFF) [needs BUILD_SV = ON and UNIX-like OS]" OFF) # TODO: use 'pname = guez' if done
|
||||
if (BUILD_SV AND BUILD_UAS_PROXY AND NOT WIN32)
|
||||
if (BUILD_SV AND BUILD_UAS_PROXY AND NOT WIN32 AND NOT RELEASE_BUILD)
|
||||
add_subdirectory(UAS)
|
||||
endif()
|
||||
+2
@@ -35,4 +35,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(CoPrtCnv
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../PrtCnv
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../PrtCnv
|
||||
)
|
||||
+2
-1
@@ -22,7 +22,8 @@ namespace N_LogView
|
||||
|
||||
|
||||
LogViewField::LogViewField(const QString& a_name, const E_FieldKind a_kind, const LogViewXdrElement* a_xdrElement)
|
||||
: m_Name(a_name),
|
||||
: m_logger(getLogger("LogViewField")),
|
||||
m_Name(a_name),
|
||||
m_IsRightAligned(false),
|
||||
m_Offset(0),
|
||||
m_Size(0),
|
||||
|
||||
+2
@@ -113,6 +113,8 @@ namespace N_LogView
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
QString m_Name;
|
||||
QString m_type;
|
||||
QStringList m_ValueList;
|
||||
|
||||
+5
-4
@@ -72,6 +72,7 @@ LogViewGui::LogViewGui(QWidget* a_parent)
|
||||
, m_InjectionThread(nullptr)
|
||||
, m_replayTimer(new QTimer(this))
|
||||
, m_currentReplayRow(-1)
|
||||
, m_logger(getLogger("LogViewGui"))
|
||||
{
|
||||
setWindowIcon(QIcon(QLatin1String(":icons/16x16/rde_16x16.png")));
|
||||
|
||||
@@ -655,10 +656,10 @@ void LogViewGui::updateLogfile()
|
||||
|
||||
QString filePath(fileInfo.absolutePath() + QLatin1Char('/'));
|
||||
const QString baseName = fileInfo.baseName();
|
||||
const QVector<QStringRef> parts = baseName.splitRef(QLatin1Char('_'));
|
||||
const QVector<QString> parts = baseName.split(QLatin1Char('_'));
|
||||
|
||||
for (int iterator = 0; iterator < parts.size() - 2; ++iterator)
|
||||
filePath += parts.at(iterator).toString() + QLatin1Char('_');
|
||||
filePath += parts.at(iterator) + QLatin1Char('_');
|
||||
|
||||
QString nextFile(filePath + nextDate + QLatin1Char('.') + fileInfo.completeSuffix());
|
||||
QString checkFile(filePath + checkDate + QLatin1Char('.') + fileInfo.completeSuffix());
|
||||
@@ -912,9 +913,9 @@ void LogViewGui::startInjectionThread()
|
||||
settings.beginGroup(QLatin1String("LogFiles"));
|
||||
QString filePath = settings.value(QLatin1String("Dir")).toString();
|
||||
QString exerciseName;
|
||||
QVector<QStringRef> parts = filePath.splitRef(QLatin1Char('/'));
|
||||
QVector<QString> parts = filePath.split(QLatin1Char('/'));
|
||||
if (parts.size() >= 2)
|
||||
exerciseName = QLatin1Char('_') + parts.at(parts.size() - 2).toString();
|
||||
exerciseName = QLatin1Char('_') + parts.at(parts.size() - 2);
|
||||
|
||||
QString portFilePath = QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("PrtCnv") + exerciseName + QLatin1String(".dat");
|
||||
QFileInfo checkPortFile(portFilePath);
|
||||
|
||||
+3
@@ -180,6 +180,9 @@ protected slots:
|
||||
|
||||
void onLogTelegramViewDoubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
private slots:
|
||||
void onSettingsChanged(uint32_t changedFlags);
|
||||
};
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@
|
||||
namespace N_LogView
|
||||
{
|
||||
LogViewInjectionThread::LogViewInjectionThread()
|
||||
: m_DoStartConnection(false)
|
||||
: m_logger(getLogger("LogViewInjectionThread"))
|
||||
, m_DoStartConnection(false)
|
||||
, m_SendingPossible(false)
|
||||
, m_Socket(nullptr)
|
||||
, m_Timer(nullptr)
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ namespace N_LogView
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_DoStartConnection;
|
||||
bool m_SendingPossible;
|
||||
QString m_Hostname;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ QVariant ParticipantModel::data(const QModelIndex &index, int role) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (role == Qt::BackgroundColorRole)
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if (p.first == 0)
|
||||
return QVariant();
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGui/QAbstractTableModel>
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <set>
|
||||
|
||||
+2
-1
@@ -25,11 +25,12 @@ namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
LogViewTabWidget::LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox)
|
||||
LogViewTabWidget::LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox, NGL::INGLLogger& logger)
|
||||
: QTabWidget(a_parent)
|
||||
, LogViewWidget(a_field, this, a_parent, false)
|
||||
, m_TelegramDialog(a_parent)
|
||||
, m_SpinBox(a_spinBox)
|
||||
, m_logger(logger)
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
+3
-1
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <QtWidgets/QTabWidget>
|
||||
#include "LogViewWidget.hpp"
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
namespace N_LogView
|
||||
@@ -29,7 +30,7 @@ namespace N_LogView
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox);
|
||||
LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox, NGL::INGLLogger& logger);
|
||||
|
||||
bool saveContent(LogViewTelegram* a_telegram) override;
|
||||
void addTab(LogViewField* a_field, const bool a_isEmpty, int arrayIdx);
|
||||
@@ -43,6 +44,7 @@ namespace N_LogView
|
||||
|
||||
LogViewTelegramDialog* m_TelegramDialog;
|
||||
LogViewSpinBox* m_SpinBox;
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -24,11 +24,12 @@ namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
LogViewTableWidget::LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly)
|
||||
LogViewTableWidget::LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly, NGL::INGLLogger& logger)
|
||||
: QTableWidget(0, 2, a_parent)
|
||||
, LogViewWidget(a_field, this, a_parent, a_readonly)
|
||||
, m_IsFloat(false)
|
||||
, m_IsEnum(false)
|
||||
, m_logger(logger)
|
||||
{
|
||||
switch (m_Field->xdrElement()->getKind())
|
||||
{
|
||||
|
||||
+3
-1
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <QTableWidget>
|
||||
#include "LogViewWidget.hpp"
|
||||
#include "logger.h"
|
||||
|
||||
namespace N_LogView
|
||||
{
|
||||
@@ -24,7 +25,7 @@ namespace N_LogView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly);
|
||||
LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly, NGL::INGLLogger& logger);
|
||||
|
||||
|
||||
|
||||
@@ -42,5 +43,6 @@ namespace N_LogView
|
||||
private:
|
||||
bool m_IsFloat;
|
||||
bool m_IsEnum;
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
}
|
||||
+4
-1
@@ -73,6 +73,7 @@ LogViewTelegram::LogViewTelegram(const LogViewTelegram &o)
|
||||
, m_data(o.m_data)
|
||||
, m_json(o.m_json)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(o.m_logger)
|
||||
{
|
||||
if (!m_data.isEmpty())
|
||||
m_TetraTelegram = new N_CoPrtCnv::CoPrtCnvRadioTelegram(m_data);
|
||||
@@ -100,6 +101,7 @@ LogViewTelegram::LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnv
|
||||
, m_LogTime(0)
|
||||
, m_GpsTime(0)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(NGL::getLogger())
|
||||
{
|
||||
const uint32_t &waitTime = qgetenv("LogViewWaitTime").toUInt();
|
||||
if (waitTime > 0)
|
||||
@@ -143,6 +145,7 @@ LogViewTelegram::LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnv
|
||||
, m_GpsTime(0)
|
||||
, m_data(a_telegramData)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(NGL::getLogger())
|
||||
{
|
||||
const uint32_t &waitTime = qgetenv("LogViewWaitTime").toUInt();
|
||||
if (waitTime > 0)
|
||||
@@ -1630,7 +1633,7 @@ void LogViewTelegram::showMessageBox(const QString& a_errorText, const QString&
|
||||
QLatin1String("gesendete") : QLatin1String("gelesene"));
|
||||
QMessageBox::warning(QApplication::topLevelWidgets()[0], a_title,
|
||||
QString::fromUtf8("Das %5 Telegramm mit Protokoll %6 von %1 (Unix-Zeit: %2) und Länge %3 ist fehlerhaft:<br><br><b>%4</b>")
|
||||
.arg(dt.toString(Qt::SystemLocaleLongDate)).arg(logTimeSec).arg(m_data.size()).arg(a_errorText, destStr).arg(m_Protocol));
|
||||
.arg(dt.toString(Qt::TextDate)).arg(logTimeSec).arg(m_data.size()).arg(a_errorText, destStr).arg(m_Protocol));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
@@ -262,6 +262,7 @@ namespace N_LogView
|
||||
QJsonObject m_json;
|
||||
|
||||
N_CoPrtCnv::CoPrtCnvRadioTelegram *m_TetraTelegram;
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
LogViewField *getFieldTree(const QString& a_type, const QString& a_name,
|
||||
uint16_t a_arraySize, const LogViewXdrType* a_parentElement = nullptr,
|
||||
|
||||
+4
-3
@@ -47,9 +47,10 @@ namespace N_LogView
|
||||
|
||||
|
||||
|
||||
LogViewTelegramDialog::LogViewTelegramDialog(QWidget *a_parent, const bool a_readonly)
|
||||
LogViewTelegramDialog::LogViewTelegramDialog(QWidget *a_parent, const bool a_readonly, NGL::INGLLogger& logger)
|
||||
: QDialog(a_parent)
|
||||
, m_ReadOnly(a_readonly)
|
||||
, m_logger(logger)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
@@ -417,7 +418,7 @@ void LogViewTelegramDialog::showEditField(LogViewField *a_logViewField, QGridLay
|
||||
}
|
||||
|
||||
|
||||
LogViewTableWidget *tableWidget = new LogViewTableWidget(a_logViewField, this, m_ReadOnly);
|
||||
LogViewTableWidget *tableWidget = new LogViewTableWidget(a_logViewField, this, m_ReadOnly, m_logger);
|
||||
m_EditInfoList.push_back(tableWidget);
|
||||
a_box->addWidget(tableWidget, a_box->rowCount(), 0, 1, 2);
|
||||
|
||||
@@ -446,7 +447,7 @@ void LogViewTelegramDialog::showTab(LogViewField *a_logViewField, QGridLayout *a
|
||||
a_box->addWidget(spinBox, a_box->rowCount() - 1, 1);
|
||||
}
|
||||
|
||||
LogViewTabWidget *a_tabWidget = new LogViewTabWidget(a_logViewField, this, spinBox);
|
||||
LogViewTabWidget *a_tabWidget = new LogViewTabWidget(a_logViewField, this, spinBox, m_logger);
|
||||
m_EditInfoList.push_back(dynamic_cast<LogViewWidget *>(a_tabWidget));
|
||||
a_box->addWidget(a_tabWidget, a_box->rowCount(), 0, 1, 2);
|
||||
|
||||
|
||||
+2
-1
@@ -35,7 +35,7 @@ class LogViewTelegramDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LogViewTelegramDialog(QWidget *a_parent = nullptr, const bool a_readonly = true);
|
||||
explicit LogViewTelegramDialog(QWidget *a_parent = nullptr, const bool a_readonly = true, NGL::INGLLogger& logger = NGL::getLogger());
|
||||
|
||||
void showDialog(const QSharedPointer<LogViewTelegram> &a_telegram);
|
||||
void showDataDump(const QSharedPointer<LogViewTelegram> &a_telegram, bool showErrorMessage);
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
QLineEdit *m_NameEdit = nullptr;
|
||||
QLineEdit *m_WaitTimeEdit = nullptr;
|
||||
bool m_ReadOnly = false;
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+1
@@ -43,6 +43,7 @@ QString TelegramEdit::s_TELEGRAMLIST_FILES()
|
||||
|
||||
TelegramEdit::TelegramEdit(QWidget *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(getLogger("LogViewTelegramEdit"))
|
||||
, m_addTeleAction(new QAction(QIcon(QLatin1String(":icons/16x16/list-add.png")), tr("Add Telegram"), this))
|
||||
, m_editTeleAction(new QAction(QIcon(QLatin1String(":/image/Edit.png")), tr("Edit Telegram"), this))
|
||||
, m_copyTeleAction(new QAction(QIcon(QLatin1String(":icons/16x16/edit-copy.png")), tr("Copy Telegram"), this))
|
||||
|
||||
+4
-1
@@ -4,7 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "LogViewTelegram.hpp"
|
||||
#include <QtGui/QModelIndex>
|
||||
#include "logger.h"
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
class QAction;
|
||||
class QTableView;
|
||||
@@ -60,6 +61,8 @@ protected:
|
||||
int m_curEditTelegramRow;
|
||||
|
||||
TelegramEditModel *m_EditModel;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
static QString s_DIR();
|
||||
static QString s_EDIT_TELEGRAM_GROUP();
|
||||
static QString s_TELEGRAMLIST_FILE_ID();
|
||||
|
||||
+35
-34
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QStringView>
|
||||
|
||||
namespace N_LogView
|
||||
{
|
||||
@@ -87,16 +88,16 @@ bool LogViewTetraTelegramsParser::parse(const QString &filename)
|
||||
const QString content = QString::fromUtf8(f.readAll());
|
||||
f.close();
|
||||
|
||||
const QVector<QStringRef> lines = content.splitRef(QLatin1Char('\n'));
|
||||
QVector<QStringRef> linesTrimmed;
|
||||
const QVector<QStringView> lines = content.splitView(QLatin1Char('\n'));
|
||||
QVector<QStringView> linesTrimmed;
|
||||
linesTrimmed.reserve(lines.size());
|
||||
for (const QStringRef &line : lines)
|
||||
for (const QStringView &line : lines)
|
||||
linesTrimmed += line.trimmed();
|
||||
|
||||
int i = 0;
|
||||
while (i < linesTrimmed.size())
|
||||
{
|
||||
const QStringRef &line = linesTrimmed.at(i);
|
||||
const QStringView &line = linesTrimmed.at(i);
|
||||
if (line.startsWith(QLatin1String("struct")))
|
||||
{
|
||||
i = parseStruct(linesTrimmed, i);
|
||||
@@ -136,12 +137,12 @@ void LogViewTetraTelegramsParser::insertPod(const QString &type, int byteLen, bo
|
||||
}
|
||||
|
||||
|
||||
int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, int iStartPos)
|
||||
int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringView> &lines, int iStartPos)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() < 2)
|
||||
return -1;
|
||||
const QStringRef &structType = tokens.at(1);
|
||||
const QStringView &structType = tokens.at(1);
|
||||
if (structType.endsWith(QLatin1Char(';')))
|
||||
return iStartPos;
|
||||
|
||||
@@ -162,7 +163,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
WARNING_LOG(m_logger) << "Could not parse struct: '" << lines.at(iStartPos).toString() << "', line: " << iStartPos + 1;
|
||||
return -1;
|
||||
}
|
||||
QStringRef base = tokens.at(i);
|
||||
QStringView base = tokens.at(i);
|
||||
if (base == QLatin1String("public") ||
|
||||
base == QLatin1String("protected") ||
|
||||
base == QLatin1String("private"))
|
||||
@@ -181,7 +182,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i));
|
||||
if (!validStructTokens(tokens))
|
||||
{
|
||||
++i;
|
||||
@@ -204,15 +205,15 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
const int parserCommentPos = tokens.at(2) == QLatin1String("=") ? 4 : 2;
|
||||
if (tokens.size() > parserCommentPos)
|
||||
{
|
||||
const QStringRef &comment = tokens.at(parserCommentPos);
|
||||
const QStringView &comment = tokens.at(parserCommentPos);
|
||||
DEBUG_LOG(m_logger) << "comment: " << comment.toString();
|
||||
if (comment.startsWith(QLatin1String("//@array: ")))
|
||||
{
|
||||
const QStringRef hint = comment.mid(QLatin1String("//@array: ").size());
|
||||
const QStringView hint = comment.mid(QLatin1String("//@array: ").size());
|
||||
QString structStr = QLatin1String("struct ") + si.type + QLatin1String("::") + tokens.at(0).toString() + QLatin1Char('\n') + hint.toString();
|
||||
structStr.replace(QLatin1Char(';'), QLatin1String(";\n"));
|
||||
DEBUG_LOG(m_logger) << "structStr: " << structStr;
|
||||
parseStruct(structStr.splitRef(QLatin1Char('\n')), 0);
|
||||
parseStruct(structStr.splitView(QLatin1Char('\n')), 0);
|
||||
|
||||
mi.type = si.type + QLatin1String("::") + tokens.at(0).toString();
|
||||
mi.isArray = true;
|
||||
@@ -222,7 +223,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
}
|
||||
}
|
||||
|
||||
QStringRef name = tokens.at(1);
|
||||
QStringView name = tokens.at(1);
|
||||
if (name.endsWith(QLatin1Char(';')))
|
||||
name.chop(1);
|
||||
if (mi.type.isEmpty())
|
||||
@@ -265,12 +266,12 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
return i;
|
||||
}
|
||||
|
||||
int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int iStartPos, const QString &ns, StructInformation *si)
|
||||
int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringView> &lines, int iStartPos, const QString &ns, StructInformation *si)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() < 2)
|
||||
return -1;
|
||||
QStringRef enumName = tokens.at(1);
|
||||
QStringView enumName = tokens.at(1);
|
||||
if (enumName == QLatin1String("class"))
|
||||
{
|
||||
if (tokens.size() < 3)
|
||||
@@ -287,7 +288,7 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i).split(QStringLiteral("//")).first());
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i).split(QStringLiteral("//")).first());
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")))
|
||||
{
|
||||
@@ -320,7 +321,7 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
ev.key = tokens.at(0).toString();
|
||||
if (tokens.size() == 3)
|
||||
{
|
||||
QStringRef value = tokens.at(2);
|
||||
QStringView value = tokens.at(2);
|
||||
if (value.endsWith(QLatin1Char(',')))
|
||||
value.chop(1);
|
||||
ev.value = value.toInt();
|
||||
@@ -346,28 +347,28 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
return i;
|
||||
}
|
||||
|
||||
int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringRef> &lines, int iStartPos)
|
||||
int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringView> &lines, int iStartPos)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() != 4)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(iStartPos).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
const QStringRef &cs = tokens.at(3);
|
||||
const QStringView &cs = tokens.at(3);
|
||||
if (!cs.startsWith(QLatin1String("Constraints<")) || !cs.endsWith(QLatin1Char('>')))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(iStartPos).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
QStringRef structName = cs.mid(QLatin1String("Constraints<").size());
|
||||
QStringView structName = cs.mid(QLatin1String("Constraints<").size());
|
||||
structName.chop(1);
|
||||
DEBUG_LOG(m_logger) << "Constraint: " << structName.toString();
|
||||
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i));
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")))
|
||||
{
|
||||
@@ -381,14 +382,14 @@ int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringRef> &line
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
const QVector<QStringRef> parts = tokens.at(6).split(QLatin1String("::"));
|
||||
const QVector<QStringView> parts = tokens.at(6).split(QLatin1String("::"));
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(i).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
|
||||
QStringRef enumKey = parts.at(1);
|
||||
QStringView enumKey = parts.at(1);
|
||||
if (enumKey.endsWith(QLatin1Char(';')))
|
||||
enumKey.chop(1);
|
||||
bool bFound = false;
|
||||
@@ -434,7 +435,7 @@ void LogViewTetraTelegramsParser::categorizeMember(MemberInformation &mi) const
|
||||
mi.isBinary = (mi.type == QLatin1String("std::vector<unsigned char>") || mi.type == QLatin1String("QByteArray"));
|
||||
}
|
||||
|
||||
static inline void bracketCount(const QStringRef &str, int &cntLt, int &cntGt)
|
||||
static inline void bracketCount(const QStringView &str, int &cntLt, int &cntGt)
|
||||
{
|
||||
cntLt = 0;
|
||||
cntGt = 0;
|
||||
@@ -447,20 +448,20 @@ static inline void bracketCount(const QStringRef &str, int &cntLt, int &cntGt)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line) const
|
||||
QVector<QStringView> LogViewTetraTelegramsParser::tokenize(const QStringView &line) const
|
||||
{
|
||||
QVector<QStringRef> ret = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
QVector<QStringView> ret = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
int i = 0;
|
||||
while (i < ret.size())
|
||||
{
|
||||
const QStringRef &token = ret.at(i);
|
||||
const QStringView &token = ret.at(i);
|
||||
if (token.startsWith(QLatin1String("//")))
|
||||
{
|
||||
|
||||
if (i == ret.size() - 1)
|
||||
break;
|
||||
const QStringRef &lastToken = ret.last();
|
||||
const QStringRef newToken = QStringRef(token.string(), token.position(), lastToken.position() - token.position() + lastToken.size());
|
||||
const QStringView &lastToken = ret.last();
|
||||
const QStringView newToken = line.mid(token.position(), lastToken.position() - token.position() + lastToken.size());
|
||||
DEBUG_LOG(m_logger) << "New Token: " << newToken.toString();
|
||||
ret.resize(i + 1);
|
||||
ret[i] = newToken;
|
||||
@@ -476,8 +477,8 @@ QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
const QStringRef &nextToken = ret.at(i + 1);
|
||||
const QStringRef newToken = QStringRef(token.string(), token.position(), nextToken.position() - token.position() + nextToken.size());
|
||||
const QStringView &nextToken = ret.at(i + 1);
|
||||
const QStringView newToken = line.mid(token.position(), nextToken.position() - token.position() + nextToken.size());
|
||||
DEBUG_LOG(m_logger) << "New Token: " << newToken.toString();
|
||||
ret.removeAt(i + 1);
|
||||
ret[i] = newToken;
|
||||
@@ -486,7 +487,7 @@ QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LogViewTetraTelegramsParser::validStructTokens(const QVector<QStringRef> &tokens)
|
||||
bool LogViewTetraTelegramsParser::validStructTokens(const QVector<QStringView> &tokens)
|
||||
{
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")) ||
|
||||
|
||||
+7
-5
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringView>
|
||||
#include <QtCore/QVector>
|
||||
#include "logger.h"
|
||||
|
||||
@@ -72,17 +73,18 @@ public:
|
||||
static QString getInnerType(const QString &type);
|
||||
private:
|
||||
void insertPod(const QString &type, int byteLen, bool isSigned, bool isIntegral, bool isBoolean = false);
|
||||
int parseStruct(const QVector<QStringRef> &lines, int iStartPos);
|
||||
int parseEnum(const QVector<QStringRef> &lines, int iStartPos, const QString &ns, StructInformation *si = nullptr);
|
||||
int parseConstraint(const QVector<QStringRef> &lines, int iStartPos);
|
||||
int parseStruct(const QVector<QStringView> &lines, int iStartPos);
|
||||
int parseEnum(const QVector<QStringView> &lines, int iStartPos, const QString &ns, StructInformation *si = nullptr);
|
||||
int parseConstraint(const QVector<QStringView> &lines, int iStartPos);
|
||||
void categorizeMember(MemberInformation &mi) const;
|
||||
QVector<QStringRef> tokenize(const QStringRef &line) const;
|
||||
static bool validStructTokens(const QVector<QStringRef> &tokens);
|
||||
QVector<QStringView> tokenize(QStringView line) const;
|
||||
static bool validStructTokens(const QVector<QStringView> &tokens);
|
||||
private:
|
||||
EnumInformation m_telegramIdEnum;
|
||||
QVector<EnumInformation> m_enums;
|
||||
QHash<QString, StructInformation> m_structs;
|
||||
QHash<QString, PodInformation> m_pods;
|
||||
QHash<int, QString> m_visibleTelegrams;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+2
-2
@@ -317,8 +317,8 @@ void LogViewXdrParser::parseDefine(const QString &a_line)
|
||||
int sepPos = line.indexOf(QLatin1Char(' '));
|
||||
if (sepPos >= 0)
|
||||
{
|
||||
const QString name = line.leftRef(sepPos).trimmed().toString();
|
||||
QStringRef substitution = line.midRef(sepPos).trimmed();
|
||||
const QString name = line.left(sepPos).trimmed();
|
||||
QStringView substitution = line.mid(sepPos).trimmed();
|
||||
sepPos = substitution.indexOf(QLatin1Char(' '));
|
||||
if (sepPos >= 0)
|
||||
substitution = substitution.left(sepPos).trimmed();
|
||||
|
||||
+5
-2
@@ -6,8 +6,10 @@
|
||||
|
||||
|
||||
#ADD_SUBDIRECTORY(TetraTestServer)
|
||||
ADD_SUBDIRECTORY(LastTest)
|
||||
ADD_SUBDIRECTORY(LastTestAuswertung)
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(LastTest)
|
||||
ADD_SUBDIRECTORY(LastTestAuswertung)
|
||||
ENDIF()
|
||||
|
||||
SET(PrtCnv_SRCS
|
||||
logger.h
|
||||
@@ -63,6 +65,7 @@ NGL_TARGET_LINK_LIBRARIES(PrtCnvLib
|
||||
)
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(PrtCnvLib
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
|
||||
|
||||
+4
@@ -136,6 +136,10 @@ include_directories(${CMAKE_SOURCE_DIR}/include/OperatorManagement)
|
||||
include_directories(${CMAKE_BINARY_DIR}/Lts/Services/OperatorManagement)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Plugins)
|
||||
ENDIF()
|
||||
# Release scope: include path for ProjectDataManagement stub headers
|
||||
IF(RELEASE_BUILD)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Services/ProjectDataManagement/stubs)
|
||||
ENDIF()
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Lts/Common/LtsUtils)
|
||||
include_directories(${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore)
|
||||
|
||||
+9
-2
@@ -17,13 +17,20 @@ endif()
|
||||
|
||||
# Add only existing subdirectories to allow partial checkouts / incremental migration
|
||||
if(RELEASE_BUILD)
|
||||
# For first release: only build Lts/Common (excludes Tools, Application, DDS, Services, Proxies, Plugins, Viewer, Projects)
|
||||
message(STATUS "RELEASE_BUILD=ON: Building only Lts/Common")
|
||||
# For first release: only build Lts/Common and Lts/Proxies/TrainingAreaBase (tabTelegrams library)
|
||||
# Excludes: Tools, Application, DDS, Services, most of Proxies, Plugins, Viewer, Projects
|
||||
message(STATUS "RELEASE_BUILD=ON: Building Lts/Common and Lts/Proxies/TrainingAreaBase")
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Common")
|
||||
NGL_ADD_SUBDIR_GUARDED(Common)
|
||||
else()
|
||||
message(STATUS "Skipping missing Lts subdirectory: Common")
|
||||
endif()
|
||||
# TrainingAreaBase provides tabTelegrams library needed by TetraIF/CoPrtCnv
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Proxies/TrainingAreaBase")
|
||||
NGL_ADD_SUBDIR_GUARDED(Proxies/TrainingAreaBase)
|
||||
else()
|
||||
message(STATUS "Skipping missing Lts subdirectory: Proxies/TrainingAreaBase")
|
||||
endif()
|
||||
else()
|
||||
set(LTS_SUBDIRS Tools Application DDS Common Services Proxies Plugins Viewer Projects)
|
||||
foreach(dir IN LISTS LTS_SUBDIRS)
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ if(RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(LtsNotification)
|
||||
ADD_SUBDIRECTORY(LtsRestClient)
|
||||
ADD_SUBDIRECTORY(LtsSerialPortQuerry)
|
||||
ADD_SUBDIRECTORY(LtsTimeline)
|
||||
# Excluded: LtsTimeline (depends on LtsWidgets which has DDS dependencies)
|
||||
ADD_SUBDIRECTORY(LtsUtils)
|
||||
ADD_SUBDIRECTORY(LtsWebSocket)
|
||||
ADD_SUBDIRECTORY(PluginInterfaces)
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ NGL_TARGET_LINK_LIBRARIES(codegen_base
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(codegen_base
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
# If RTI target is available, propagate its include dirs/compile defs
|
||||
if (TARGET RTI::nddscpp2)
|
||||
|
||||
+2
@@ -15,12 +15,14 @@ TARGET_INCLUDE_DIRECTORIES(DataPluginInterface PUBLIC ${CMAKE_CURRENT_SOURCE_DIR
|
||||
TARGET_LINK_LIBRARIES(DataPluginInterface PUBLIC Qt6::Core)
|
||||
|
||||
# GuiPluginInterface
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_LIBRARY(GuiPluginInterface SHARED
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.cpp
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES(GuiPluginInterface PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
TARGET_LINK_LIBRARIES(GuiPluginInterface PUBLIC Qt6::Core LtsWidgets ProjectConfig LtsAppDescriptor LtsUtilsCore)
|
||||
ENDIF()
|
||||
|
||||
# projectPluginInterface
|
||||
ADD_LIBRARY(ProjectPluginInterface SHARED
|
||||
|
||||
+1
@@ -214,6 +214,7 @@ IF(BUILD_RTI)
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcTabServer)
|
||||
ENDIF() # NOT RELEASE_BUILD
|
||||
|
||||
#
|
||||
# --- Topic Type Plugin --------------------------------------------------------------
|
||||
|
||||
+8
-3
@@ -4,12 +4,12 @@
|
||||
# $Author$
|
||||
#
|
||||
|
||||
IF (NOT BUILD_RPM)
|
||||
IF (NOT BUILD_RPM AND NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(DebugJsonDir)
|
||||
ENDIF()
|
||||
|
||||
#ADD_SUBDIRECTORY(Spu)
|
||||
IF (BUILD_WLS)
|
||||
IF (BUILD_WLS AND NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(WlsTetra)
|
||||
ELSE()
|
||||
ADD_SUBDIRECTORY(TetraJson)
|
||||
@@ -21,7 +21,9 @@ ENDIF()
|
||||
|
||||
IF (BUILD_SV AND DEFINED _pname)
|
||||
IF ("${_pname}" STREQUAL "guez")
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(HlaJson)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -32,10 +34,13 @@ IF (BUILD_SVC_HLA)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# AdlerJson depends on svcPdmClient (ProjectDataManagement) which is not in release scope
|
||||
IF(NOT RELEASE_BUILD)
|
||||
ADD_SUBDIRECTORY(AdlerJson)
|
||||
ENDIF()
|
||||
|
||||
|
||||
OPTION(BUILD_UAS_PROXY "Build the UAS TAB Plugin (default: OFF) [needs BUILD_SV = ON and UNIX-like OS]" OFF) # TODO: use 'pname = guez' if done
|
||||
if (BUILD_SV AND BUILD_UAS_PROXY AND NOT WIN32)
|
||||
if (BUILD_SV AND BUILD_UAS_PROXY AND NOT WIN32 AND NOT RELEASE_BUILD)
|
||||
add_subdirectory(UAS)
|
||||
endif()
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author:
|
||||
#
|
||||
|
||||
# InfrastructureManagement muss zuerst gebaut werden (svcIsmCommon wird von anderen Services benötigt)
|
||||
ADD_SUBDIRECTORY(InfrastructureManagement)
|
||||
ADD_SUBDIRECTORY(AlarmManagement)
|
||||
ADD_SUBDIRECTORY(AreaEffectSimulation)
|
||||
ADD_SUBDIRECTORY(AudioVideoManagement)
|
||||
ADD_SUBDIRECTORY(AssetManagement)
|
||||
ADD_SUBDIRECTORY(CentralEffectSimulation)
|
||||
ADD_SUBDIRECTORY(CodificationManagement)
|
||||
ADD_SUBDIRECTORY(EffectShowManagement)
|
||||
ADD_SUBDIRECTORY(EffectShowClient)
|
||||
ADD_SUBDIRECTORY(Evaluations)
|
||||
ADD_SUBDIRECTORY(ExerciseManagement)
|
||||
ADD_SUBDIRECTORY(ExerciseEventManagement)
|
||||
ADD_SUBDIRECTORY(FileManagement)
|
||||
ADD_SUBDIRECTORY(FilterManagement)
|
||||
ADD_SUBDIRECTORY(GuezIedManagement)
|
||||
ADD_SUBDIRECTORY(GuezMinelayerProcessing)
|
||||
ADD_SUBDIRECTORY(MarkerManagement)
|
||||
ADD_SUBDIRECTORY(Messaging)
|
||||
ADD_SUBDIRECTORY(MeteoDataManagement)
|
||||
ADD_SUBDIRECTORY(NotificationManagement)
|
||||
ADD_SUBDIRECTORY(NmeaManagement)
|
||||
ADD_SUBDIRECTORY(OcBaseDownload)
|
||||
ADD_SUBDIRECTORY(OcSituationClient)
|
||||
ADD_SUBDIRECTORY(OcSituationServer)
|
||||
ADD_SUBDIRECTORY(OnlineReports)
|
||||
ADD_SUBDIRECTORY(OperatorManagement)
|
||||
ADD_SUBDIRECTORY(ParticipantManagement)
|
||||
ADD_SUBDIRECTORY(PlanEditor)
|
||||
ADD_SUBDIRECTORY(PresentationManagement)
|
||||
ADD_SUBDIRECTORY(ProjectDataManagement)
|
||||
ADD_SUBDIRECTORY(ProjectionWorkstation)
|
||||
ADD_SUBDIRECTORY(RecordingManagement)
|
||||
ADD_SUBDIRECTORY(ReportManagement)
|
||||
ADD_SUBDIRECTORY(RoutingServiceNG)
|
||||
ADD_SUBDIRECTORY(ServiceManagement)
|
||||
ADD_SUBDIRECTORY(ScreenRecording)
|
||||
ADD_SUBDIRECTORY(ServiceMonitor)
|
||||
ADD_SUBDIRECTORY(SituationMap)
|
||||
ADD_SUBDIRECTORY(SituationReplayManagement)
|
||||
ADD_SUBDIRECTORY(SituationReplay)
|
||||
ADD_SUBDIRECTORY(SoundManagement)
|
||||
ADD_SUBDIRECTORY(TargetManagement)
|
||||
IF (NOT BUILD_RPM)
|
||||
ADD_SUBDIRECTORY(VideoOverlayManagement)
|
||||
ENDIF()
|
||||
IF(GUEZ_MODE)
|
||||
ADD_SUBDIRECTORY(WarehouseGuez)
|
||||
ENDIF()
|
||||
NGL_INSTALL(AAR SV FILES "alias" DESTINATION "." RENAME ".alias")
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @RDE_HEADER@
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
directory=""
|
||||
source_dir=""
|
||||
|
||||
echo "source_dir = ${source_dir}"
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: $0 -d <directory> -b <base-dir>"
|
||||
echo " -d <directory> : Directory in which the files & include-stmts should be renamed"
|
||||
echo " -b <base-directory> : source-Directory that will be used for find&replace include-stmts"
|
||||
}
|
||||
|
||||
while getopts "d:b:" opt "$@"; do
|
||||
case $opt in
|
||||
d)
|
||||
directory=$OPTARG
|
||||
;;
|
||||
b)
|
||||
source_dir=$OPTARG
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument."
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
if [ -z $directory ]; then
|
||||
echo "Parameter -d is required"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $source_dir ]; then
|
||||
echo "Parameter -b is required"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Change to directory: ${directory} "
|
||||
cd ${directory}
|
||||
|
||||
file_list=`find . -name '*.cpp' -printf "%f\n" `
|
||||
file_list+=" "
|
||||
file_list+=`find . -name '*.xpm' -printf "%f\n" `
|
||||
|
||||
changed_file_list=""
|
||||
for old_file in ${file_list}; do
|
||||
first_file=$( echo ${old_file} | sed -r 's#(^[A-Z])#\l\1#')
|
||||
echo "first: ${first_file}"
|
||||
new_file=$( echo ${first_file} | sed -r 's#([A-Z])#_\l\1#g')
|
||||
if [ ${old_file} != ${new_file} ]; then
|
||||
changed_file_list+=" ${new_file} "
|
||||
echo "-> Rename file ${old_file} to ${new_file}"
|
||||
svn mv ${old_file} ${new_file}
|
||||
#mv ${old_file} ${new_file}
|
||||
fi
|
||||
done
|
||||
|
||||
echo "changed_file_list = ${changed_file_list}"
|
||||
|
||||
h_file_list=""
|
||||
for old_file in `find . -name '*.h' -printf "%f\n" `; do
|
||||
first_file=$( echo ${old_file} | sed -r 's#(^[A-Z])#\l\1#')
|
||||
new_file=$( echo ${first_file} | sed -r 's#([A-Z])#_\l\1#g')
|
||||
|
||||
if [ ${old_file} != ${new_file} ]; then
|
||||
|
||||
# Escape the '.' in the variable old_file & new_file
|
||||
esc_old_file=$(echo ${old_file} | sed -e 's/[]\/$*.^|[]/\\&/g')
|
||||
esc_new_file=$(echo ${new_file} | sed -e 's/[]\/$*.^|[]/\\&/g')
|
||||
find ${source_dir} -name "*.cpp*" -exec grep -l "#include" {} \; | xargs sed -i "s/${esc_old_file}/${esc_new_file}/"
|
||||
find ${source_dir} -name "*.h*" -exec grep -l "#include" {} \; | xargs sed -i "s/${esc_old_file}/${esc_new_file}/"
|
||||
find ${source_dir} -name "*.py" -exec grep -l "#include" {} \; | xargs sed -i "s/${esc_old_file}/${esc_new_file}/"
|
||||
#find ${source_dir} -name "*.h" | xargs sed -i "s/${old_file}/${new_file}/"
|
||||
#grep -Rl "#include" ${source_dir}/*.h | xargs sed -i "s/${old_file}/${new_file}/"
|
||||
|
||||
#echo "grep -l "#include" *.cpp | xargs sed -i 's/${old_file}/${new_file}/'"
|
||||
h_file_list+=" ${new_file} "
|
||||
echo "-> Rename file ${old_file} to ${new_file}"
|
||||
svn mv ${old_file} ${new_file}
|
||||
#mv ${old_file} ${new_file}
|
||||
fi
|
||||
done
|
||||
|
||||
echo "h_file_list = ${h_file_list}"
|
||||
|
||||
|
||||
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
INCLUDE(MacroRTIDDSGen)
|
||||
INCLUDE(MacroCodeGenIdl)
|
||||
|
||||
SET(xml_FILE pdm_service.xml)
|
||||
|
||||
#
|
||||
# --- Library svcPdmCommon --------------------------------------------------------------------------------
|
||||
#
|
||||
SET(SRCS_common
|
||||
pdm_export.h
|
||||
pdm_to_string.cpp
|
||||
pdm_to_string.h
|
||||
logger.cpp
|
||||
logger.h
|
||||
)
|
||||
|
||||
# pdm_types.h was a migration-scaffolding stub with no qt5 counterpart and
|
||||
# no consumer; the stub in include/ was removed and the copy with it.
|
||||
|
||||
# pdm_translation.h and pdm_enums.hpp stub copies (OFF-variant fallbacks whose
|
||||
# include/ sources were removed together with the other shadowing stubs):
|
||||
# with BUILD_GRANTLEE=ON and BUILD_RTI=ON the codegen writes the real files to
|
||||
# these build-dir paths, so the copies are gone rather than kept for forbidden
|
||||
# OFF variants.
|
||||
|
||||
# Add current binary dir to include path for generated headers
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(${PDM_COMMON_TARGET}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# Generate pdm_enums.idl / pdm.idl
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Generate pdm_db.h and pdm_db_impl - requires Grantlee
|
||||
IF(BUILD_GRANTLEE)
|
||||
# Generate pdm_db.h
|
||||
CODEGEN_DATABASE_STRUCTS(SRCS_common ${xml_FILE})
|
||||
# Generate pdm_db_impl.cpp/.h,
|
||||
CODEGEN_DATABASE_SQL(SRCS_common ${xml_FILE})
|
||||
ELSE()
|
||||
# Use pre-generated stub files when BUILD_GRANTLEE=OFF
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdm_db_structs.h.stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_structs.h
|
||||
COPYONLY
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdm_db_structs.cpp.stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_structs.cpp
|
||||
COPYONLY
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdm_db.h.stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db.h
|
||||
COPYONLY
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdm_db_impl.h.stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_impl.h
|
||||
COPYONLY
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdm_db_impl.cpp.stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_impl.cpp
|
||||
COPYONLY
|
||||
)
|
||||
LIST(APPEND SRCS_common
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_structs.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_structs.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_impl.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pdm_db_impl.cpp
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Generate *.cpp/*.hpp from idl
|
||||
IF(BUILD_RTI)
|
||||
RTIDDSGEN(SRCS_common pdm_enums.idl)
|
||||
RTIDDSGEN(SRCS_common pdm.idl)
|
||||
ENDIF()
|
||||
|
||||
# Generate pdm_dt[s,c]_types.h, pdm_ft[s,c]_types.h
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
ENDIF()
|
||||
# generate pdm_[d|f]tc.h
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Create svcPdmCommon library with common sources
|
||||
SET(PDM_COMMON_TARGET svcPdmCommon)
|
||||
NGL_ADD_LIBRARY(AAR SV WS HLA ${PDM_COMMON_TARGET} SHARED ${SRCS_common})
|
||||
generate_export_header(${PDM_COMMON_TARGET}
|
||||
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/svcpdmcommon_export.h"
|
||||
)
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(${PDM_COMMON_TARGET}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(${PDM_COMMON_TARGET}
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
PUBLIC
|
||||
Qt6::Core
|
||||
$<IF:$<TARGET_EXISTS:ddscore>,ddscore,>
|
||||
NGLLogger
|
||||
LtsUtilsCore
|
||||
ngldb
|
||||
)
|
||||
NGL_INSTALL_TARGET(${PDM_COMMON_TARGET})
|
||||
|
||||
#
|
||||
# --- Library svcPdmClient --------------------------------------------------------------------------------
|
||||
#
|
||||
SET(SRCS_client
|
||||
pdm_export.h
|
||||
pdm_dtc_impl_custom.cpp
|
||||
pdm_dtc_impl_custom.h
|
||||
)
|
||||
# generate pdm_ftc_impl.[cpp|h]
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
NGL_ADD_LIBRARY(WS AAR SV HLA svcPdmClient SHARED ${SRCS_client})
|
||||
SET_TARGET_PROPERTIES(svcPdmClient PROPERTIES AUTOMOC ON)
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcPdmClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(svcPdmClient
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
$<IF:$<TARGET_EXISTS:ddsconnector>,ddsconnector,>
|
||||
PUBLIC
|
||||
${PDM_COMMON_TARGET}
|
||||
Qt6::Core
|
||||
ddsftc
|
||||
)
|
||||
NGL_INSTALL_TARGET(svcPdmClient)
|
||||
|
||||
#
|
||||
# --- Library svcPdmServer --------------------------------------------------------------------------------
|
||||
#
|
||||
SET(SRCS_server
|
||||
pdm_export.h
|
||||
)
|
||||
# generate pdm_[d|f]ts.h, pdm_[d|f]ts_impl.[cpp|h]
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
NGL_ADD_LIBRARY(WS AAR SV svcPdmServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcPdmServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(svcPdmServer
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
$<IF:$<TARGET_EXISTS:ddsconnector>,ddsconnector,>
|
||||
$<IF:$<TARGET_EXISTS:ddsfts>,ddsfts,>
|
||||
PUBLIC
|
||||
${PDM_COMMON_TARGET}
|
||||
ngldb
|
||||
)
|
||||
NGL_INSTALL_TARGET(svcPdmServer)
|
||||
|
||||
#
|
||||
# --- Topic Type Plugin --------------------------------------------------------------
|
||||
#
|
||||
IF(BUILD_RTI)
|
||||
CREATE_TOPIC_TYPE_PLUGIN(${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
#
|
||||
# --- Executable svcProjectDataManagement (sPDM) -------------------------------------------------
|
||||
#
|
||||
LIST(APPEND SRCS_exe
|
||||
convert_db_to_dds.h
|
||||
dds_handler.cpp
|
||||
dds_handler.h
|
||||
main.cpp
|
||||
main_handler.cpp
|
||||
main_handler.h
|
||||
settings.cpp
|
||||
settings.h
|
||||
static_data_publisher.h
|
||||
translation.cpp
|
||||
translation.h
|
||||
chargetype_rename.cpp
|
||||
chargetype_rename.h
|
||||
static_pvsan_import.cpp
|
||||
static_pvsan_import.h
|
||||
|
||||
${xml_FILE}
|
||||
)
|
||||
|
||||
# Generate pdm.sql, pdm.xml
|
||||
IF(BUILD_RTI)
|
||||
CODEGEN_SQL(SRCS_exe ${xml_FILE})
|
||||
ENDIF()
|
||||
|
||||
NGL_ADD_SVC_ICON(SRCS_exe)
|
||||
NGL_ADD_EXECUTABLE(AAR SV svcProjectDataManagement ${SRCS_exe})
|
||||
NGL_TARGET_LINK_LIBRARIES(svcProjectDataManagement
|
||||
Qt6::Core
|
||||
svcCoreClient
|
||||
${PDM_COMMON_TARGET}
|
||||
svcPdmServer
|
||||
$<IF:$<TARGET_EXISTS:ddsconnector>,ddsconnector,>
|
||||
nglsettings
|
||||
ProjectConfig
|
||||
LtsCommandLineParser
|
||||
LtsWebSocketServer
|
||||
NGLLogger
|
||||
nglcoreapplication
|
||||
ngltools
|
||||
)
|
||||
NGL_INSTALL_TARGET(svcProjectDataManagement)
|
||||
NGL_INSTALL(AAR SV FILES log4cxx_pdm.props DESTINATION bin)
|
||||
NGL_ADD_TARGET_LINK(svcProjectDataManagement sPDM)
|
||||
|
||||
# Uncomment if necessary
|
||||
#ADD_SUBDIRECTORY(UnitTests)
|
||||
ADD_SUBDIRECTORY(ModuleTests)
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Load/Publish db-translations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "chargetype_rename.h"
|
||||
#include "dds_handler.h"
|
||||
#include "convert_db_to_dds.h"
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
|
||||
ChargeTypeRename::ChargeTypeRename(const std::shared_ptr<DdsHandler> &dds, const std::shared_ptr<DatabaseInterface> &db)
|
||||
: Interface::Fts::UpdateChargeNamesRequestHandler(dds->fts())
|
||||
, Interface::Fts::UpdateChargeTypeRequestHandler(dds->fts())
|
||||
, m_dds(dds)
|
||||
, m_db(db)
|
||||
, m_logger(getLogger("ChargeTypeRename"))
|
||||
{
|
||||
}
|
||||
|
||||
void ChargeTypeRename::onUpdateChargeNamesRequest(const rti::core::SampleIdentity &cookie, const UpdateChargeNamesRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject fro(request.id);
|
||||
if (request.id <= 0)
|
||||
{
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Name update on ChargeType, but no Charge Type Id given"));
|
||||
m_dds->fts()->updateChargeNamesReply(cookie, fro);
|
||||
return;
|
||||
}
|
||||
Database::PdmChargeType ct;
|
||||
if (!m_db->selectPdmChargeType(request.id, ct))
|
||||
{
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Name update on ChargeType, Charge Type could not be fetched from DB"));
|
||||
m_dds->fts()->updateChargeNamesReply(cookie, fro);
|
||||
return;
|
||||
}
|
||||
ct.name = QString::fromStdString(request.name);
|
||||
ct.shortName = QString::fromStdString(request.shortName);
|
||||
|
||||
if (!m_db->update(ct))
|
||||
{
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Name update on ChargeType, Cannot update DB (select worked before)"));
|
||||
m_dds->fts()->updateChargeNamesReply(cookie, fro);
|
||||
return;
|
||||
}
|
||||
|
||||
m_dds->fts()->updateChargeNamesReply(cookie, Core::FunctionReplyObject(ct.id));
|
||||
|
||||
m_dds->dts()->publish(Database::convert(ct));
|
||||
}
|
||||
|
||||
void ChargeTypeRename::onUpdateChargeTypeRequest(const rti::core::SampleIdentity &cookie, const ChargeType &request)
|
||||
{
|
||||
Database::PdmChargeType ct;
|
||||
ct.disEntity = QString::fromStdString(request.disEntity);
|
||||
ct.id = request.id;
|
||||
ct.name = QString::fromStdString(request.name);
|
||||
ct.predefinedName = QString::fromStdString(request.predefinedName);
|
||||
ct.properties = QString::fromStdString(request.properties);
|
||||
ct.shortName = QString::fromStdString(request.shortName);
|
||||
m_db->update(ct);
|
||||
m_dds->fts()->updateChargeTypeReply(cookie, Core::FunctionReplyObject(ct.id));
|
||||
m_dds->dts()->publish(request);
|
||||
}
|
||||
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Handle Charge Type Renaming
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ProjectDataManagement/pdm_fts.h>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
class DdsHandler;
|
||||
class DatabaseInterface;
|
||||
|
||||
class ChargeTypeRename
|
||||
: public QObject
|
||||
, protected Interface::Fts::UpdateChargeNamesRequestHandler
|
||||
, protected Interface::Fts::UpdateChargeTypeRequestHandler
|
||||
|
||||
{
|
||||
public:
|
||||
ChargeTypeRename(const std::shared_ptr<DdsHandler> &dds,
|
||||
const std::shared_ptr<DatabaseInterface> &db);
|
||||
~ChargeTypeRename() = default;
|
||||
|
||||
private:
|
||||
void onUpdateChargeNamesRequest(const rti::core::SampleIdentity &cookie,
|
||||
const UpdateChargeNamesRequest &request) override;
|
||||
// void onSuppressVisibilityRequest(const rti::core::SampleIdentity &cookie,
|
||||
// const SuppressVisibilityRequest &request) override;
|
||||
void onUpdateChargeTypeRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ChargeType &request) override;
|
||||
private:
|
||||
std::shared_ptr<DdsHandler> m_dds;
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+355
@@ -0,0 +1,355 @@
|
||||
/**
|
||||
* Convert db structures to dds structures
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2017-07-20
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <ProjectDataManagement/pdm_db.h>
|
||||
#include <ProjectDataManagement/pdm.hpp>
|
||||
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
namespace Database
|
||||
{
|
||||
inline BuildingChargeEffect convert(const PdmBuildingChargeEffect &data)
|
||||
{
|
||||
BuildingChargeEffect ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.chargeTypeId = data.chargeTypeId;
|
||||
ddsData.destructiveFactor = data.destructiveFactor;
|
||||
ddsData.penetrationFactor = data.penetrationFactor;
|
||||
ddsData.hitSound = data.hitSound;
|
||||
ddsData.difcueLight = data.difcueLight;
|
||||
ddsData.difcuePyro = data.difcuePyro;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline ChargeType convert(const PdmChargeType &data)
|
||||
{
|
||||
ChargeType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.shortName = data.shortName.toStdString();
|
||||
ddsData.predefinedName = data.predefinedName.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
ddsData.legacyId = data.chargeLegacyId;
|
||||
if (!data.disEntity.isEmpty())
|
||||
ddsData.disEntity = data.disEntity.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationMaterial convert(const PdmSanitationMaterial &data)
|
||||
{
|
||||
SanitationMaterial ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.description = data.description.toStdString();
|
||||
ddsData.version = data.version.toStdString();
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationProcedure convert(const PdmSanitationProcedures &data)
|
||||
{
|
||||
SanitationProcedure ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.longName = data.longName.toStdString();
|
||||
ddsData.type = data.type.toStdString();
|
||||
ddsData.pdm_typeId = data.typeId;
|
||||
ddsData.minimumQualification = data.minimumQualification;
|
||||
ddsData.dataCode = data.dataCode;
|
||||
ddsData.version = data.version.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationInjury convert(const PdmSanitationInjury &data)
|
||||
{
|
||||
SanitationInjury ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.kind = data.kind;
|
||||
ddsData.place1 = data.place1;
|
||||
ddsData.place2 = data.place2;
|
||||
ddsData.vbg = data.vbg;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationInjuryKind convert(const PdmSanitationInjuryKind &data)
|
||||
{
|
||||
SanitationInjuryKind ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.version = data.version.toStdString();
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationInjuryPlace1 convert(const PdmSanitationInjuryPlace1 &data)
|
||||
{
|
||||
SanitationInjuryPlace1 ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.version = data.version.toStdString();
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline SanitationInjuryPlace2 convert(const PdmSanitationInjuryPlace2 &data)
|
||||
{
|
||||
SanitationInjuryPlace2 ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.version = data.version.toStdString();
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
|
||||
inline GearTypeChargeType convert(const PdmGearTypeChargeType &data)
|
||||
{
|
||||
GearTypeChargeType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.gearTypeId = data.gearTypeId;
|
||||
ddsData.chargeTypeId = data.chargeTypeId;
|
||||
ddsData.maxRange = data.maxRange;
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline GearType convert(const PdmGearType &data)
|
||||
{
|
||||
GearType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.gearClassId = data.gearClassId;
|
||||
ddsData.tasCode = data.tasCode;
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline IgniterType convert(const PdmIgniterType &data)
|
||||
{
|
||||
IgniterType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.shortName = data.shortName.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline IgniterFunction convert(const PdmIgniterFunction &data)
|
||||
{
|
||||
IgniterFunction ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.shortName = data.shortName.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline LoadType convert(const PdmLoadType &data)
|
||||
{
|
||||
LoadType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.shortName = data.shortName.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline ChargeTypeIgniterTypeIgniterFunction convert(const PdmChargeTypeIgniterTypeIgniterFunction &data)
|
||||
{
|
||||
ChargeTypeIgniterTypeIgniterFunction ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.chargeTypeId = data.chargeTypeId;
|
||||
ddsData.igniterTypeId = data.igniterTypeId;
|
||||
ddsData.igniterFunctionId = data.igniterFunctionId;
|
||||
ddsData.igniterFunctionBaseId = data.igniterFunctionBaseId;
|
||||
ddsData.impactArea = data.impactArea.toStdString();
|
||||
ddsData.impactRadius = data.impactRadius;
|
||||
ddsData.hazardDistance = data.hazardDistance;
|
||||
ddsData.chargeLegacyId = data.chargeLegacyId;
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline ChargeTypeLoadType convert(const PdmChargeTypeLoadType &data)
|
||||
{
|
||||
ChargeTypeLoadType ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.chargeTypeId = data.chargeTypeId;
|
||||
ddsData.loadTypeId = data.loadTypeId;
|
||||
ddsData.numbers = data.numbers();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline LanguageHmi convert(const PdmLanguage &data)
|
||||
{
|
||||
LanguageHmi ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.dbLocale = data.dbLocale.toStdString();
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.isoCode = data.isoCode.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline LanguageXdu convert(const PdmLanguageXdu &data)
|
||||
{
|
||||
LanguageXdu ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.isoCode = data.isoCode.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline RadioGroup convert(const PdmRadioGroup &data)
|
||||
{
|
||||
RadioGroup ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.issi = data.issi;
|
||||
ddsData.group_issi1 = data.groupIssi1;
|
||||
ddsData.group_issi2 = data.groupIssi2;
|
||||
ddsData.base_group = data.baseGroup;
|
||||
ddsData.radioHostname = data.radioHostname.toStdString();
|
||||
ddsData.radioPort = data.radioPort;
|
||||
ddsData.radioBackupHostname = data.radioBackupHostname.toStdString();
|
||||
ddsData.radioBackupPort = data.radioBackupPort;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline VulnerabilityKind convert(const PdmVulnerabilityKind &data)
|
||||
{
|
||||
VulnerabilityKind ddsData;
|
||||
ddsData.id = data.taVulnerabilityKind; // in db there is no id anymore, IO 2021-03-10
|
||||
ddsData.playerTypeClassId = data.playerTypeClassId;
|
||||
ddsData.taVulnerabilityKind = data.taVulnerabilityKind;
|
||||
ddsData.vulnerabilityClassId = data.vulnerabilityClassId;
|
||||
ddsData.name = data.name.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline FirePurpose convert(const PdmFirePurpose &data)
|
||||
{
|
||||
FirePurpose ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.description = data.description.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline NuclearPreset convert(const PdmNuclearPreset &data)
|
||||
{
|
||||
NuclearPreset ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.detonationValue = data.detonationValue;
|
||||
ddsData.impactRadius = data.impactRadius;
|
||||
ddsData.borderLengthInner = data.borderLengthInner;
|
||||
ddsData.borderLengthOuter = data.borderLengthOuter;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline CanComponentString convert(const PdmCanComponentString &data)
|
||||
{
|
||||
CanComponentString ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.pdm_bitMask = data.bitMask;
|
||||
ddsData.canDeviceId = data.canDeviceId;
|
||||
ddsData.subDeviceId = data.subDeviceId;
|
||||
ddsData.name = data.name.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline BiteComponentText convert(const PdmBiteComponentText &data)
|
||||
{
|
||||
BiteComponentText ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.canDeviceId = data.canDeviceId;
|
||||
ddsData.subDeviceId = data.subDeviceId;
|
||||
ddsData.errorNumber = data.errorNumber;
|
||||
ddsData.name = data.name.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline EquipmentSystemEventFilter convert(const PdmEquipmentSystemEventFilter &data)
|
||||
{
|
||||
EquipmentSystemEventFilter ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.equipmentFunctionId = data.equipmentFunctionalId;
|
||||
ddsData.subDeviceId = data.subDeviceId;
|
||||
ddsData.deviceSpecificCode = data.deviceSpecificCode;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline EventFilterHgrMineSearch convert(const PdmEventFilterHgrMineSearch &data)
|
||||
{
|
||||
EventFilterHgrMineSearch ddsData;
|
||||
ddsData.id = data.id;
|
||||
ddsData.chargeTypeId = data.chargeTypeId;
|
||||
ddsData.hgrMineSearchFilterType = data.hgrMineSearchFilterTypeId;
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline TargetType convert(const PdmTargetType &data)
|
||||
{
|
||||
TargetType ddsData;
|
||||
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.abbreviation = data.abbreviation.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
inline TargetSubType convert(const PdmTargetSubType &data)
|
||||
{
|
||||
TargetSubType ddsData;
|
||||
|
||||
ddsData.id = data.id;
|
||||
ddsData.name = data.name.toStdString();
|
||||
ddsData.abbreviation = data.abbreviation.toStdString();
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
inline TargetTypeTargetSubType convert(const PdmTargetTypeTargetSubType &data)
|
||||
{
|
||||
TargetTypeTargetSubType ddsData;
|
||||
|
||||
ddsData.id = data.id;
|
||||
ddsData.targetTypeId = data.targetTypeId;
|
||||
ddsData.targetSubTypeId = data.targetSubtypeId;
|
||||
ddsData.properties = data.properties.toStdString();
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Database
|
||||
} // namespace ProjectDataManagement
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* DdsHandler for DDS
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-09-02
|
||||
*/
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
m_ddsConnector->enableBatchedWriter(false);
|
||||
|
||||
// Pacemaker
|
||||
m_pacemaker = std::make_shared<Core::Pacemaker>(m_ddsConnector);
|
||||
m_topicLockMaster = std::make_shared<Core::TopicLockMaster>(m_ddsConnector);
|
||||
|
||||
m_ddsDts = ProjectDataManagement::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
m_ddsFts = ProjectDataManagement::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
} // Namespace PDM
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* DdsHandler for DDS
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-09-02
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/Core/topic_lock_master.h>
|
||||
#include <ProjectDataManagement/pdm_dts.h>
|
||||
#include <ProjectDataManagement/pdm_fts.h>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class Pacemaker;
|
||||
}
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
class DdsHandler final
|
||||
{
|
||||
public:
|
||||
explicit DdsHandler(int domainId);
|
||||
~DdsHandler() = default;
|
||||
|
||||
bool init(const QStringList &qosFileList = QStringList());
|
||||
|
||||
std::shared_ptr<Core::Pacemaker> pacemaker() const {return m_pacemaker; }
|
||||
std::shared_ptr<Core::TopicLockMaster> topicLockMaster() const { return m_topicLockMaster; }
|
||||
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dts> dts() const { return m_ddsDts; }
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Fts> fts() const { return m_ddsFts; }
|
||||
std::shared_ptr<DDSConnector::DdsConnector> dds() const { return m_ddsConnector; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dts> m_ddsDts;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Fts> m_ddsFts;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
log4j.reset=true
|
||||
log4j.rootLogger=WARN, file
|
||||
|
||||
# Service: ProjectDataManagement
|
||||
###########################################################
|
||||
|
||||
#log4j.logger.PDM=DEBUG
|
||||
#log4j.logger.PDM.main=WARN
|
||||
#log4j.logger.PDM.DdsHandler=INFO
|
||||
#log4j.logger.PDM.ProjectData=INFO
|
||||
#log4j.logger.PDM.Translation=INFO
|
||||
#log4j.logger.PDM.Test=DEBUG
|
||||
|
||||
# File
|
||||
###########################################################
|
||||
log4j.appender.file=Lts::RollingFileAppender
|
||||
log4j.appender.file.MaxFileSize=1MB
|
||||
log4j.appender.file.MaxBackupIndex=9
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n
|
||||
|
||||
|
||||
# Appnd_Console
|
||||
###########################################################
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern= %d %p %c %c{1} - %m (%-.30F:%L) %n
|
||||
|
||||
|
||||
# Appnd_Syslog
|
||||
###########################################################
|
||||
log4j.appender.syslog=org.apache.log4j.SyslogAppender
|
||||
log4j.appender.syslog.Threshold=ERROR
|
||||
log4j.appender.syslog.SysLogHost=localhost
|
||||
log4j.appender.syslog.Facility=LOCAL7
|
||||
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.syslog.layout.ConversionPattern= %-4r %-5p %c %x - %m
|
||||
log4j.appender.syslog.LevelRangeFilter.AcceptOnMatch=true
|
||||
log4j.appender.syslog.LevelRangeFilter.LevelMin=INFO
|
||||
log4j.appender.syslog.LevelRangeFilter.LevelMax=FATAL
|
||||
|
||||
|
||||
###########################################################
|
||||
###########################################################
|
||||
###########################################################
|
||||
# 1) Available Levels in LOG4CXX Version 0.10.0:
|
||||
# TRACE,
|
||||
# DEBUG,
|
||||
# INFO,
|
||||
# WARN,
|
||||
# ERROR
|
||||
# FATAL
|
||||
#
|
||||
# d = date/time
|
||||
# p = priority (Level)
|
||||
# c = category/channel
|
||||
# m = message
|
||||
# F = file
|
||||
# L = line
|
||||
# n = platform dependent line separator character or characters.
|
||||
# ....
|
||||
#
|
||||
# Examples for console:
|
||||
# a)
|
||||
# %d %p %c #%m# (%.50F:%L)%n
|
||||
# date/time
|
||||
# priority
|
||||
# category/channel
|
||||
# #message#
|
||||
# (Maximal 50Character des Filename von rechts:Line)
|
||||
# line separator
|
||||
#
|
||||
# b)
|
||||
# %d (%.15F:%L) %-5p %c |#| %m%n
|
||||
# date/time
|
||||
# (Maximal 15Character des Filename von rechts:Line)
|
||||
# priority, Right pad with spaces if the priority name is less than 5 characters long.
|
||||
# category/channel
|
||||
# message
|
||||
# line separator
|
||||
#
|
||||
# Examples for files:
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Building Config - logging facility
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
|
||||
LOGGER_T getLogger(const char *name)
|
||||
{
|
||||
static const char ns[] = "PDM.";
|
||||
std::string loggerName;
|
||||
const size_t len = strlen(name);
|
||||
loggerName.reserve(sizeof(ns) + len);
|
||||
loggerName.append(ns, sizeof(ns) - 1);
|
||||
loggerName.append(name, len);
|
||||
|
||||
try
|
||||
{
|
||||
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
|
||||
getNGLLogger(loggerName);
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
fprintf(stderr, "Error retrieving logger: %s", ex.what());
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Logging for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "pdm_export.h"
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
using LOGGER_T = NGL::INGLLogger &;
|
||||
|
||||
PDM_COMMON_EXPORT LOGGER_T getLogger(const char *name);
|
||||
inline LOGGER_T getLogger(const QString &loggerName)
|
||||
{
|
||||
return getLogger(loggerName.toUtf8().constData());
|
||||
}
|
||||
} // namespace ProjectDataManagement
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* main for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "logger.h"
|
||||
#include "settings.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
NGLCoreApplication app(argc, argv);
|
||||
|
||||
LtsCommandLineParser::LtsCommandLineParser options;
|
||||
if (!options.init())
|
||||
return -1;
|
||||
app.createLogger("PDM", options.exerciseId());
|
||||
|
||||
ProjectDataManagement::Settings::setIniFile(options.iniFile());
|
||||
|
||||
int iRet = -3;
|
||||
{
|
||||
std::unique_ptr<ProjectDataManagement::MainHandler> mainHandler(new ProjectDataManagement::MainHandler);
|
||||
|
||||
if (!mainHandler->init(options.domainId()))
|
||||
return iRet;
|
||||
|
||||
STARTUP_LOG(app.baseLogger());
|
||||
|
||||
iRet = app.exec();
|
||||
|
||||
SHUTDOWN_LOG(app.baseLogger());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* MainHandler for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
#include <QSettings>
|
||||
|
||||
#include "convert_db_to_dds.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
#include "static_pvsan_import.h"
|
||||
|
||||
using namespace ProjectDataManagement;
|
||||
|
||||
MainHandler::MainHandler()
|
||||
: m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
m_translation = nullptr;
|
||||
m_chargeTypeRename = nullptr;
|
||||
m_dbHandler = nullptr;
|
||||
m_ddsHandler = nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool MainHandler::init(int domainId)
|
||||
{
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(0, Settings::settings()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize DDS
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Settings::settings()->settings()->value(QLatin1String("TrainingAreaBase/UsePvSan"), false).toBool())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Has PvSan so do the import";
|
||||
PvSanImport(db(), m_logger);
|
||||
}
|
||||
|
||||
// initialize the specific handler
|
||||
if (!publishData<Database::PdmBiteComponentText>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmBuildingChargeEffect>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmCanComponentString>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmChargeType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationMaterial>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmFirePurpose>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmGearType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmGearTypeChargeType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmIgniterType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmIgniterFunction>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmLoadType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmChargeTypeIgniterTypeIgniterFunction>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmChargeTypeLoadType>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmTargetType> (db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmTargetSubType> (db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmTargetTypeTargetSubType> (db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmLanguage>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmLanguageXdu>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmNuclearPreset>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmRadioGroup>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmVulnerabilityKind>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmEquipmentSystemEventFilter>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationProcedures>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationInjury>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationInjuryKind>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationInjuryPlace1>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmSanitationInjuryPlace2>(db(), m_ddsHandler->dts(), m_logger) ||
|
||||
!publishData<Database::PdmEventFilterHgrMineSearch>(db(), m_ddsHandler->dts(), m_logger))
|
||||
return false;
|
||||
|
||||
m_translation = std::make_shared<Translation>(m_ddsHandler, db());
|
||||
m_chargeTypeRename = std::make_shared<ChargeTypeRename>(m_ddsHandler, db());
|
||||
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<DatabaseInterface> MainHandler::db() const
|
||||
{
|
||||
return m_dbHandler->db();
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* MainHandler for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "dds_handler.h"
|
||||
#include "pdm_db.h"
|
||||
#include "logger.h"
|
||||
#include "static_data_publisher.h"
|
||||
#include "translation.h"
|
||||
#include "chargetype_rename.h"
|
||||
|
||||
namespace NGLDB
|
||||
{
|
||||
template <typename DB> class DbServiceHandler;
|
||||
}
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
using DbHandler = NGLDB::DbServiceHandler<DatabaseInterface>;
|
||||
|
||||
class MainHandler final
|
||||
{
|
||||
public:
|
||||
MainHandler();
|
||||
~MainHandler();
|
||||
|
||||
bool init(int domainId);
|
||||
std::shared_ptr<DatabaseInterface> db() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<Translation> m_translation;
|
||||
std::shared_ptr<ChargeTypeRename> m_chargeTypeRename;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
} // namespace ProjectDataManagement
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Stub file for pdm_db.h - used when BUILD_GRANTLEE=OFF
|
||||
#ifndef PDM_DB_H
|
||||
#define PDM_DB_H
|
||||
|
||||
// Minimal stub - actual database interface generated by codegen when BUILD_GRANTLEE=ON
|
||||
|
||||
#endif // PDM_DB_H
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// Stub file for pdm_db_impl.cpp - used when BUILD_GRANTLEE=OFF
|
||||
#include "pdm_db_impl.h"
|
||||
|
||||
// Minimal stub - actual implementation generated by codegen when BUILD_GRANTLEE=ON
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Stub file for pdm_db_impl.h - used when BUILD_GRANTLEE=OFF
|
||||
#ifndef PDM_DB_IMPL_H
|
||||
#define PDM_DB_IMPL_H
|
||||
|
||||
// Minimal stub - actual implementation generated by codegen when BUILD_GRANTLEE=ON
|
||||
|
||||
#endif // PDM_DB_IMPL_H
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// Stub file for pdm_db_structs.cpp - used when BUILD_GRANTLEE=OFF
|
||||
#include "pdm_db_structs.h"
|
||||
|
||||
// Minimal stub - actual implementation generated by codegen when BUILD_GRANTLEE=ON
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Stub file for pdm_db_structs.h - used when BUILD_GRANTLEE=OFF
|
||||
#ifndef PDM_DB_STRUCTS_H
|
||||
#define PDM_DB_STRUCTS_H
|
||||
|
||||
// Minimal stub - actual structs generated by codegen when BUILD_GRANTLEE=ON
|
||||
|
||||
#endif // PDM_DB_STRUCTS_H
|
||||
+1737
File diff suppressed because it is too large.
Load diff
+286
@@ -0,0 +1,286 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* PDM Custom functions (extends pdmm_dtc_impl.cpp/.h)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog, SLSE, 2016-11-26
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QJsonObject>
|
||||
#include <QtCore/QVector>
|
||||
#include <ProjectDataManagement/pdm_dtc_impl.h>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class DtcImplCustom final : public Interface::DtcImpl
|
||||
{
|
||||
|
||||
enum UleisClassOffset
|
||||
{
|
||||
None = 0,
|
||||
Grandparent = 0,
|
||||
ShortTimeChild1 = 1500,
|
||||
ShortTimeChild2 = 1600,
|
||||
ShortTimeChild3 = 1700,
|
||||
ShortTimeChild4 = 1800,
|
||||
ShortTimeChild5 = 1900,
|
||||
|
||||
DirectImpactGrandparent = 2000,
|
||||
TopAttackGrandparent = 2000,
|
||||
DirectImpactChild = 3000,
|
||||
TopAttackChild = 3000,
|
||||
BurstOfFireParent = 4000,
|
||||
BurstOfFireChild = 5000,
|
||||
AirBurstParent = 6000,
|
||||
AirBurstChild = 7000,
|
||||
UnarmedParent = 8000,
|
||||
UnarmedChild = 9000,
|
||||
FireAndForgetParent = 12000,
|
||||
FireAndForgetChild = 13000,
|
||||
ShortTimeScanningParent = 22000,
|
||||
ShortTimeScanningChild = 23000
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
|
||||
|
||||
// custom procs, body must be implemented by user
|
||||
// Might need a "baseChargesForGearClass" later on...
|
||||
QVector<ProjectDataManagement::ChargeType> chargesForGearClass(GearClass gearClass) override;
|
||||
QVector<ProjectDataManagement::IgniterType> ignitersForChargeType(int chargeTypeId) override;
|
||||
QVector<ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunction> igniterFunctionsForChargeTypeIgniterType(int chargeTypeId, int igniterTypeId) override;
|
||||
QVector<ProjectDataManagement::LoadType> loadsForChargeType(int chargeTypeId) override;
|
||||
QVector<TargetSubType> targetSubTypesForTargetType(int targetType) override;
|
||||
|
||||
double expansionFactor(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
double impactRadius(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
double impactEdgeLength(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isDryFire(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int mineClass(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool canBeThrown(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool canBeCreated(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isIed(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isReactivatable(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isSmart(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int maxEffectShows(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isSmoke(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isVisible(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isIndirect(int chargeTypeId) override;
|
||||
int searchRadius(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool showHitline(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int remainingTasCode(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int secondaryRemainingTasCode(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int segments(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isLine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isFromMineLayer(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isMineLaying(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
QJsonObject mineLayingPattern(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int height(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isLaserGuidable(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isUasDroppable(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isJamming(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
QVector<int> spacing(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
VolatilityType volatilityTypeId(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
int hazardDistance(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
QVector<CasEffect> casEffects(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
GearClass gearClassFromChargeTypeId(int chargeTypeId) override;
|
||||
QVector<int> gearTypeIdFromChargeTypeId(int chargeTypeId) override;
|
||||
int chargeTypeIdFromLegacyId(GearClass gearClass, int legacyId) override;
|
||||
bool isGmlrs(int chargeTypeId) override;
|
||||
bool isDm72(int chargeTypeId) override;
|
||||
bool isRocket(int chargeTypeId) override;
|
||||
|
||||
ChargeTypeIgniterTypeIgniterFunction getChargeTypeIgniterTypeIgniterFunction(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
ChargeTypeLoadType getChargeTypeLoadType(int chargeTypeId, int loadTypeId) override;
|
||||
|
||||
bool canRestock(int gearTypeId) override;
|
||||
bool canSetDefaults(int gearTypeId) override;
|
||||
int maxCharges(int gearTypeId) override;
|
||||
int cadence(int gearTypeId) override;
|
||||
int getAdlerWeaponSystemId(int gearTypeId) override;
|
||||
int factoryDefault(int gearTypeId, int chargeTypeId) override;
|
||||
int maxCharge(int gearTypeId, int chargeTypeId) override;
|
||||
bool isAtMine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
bool isApMine(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
double getLethalRadius(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
double getNonLethalRadius(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
double getMaxRange(int chargeTypeId, int gearTypeId) override;
|
||||
ProjectDataManagement::BuildingChargeEffect getBuildingChargeEffectByChargeTypeId(int chargeTypeId) override;
|
||||
bool isVirtuallyFireable(int chargeTypeId) override;
|
||||
bool isAdlerChargeType(int chargeTypeId) override;
|
||||
int getAmountFireMarkers(int firePurposeId) override;
|
||||
bool getWithDurationFirePurpose(int firePurposeId) override;
|
||||
|
||||
// get Adler names/ids
|
||||
int getTargetTypeIdFromAdlerTargetType(const QString &typ) override;
|
||||
int getTargetSubTypeIdFromAdlerTargetSubType(const QString &subTyp) override;
|
||||
int getChargeTypeIdFromAdlerCharges(const QString &geschosssorte) override;
|
||||
int getIgniterTypeIdFromAdlerIgniter(const QString &zuender) override;
|
||||
int getIgniterFunctionIdFromAdlerIgniterFunction(const QString &zuenderFunktion) override;
|
||||
int getLoadTypeIdFromAdlerLoad(const QString &ladung) override;
|
||||
QString adlerTargetTypeName(int targetTypeId) override;
|
||||
QString adlerTargetSubTypeName(int targetSubTypeId) override;
|
||||
QString adlerChargeTypeName(int chargeTypeId) override;
|
||||
QString adlerIgniterTypeName(int igniterTypeId) override;
|
||||
QString adlerIgniterFunctionName(int igniterFunctionId) override;
|
||||
QString adlerLoadTypeName(int loadTypeId) override;
|
||||
|
||||
QString trBiteComponentTextName(int biteComponentId) override;
|
||||
QString trCanComponentStringName(int canComponentId) override;
|
||||
QString trChargeTypeShortName(int chargeTypeId, bool omitBaseSuffix = false) override;
|
||||
QString trChargeTypeName(int chargeTypeId, bool omitBaseSuffix = false) override;
|
||||
QString trFirePurposeName(int firePurposeId) override;
|
||||
QString trGearTypeName(int gearTypeId) override;
|
||||
QString trIgniterTypeName(int igniterTypeId) override;
|
||||
QString trIgniterTypeShortName(int igniterTypeId) override;
|
||||
QString trIgniterFunctionName(int igniterFunctionId) override;
|
||||
QString trIgniterFunctionShortName(int igniterFunctionId) override;
|
||||
QString trLoadTypeName(int loadTypeId) override;
|
||||
QString trLoadTypeShortName(int loadTypeId) override;
|
||||
QString trTargetTypeName(int targetTypeId) override;
|
||||
QString trTargetSubTypeName(int targetSubTypeId) override;
|
||||
QString trLanguageHmiName(int languageHmiId) override;
|
||||
QString trLanguageXduName(int languageXduId) override;
|
||||
QString trNuclearPresetName(int nucularPresetId) override; // "'Nucular'. It's pronounced 'Nucular'!"
|
||||
QString trRadioGroupName(int radioGroupId) override;
|
||||
QString trVulnerabilityKindName(int vulnerabilityKindId, VulnerabilityClass vulnerabilityClassId) override;
|
||||
QString trSanitationMaterialName(int sanitationMaterialId) override;
|
||||
QString trSanitationProcedureName(int sanitationProcedureId) override;
|
||||
QString trSanitationInjuryKindName(int sanitationInjuryKindId) override;
|
||||
QString trSanitationInjuryPlace1Name(int sanitationInjuryPlace1Id) override;
|
||||
QString trSanitationInjuryPlace2Name(int sanitationInjuryPlace2Id) override;
|
||||
|
||||
QStringList chargeNames(std::vector<int> &chargeIds) override;
|
||||
int getAvailableChargeTypeId(int chargeTypeId /*, bool *bOk = nullptr*/) override;
|
||||
ChargeTypeProperty getChargeTypeSpecialProperty(int chargeTypeId, int igniterTypeId, int igniterFunctionId) override;
|
||||
QVector<SanitationProcedure> getSanitationProcedures(qint64 procedures) override;
|
||||
QStringList sanitationProceduresList(qint64 procedures) override;
|
||||
|
||||
private:
|
||||
struct ChargeTypeIgniterTypeIgniterFunctionProps
|
||||
{
|
||||
int chargeTypeId = 0;
|
||||
int igniterTypeId = 0;
|
||||
int igniterFunctionId = 0;
|
||||
IgniterFunctionBase igniterFunctionBase = IgniterFunctionBase::IfbImpact;
|
||||
int chargeLegacyId = 0;
|
||||
double expansionFactor = 0;
|
||||
double impactRadius = 0;
|
||||
double impactEdgeLength = 0;
|
||||
VolatilityType volatilityTypeId = VolatilityType::Unknown;
|
||||
int searchRadius = 0;
|
||||
bool isSmart = false;
|
||||
bool isDryFire = false;
|
||||
bool isDus = false;
|
||||
int mineClass = 0;
|
||||
bool canBeThrown = false;
|
||||
bool canBeCreated = true;
|
||||
bool isIed = false;
|
||||
bool isFromMineLayer = false;
|
||||
bool isMineLaying = false;
|
||||
QJsonObject mineLayingPattern;
|
||||
bool isReactivatable = false;
|
||||
bool isSmoke = false;
|
||||
int maxEffectShows = 1;
|
||||
bool isVisible = true;
|
||||
bool isLRF = false;
|
||||
bool isLTD = false;
|
||||
bool isAP = false;
|
||||
bool isAT = false;
|
||||
bool isConcrete = false;
|
||||
bool showHitline = true;
|
||||
int remainingTasCode = 0;
|
||||
int secondaryRemainingTasCode = 0;
|
||||
int segments = 0;
|
||||
bool isLine = false;
|
||||
QVector<int> spacing;
|
||||
int height = 0;
|
||||
int hazardDistance = 0;
|
||||
bool isLaserGuidable;
|
||||
bool isUasDroppable;
|
||||
bool isJamming;
|
||||
bool isVirtuallyFireable = false;
|
||||
QVector<CasEffect> casEffects;
|
||||
bool isAdlerChargeType;
|
||||
QString adlerChargeTypeName;
|
||||
QString adlerIgniterTypeName;
|
||||
QString adlerIgniterFunctionName;
|
||||
};
|
||||
|
||||
struct ChargeTypeLoadTypeProps
|
||||
{
|
||||
int chargeTypeId = 0;
|
||||
int loadTypeId = 0;
|
||||
QString adlerLoadTypeName;
|
||||
};
|
||||
|
||||
struct GearTypeProps
|
||||
{
|
||||
bool canRestock = false;
|
||||
bool canSetDefaults = false;
|
||||
int maxCharges = -1;
|
||||
int adlerWeaponSystemId = -1;
|
||||
int cadence = -1;
|
||||
};
|
||||
|
||||
struct GearTypeChargeTypeProps
|
||||
{
|
||||
int factoryDefault = 0;
|
||||
int maxCharge = 0;
|
||||
};
|
||||
|
||||
QString translate(const std::function<PdmBaseName(DtcImplCustom &, qint32)> &getItem, const std::function<QString(const std::string &)> &pdmTranslate, qint32 id);
|
||||
QString translateShortChargeType(const std::function<QString(const std::string &)> &pdmTranslate, qint32 id);
|
||||
QString translateShortIgniterType(const std::function<QString(const std::string &)> &pdmTranslate, qint32 id);
|
||||
QString translateShortIgniterFunction(const std::function<QString(const std::string &)> &pdmTranslate, qint32 id);
|
||||
QString translateShortLoadType(const std::function<QString(const std::string &)> &pdmTranslate, qint32 id);
|
||||
|
||||
void onChargeTypeChanged(const ChargeType &ct);
|
||||
void fillChargeTypeIgniterTypeIgniterFunctionProps();
|
||||
void fillChargeTypeLoadTypeProps();
|
||||
void onIgniterTypeChanged(const IgniterType &ignType);
|
||||
void onIgniterFunctionChanged(const IgniterFunction &ignFunc);
|
||||
void onChargeTypeIgniterTypeIgniterFunctionChanged(const ChargeTypeIgniterTypeIgniterFunction &ctitif);
|
||||
|
||||
ChargeTypeIgniterTypeIgniterFunctionProps chargeTypeIgniterTypeIgniterFunctionProps(int chargeTypeId, int igniterTypeId, int igniterFunctionId);
|
||||
DtcImplCustom::ChargeTypeLoadTypeProps chargeTypeLoadTypeProps(int chargeTypeId, int loadTypeId);
|
||||
|
||||
QString suffix(int chargeTypeId, bool omitBaseSuffix = false);
|
||||
static QString offsetName(UleisClassOffset o);
|
||||
|
||||
void onGearTypeChanged(const GearType >);
|
||||
GearTypeProps gearTypeProps(int gearTypeId);
|
||||
|
||||
void onGearTypeChargeTypeChanged(const GearTypeChargeType >ct);
|
||||
GearTypeChargeTypeProps gearTypeChargeTypeProps(int gearTypeChargeTypeId);
|
||||
|
||||
void setProps(ChargeTypeIgniterTypeIgniterFunctionProps &props, QJsonObject obj);
|
||||
void setProps(ChargeTypeLoadTypeProps &props, QJsonObject obj);
|
||||
|
||||
QJsonObject propertiesToJson(const std::string &properties);
|
||||
void mergeProperties(QHash<int, ChargeTypeIgniterTypeIgniterFunctionProps>::iterator &it,
|
||||
const QJsonObject &ifProps,
|
||||
const QJsonObject &ctProps,
|
||||
const QJsonObject &ctitifProps,
|
||||
const QJsonObject &itProps);
|
||||
|
||||
private:
|
||||
QHash<int, ChargeTypeIgniterTypeIgniterFunctionProps> m_ctItIfProps;
|
||||
QHash<int, ChargeTypeLoadTypeProps> m_ctLtProps;
|
||||
QHash<int, GearTypeProps> m_gtProps;
|
||||
QHash<int, GearTypeChargeTypeProps> m_gtctProps;
|
||||
QString indirectString(bool isIndirect) const;
|
||||
|
||||
// Logger member
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace Interface
|
||||
} // namespace ProjectDataManagement
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Export definitions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-08-04
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef PDM_COMMON_EXPORT
|
||||
# ifdef BUILD_STATIC_LIBRARIES
|
||||
# define PDM_COMMON_EXPORT
|
||||
# else
|
||||
# if defined(MAKE_SVCPDMCOMMON_LIB)
|
||||
# define PDM_COMMON_EXPORT Q_DECL_EXPORT
|
||||
# ifndef WIN32
|
||||
# ifdef NDDSUSERDllExport
|
||||
# undef NDDSUSERDllExport
|
||||
# endif
|
||||
# define NDDSUSERDllExport Q_DECL_EXPORT
|
||||
# endif
|
||||
# else
|
||||
# define PDM_COMMON_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PDM_CLIENT_EXPORT
|
||||
# ifdef BUILD_STATIC_LIBRARIES
|
||||
# define PDM_CLIENT_EXPORT
|
||||
# else
|
||||
# if defined(MAKE_SVCPDMCLIENT_LIB)
|
||||
# define PDM_CLIENT_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define PDM_CLIENT_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PDM_SERVER_EXPORT
|
||||
# ifdef BUILD_STATIC_LIBRARIES
|
||||
# define PDM_SERVER_EXPORT
|
||||
# else
|
||||
# if defined(MAKE_SVCPDMSERVER_LIB)
|
||||
# define PDM_SERVER_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define PDM_SERVER_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
+1571
File diff suppressed because it is too large.
Load diff
+132
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Convert DSS enumerations to translatable strings
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
#include "pdm_to_string.h"
|
||||
#include "pdm_translation.h"
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
//
|
||||
// VulnerabilityState + VulnerabilityClass
|
||||
//
|
||||
static QString toStringBuilding(VulnerabilityState vs)
|
||||
{
|
||||
switch (vs)
|
||||
{
|
||||
#ifdef ETS_MODE
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady: return QCoreApplication::translate("ProjectDataManagement", "Ready", "VulnerabilityStateBuilding");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "Damaged", "VulnerabilityStateBuilding");
|
||||
#else
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady: return QCoreApplication::translate("ProjectDataManagement", "Combat Ready", "VulnerabilityStateBuilding");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "CatastrophicKill", "VulnerabilityStateBuilding");
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
return QCoreApplication::translate("ProjectDataManagement", "Unknown (%1)", "VulnerabilityState").arg(static_cast<int>(vs));
|
||||
}
|
||||
|
||||
static QString toStringVehicle(VulnerabilityState vs)
|
||||
{
|
||||
switch (vs)
|
||||
{
|
||||
#ifdef ETS_MODE
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady: return QCoreApplication::translate("ProjectDataManagement", "Ready / OK", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_LightDamage: return QCoreApplication::translate("ProjectDataManagement", "Communication Damage", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_HeavyDamage: return QCoreApplication::translate("ProjectDataManagement", "Main Function Damage", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_MobilityKill: return QCoreApplication::translate("ProjectDataManagement", "Mobility Lost", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "Fully Damaged", "VulnerabilityStateVehicle");
|
||||
default:
|
||||
break;
|
||||
#else
|
||||
case VulnerabilityState::VulnerabilityState_LightDamage: return QCoreApplication::translate("ProjectDataManagement", "Comms Damaged", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_MediumDamage: return QCoreApplication::translate("ProjectDataManagement", "Veh Body Damaged", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_HeavyDamage: return QCoreApplication::translate("ProjectDataManagement", "Main Funct Damaged", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_MobilityKill: return QCoreApplication::translate("ProjectDataManagement", "Mobility Kill", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_VisibleMobilityKill: return QCoreApplication::translate("ProjectDataManagement", "Visible Mobility Kill", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_WeaponSystemDamage: return QCoreApplication::translate("ProjectDataManagement", "Wpn / Turret Damaged", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_VisibleWeaponSystemDamage: return QCoreApplication::translate("ProjectDataManagement", "Visible Wpn / Turret Damaged", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "Catastrophic Kill", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
case VulnerabilityState::VulnerabilityState_NoChange:
|
||||
case VulnerabilityState::VulnerabilityState_TemporarySeverance:
|
||||
case VulnerabilityState::VulnerabilityState_NearMiss:
|
||||
case VulnerabilityState::VulnerabilityState_HitWithNoEffect:
|
||||
case VulnerabilityState::VulnerabilityState_VulnerabilityBitsChanged:
|
||||
case VulnerabilityState::VulnerabilityState_NContamination:
|
||||
case VulnerabilityState::VulnerabilityState_BContamination:
|
||||
case VulnerabilityState::VulnerabilityState_CContamination:
|
||||
case VulnerabilityState::VulnerabilityState_NotReady: // Internal
|
||||
case VulnerabilityState::VulnerabilityState_Reserved: // Internal
|
||||
break; // use common translation from toString()
|
||||
#endif
|
||||
}
|
||||
// Fallback
|
||||
return toString(vs);
|
||||
}
|
||||
|
||||
static QString toStringSoldier(VulnerabilityState vs)
|
||||
{
|
||||
switch (vs)
|
||||
{
|
||||
#ifdef ETS_MODE
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady: return QCoreApplication::translate("ProjectDataManagement", "Ready / OK", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_LightDamage: return QCoreApplication::translate("ProjectDataManagement", "lightly injured", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_MediumDamage: return QCoreApplication::translate("ProjectDataManagement", "moderatly injured", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_HeavyDamage: return QCoreApplication::translate("ProjectDataManagement", "seriously injured", "VulnerabilityStateVehicle");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "dead", "VulnerabilityStateVehicle");
|
||||
default:
|
||||
break;
|
||||
#else
|
||||
case VulnerabilityState::VulnerabilityState_LightDamage: return QCoreApplication::translate("ProjectDataManagement", "Wounded Walking", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_MediumDamage: return QCoreApplication::translate("ProjectDataManagement", "Wounded Sitting", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_HeavyDamage: return QCoreApplication::translate("ProjectDataManagement", "Wounded Laying", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_CatastrophicKill: return QCoreApplication::translate("ProjectDataManagement", "Catastrophic Kill / Killed", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_WeaponSystemDamage: return QCoreApplication::translate("ProjectDataManagement", "Weapon Damage", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_VisibleWeaponSystemDamage: return QCoreApplication::translate("ProjectDataManagement", "Visible Weapon Damage", "VulnerabilityStateSoldier");
|
||||
case VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
case VulnerabilityState::VulnerabilityState_TemporarySeverance:
|
||||
case VulnerabilityState::VulnerabilityState_NearMiss:
|
||||
case VulnerabilityState::VulnerabilityState_HitWithNoEffect:
|
||||
case VulnerabilityState::VulnerabilityState_VulnerabilityBitsChanged:
|
||||
case VulnerabilityState::VulnerabilityState_NContamination:
|
||||
case VulnerabilityState::VulnerabilityState_BContamination:
|
||||
case VulnerabilityState::VulnerabilityState_CContamination:
|
||||
case VulnerabilityState::VulnerabilityState_NoChange:
|
||||
break; // use common translation from toString()
|
||||
// those should not happen ...
|
||||
case VulnerabilityState::VulnerabilityState_MobilityKill:
|
||||
case VulnerabilityState::VulnerabilityState_VisibleMobilityKill:
|
||||
case VulnerabilityState::VulnerabilityState_NotReady: // Internal
|
||||
case VulnerabilityState::VulnerabilityState_Reserved: // Internal
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return toString(vs);
|
||||
}
|
||||
|
||||
QString toString(VulnerabilityState vs, VulnerabilityClass vc)
|
||||
{
|
||||
switch (vc)
|
||||
{
|
||||
case VulnerabilityClass::VulnerabilityClass_Unknown:
|
||||
case VulnerabilityClass::VulnerabilityClass_WtdDamages:
|
||||
case VulnerabilityClass::VulnerabilityClass_WtdInjuries:
|
||||
return toString(vs);
|
||||
case VulnerabilityClass::VulnerabilityClass_BuildingDamages:
|
||||
return toStringBuilding(vs);
|
||||
case VulnerabilityClass::VulnerabilityClass_VehicleDamages:
|
||||
return toStringVehicle(vs);
|
||||
case VulnerabilityClass::VulnerabilityClass_SoldierInjuries:
|
||||
return toStringSoldier(vs);
|
||||
}
|
||||
return QCoreApplication::translate("ProjectDataManagement", "Unknown (%1)", "VulnerabilityState").arg(static_cast<int>(vs));
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Convert DSS enumerations to translatable strings
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "pdm_export.h"
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
#include <ProjectDataManagement/pdm_translation.h>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
//
|
||||
// VulnerabilityState + VulnerabilityClass
|
||||
//
|
||||
PDM_COMMON_EXPORT QString toString(VulnerabilityState vs, VulnerabilityClass vc);
|
||||
} // namespace ProjectDataManagement
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
-- all available service idl files
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/build-rti-on/Lts/DDS/Core/core.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/build-rti-on/Lts/DDS/Core/core_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS/Core/core.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/ProjectDataManagement/pdm.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/ProjectDataManagement/pdm_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/ProjectDataManagement/pdm_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/Buildings/bld.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/Buildings/bld_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/Buildings/bld_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/tab.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/tab_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/tab_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/taboc.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/taboc_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/taboc_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/GuezNasat/gna.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/GuezNasat/gna_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/GuezNasat/gna_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/ComponentMonitor/cmo.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/ComponentMonitor/cmo_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/ComponentMonitor/cmo_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/WarehouseGuez/whg.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/WarehouseGuez/whg_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/WarehouseGuez/whg_service.xml
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/TargetManagement/tgt.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/TargetManagement/tgt_enums.idl
|
||||
/workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/TargetManagement/tgt_service.xml
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Settings for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
class NGLSettingsClass : public NGL::Settings
|
||||
{
|
||||
public:
|
||||
NGLSettingsClass()
|
||||
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
|
||||
{}
|
||||
static void setIniFile(const QString &fn)
|
||||
{
|
||||
s_iniFile = fn;
|
||||
}
|
||||
static QString s_iniFile;
|
||||
};
|
||||
QString NGLSettingsClass::s_iniFile;
|
||||
Q_GLOBAL_STATIC(NGLSettingsClass, s)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
NGL::Settings *Settings::settings()
|
||||
{
|
||||
return s();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Settings::setIniFile(const QString &ini)
|
||||
{
|
||||
NGLSettingsClass::setIniFile(ini);
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Settings for ProjectDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class Settings;
|
||||
}
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
//!< The real NGL::Settings - object
|
||||
NGL::Settings *settings();
|
||||
void setIniFile(const QString &ini);
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Handler to publish (project) static data to dds
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2017-07-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include "pdm_db.h"
|
||||
#include "logger.h"
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
|
||||
template <typename DB>
|
||||
bool publishData(const std::shared_ptr<DatabaseInterface> &db,
|
||||
const std::shared_ptr<ProjectDataManagement::Interface::Dts> &dts,
|
||||
NGL::INGLLogger &logger)
|
||||
{
|
||||
const auto cb = [dts](const DB & data)
|
||||
{
|
||||
dts->publish(convert(data));
|
||||
};
|
||||
|
||||
// read from db
|
||||
if (!db->select(cb))
|
||||
{
|
||||
ERROR_LOG(logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+657
@@ -0,0 +1,657 @@
|
||||
#include "static_pvsan_import.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSet>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
#include <ngldb/dbtransaction.h>
|
||||
#include <ngldb/nsqlquery.h>
|
||||
|
||||
namespace ProjectDataManagement {
|
||||
|
||||
PvSanImport::PvSanImport(const std::shared_ptr<DatabaseInterface> &db,
|
||||
NGL::INGLLogger &logger):
|
||||
m_version(QStringLiteral("-")),
|
||||
m_db(db),
|
||||
m_logger(logger)
|
||||
{
|
||||
publishDataPvSan();
|
||||
}
|
||||
|
||||
bool PvSanImport::publishDataPvSan()
|
||||
{
|
||||
|
||||
QVector<QString> procedures;
|
||||
QVector<QString> injuries;
|
||||
QVector<QString> material;
|
||||
QVector<QString> kind;
|
||||
QVector<QString> place1;
|
||||
QVector<QString> place2;
|
||||
|
||||
//b->removePdmTranslation()
|
||||
if (!readFile(procedures, material, injuries, kind, place1, place2))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can't read pvsan file";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!addProcedures(procedures))
|
||||
return false;
|
||||
|
||||
if(!addMaterial(material))
|
||||
return false;
|
||||
|
||||
if(!addInjuryPlaces(kind, place1, place2))
|
||||
return false;
|
||||
|
||||
if(!addInjuries(injuries))
|
||||
return false;
|
||||
|
||||
// X X A A B B C C D D E E M M 0 0
|
||||
//0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
|
||||
//0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
|
||||
return true;
|
||||
}
|
||||
|
||||
qint64 PvSanImport::getCode(const QString &type, int typeId)
|
||||
{
|
||||
qint64 check = 1ULL;
|
||||
|
||||
qint64 multiplayer = 1ULL;
|
||||
|
||||
switch (type.at(0).unicode())
|
||||
{
|
||||
case 'x':
|
||||
multiplayer = multiplayer<<(55 + typeId);
|
||||
break;
|
||||
case 'A':
|
||||
multiplayer = multiplayer<<(47 + typeId);
|
||||
break;
|
||||
case 'B':
|
||||
multiplayer = multiplayer<<(39+ typeId);
|
||||
break;
|
||||
case 'C':
|
||||
multiplayer = multiplayer<<(31+ typeId);
|
||||
break;
|
||||
case 'D':
|
||||
multiplayer = multiplayer<<(23+ typeId);
|
||||
break;
|
||||
case 'E':
|
||||
multiplayer = multiplayer<<(15+ typeId);
|
||||
break;
|
||||
case 'M':
|
||||
multiplayer = multiplayer<<(7+ typeId);
|
||||
break;
|
||||
default:
|
||||
multiplayer = typeId;
|
||||
break;
|
||||
|
||||
};
|
||||
check = multiplayer;
|
||||
return check;
|
||||
}
|
||||
|
||||
bool PvSanImport::readFile(QVector<QString> &procedures, QVector<QString> &material,
|
||||
QVector<QString> &injuries, QVector<QString> &kind,
|
||||
QVector<QString> &place1, QVector<QString> &place2 )
|
||||
{
|
||||
QString vbkFile = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("vbk.csv"));
|
||||
QFile csvFile(vbkFile);
|
||||
DEBUG_LOG(m_logger) << "Start reading File " << vbkFile;
|
||||
|
||||
if (!csvFile.exists())
|
||||
return false;
|
||||
if(!csvFile.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "Opened File";
|
||||
|
||||
bool skip = true;
|
||||
QTextStream in(&csvFile);
|
||||
|
||||
//version
|
||||
while (!in.atEnd())
|
||||
{
|
||||
QString line = in.readLine();
|
||||
if (!line.startsWith(QStringLiteral("Version")))
|
||||
continue;
|
||||
|
||||
// ERROR_LOG(m_logger) << line;
|
||||
QStringList versionSplit = line.split(QStringLiteral(";"));
|
||||
if (versionSplit.size() > 1)
|
||||
m_version = versionSplit.at(1);
|
||||
break;
|
||||
}
|
||||
skip = true;
|
||||
|
||||
//injuries
|
||||
while (!in.atEnd())
|
||||
{
|
||||
QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("VBA-Index")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
line = in.readLine();
|
||||
skip = false;
|
||||
}
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
injuries.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
skip = true;
|
||||
in.seek(0);
|
||||
|
||||
//Material
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("sanmat")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
in.readLine();
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
//ERROR_LOG(m_logger) << line;
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
material.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
skip = true;
|
||||
in.seek(0);
|
||||
|
||||
//procedures
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("massnahmen.csv")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
in.readLine();
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
procedures.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
skip = true;
|
||||
in.seek(0);
|
||||
|
||||
//kind
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("verwundungstyp")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
in.readLine();
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
kind.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
skip = true;
|
||||
in.seek(0);
|
||||
|
||||
//palce1
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("ort1")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
in.readLine();
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
place1.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
skip = true;
|
||||
in.seek(0);
|
||||
|
||||
//place2
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
if (skip && !line.startsWith(QStringLiteral("ort2")))
|
||||
continue;
|
||||
else if (skip)
|
||||
{
|
||||
//read one more line
|
||||
in.readLine();
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
place2.append(line);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
csvFile.close();
|
||||
|
||||
// ERROR_LOG(m_logger) << "read " << procedures.size() << " procedures from file";
|
||||
// ERROR_LOG(m_logger) << "read " << material.size() << " materials from file";
|
||||
// ERROR_LOG(m_logger) << "read " << injuries.size() << " injuries from file";
|
||||
// ERROR_LOG(m_logger) << "read " << kind.size() << " kinds from file";
|
||||
// ERROR_LOG(m_logger) << "read " << place1.size() << " place1 from file";
|
||||
// ERROR_LOG(m_logger) << "read " << place2.size() << " place2 from file";
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PvSanImport::addProcedures(const QVector<QString> &procedures)
|
||||
{
|
||||
if(procedures.isEmpty())
|
||||
return false;
|
||||
|
||||
//check for DatabaseEntry with ID 1 and it's version
|
||||
Database::PdmSanitationProcedures procTemp;
|
||||
|
||||
if (m_db->selectPdmSanitationProcedures(1, procTemp) && procTemp.version == m_version)
|
||||
return true;
|
||||
|
||||
QString myContext=QStringLiteral("SanitationProcedure");
|
||||
//remove from DB
|
||||
m_db->truncatePdmSanitationProcedures();
|
||||
|
||||
QVector<Database::PdmTranslation> translations;
|
||||
m_db->select(translations);
|
||||
QSet<quint64> idsToRemove;
|
||||
for (const auto &tr : std::as_const(translations))
|
||||
{
|
||||
if (tr.context == myContext)
|
||||
idsToRemove.insert(tr.id);
|
||||
}
|
||||
|
||||
for (quint64 id : idsToRemove )
|
||||
{
|
||||
m_db->removePdmTranslation(id);
|
||||
}
|
||||
|
||||
//insert into db
|
||||
Database::PdmSanitationProcedures pros;
|
||||
pros.id= 0;
|
||||
pros.type = QStringLiteral("-");
|
||||
pros.name = QStringLiteral("Keine");
|
||||
pros.typeId = 0;
|
||||
pros.longName = QStringLiteral("Keine");
|
||||
pros.dataCode = 0;
|
||||
|
||||
m_db->insert(pros);
|
||||
|
||||
|
||||
Database::PdmTranslation trans;
|
||||
trans.key = pros.name;
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.context = myContext;
|
||||
trans.translation = QStringLiteral("None");
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = pros.name;
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
|
||||
for (const QString &entry: procedures)
|
||||
{
|
||||
|
||||
QStringList measure = entry.split(QStringLiteral(";"));
|
||||
// ERROR_LOG(m_logger) << entry << " size of split: " << measure.size();
|
||||
if (measure.size() < 34 )
|
||||
continue;
|
||||
Database::PdmSanitationProcedures pros;
|
||||
pros.id = measure.at(0).toInt();
|
||||
pros.name = measure.at(3);
|
||||
pros.longName = measure.at(4);
|
||||
pros.type = measure.at(1);
|
||||
pros.typeId = measure.at(2).toInt();
|
||||
pros.minimumQualification = measure.at(34).toInt() == 0 ? 3 : measure.at(34).toInt();
|
||||
pros.version = m_version;
|
||||
|
||||
pros.dataCode = getCode(pros.type, pros.typeId);
|
||||
if(m_db->insert(pros))
|
||||
{
|
||||
Database::PdmTranslation trans;
|
||||
trans.key = measure.at(3);
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.context = myContext;
|
||||
trans.translation = measure.at(5);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = measure.at(3);
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
|
||||
//long name:
|
||||
trans.id = 0;
|
||||
trans.key = measure.at(4);
|
||||
trans.disambiguation = QStringLiteral("long_name");
|
||||
|
||||
trans.translation = measure.at(4);
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = measure.at(6);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PvSanImport::addMaterial(const QVector<QString> &material)
|
||||
{
|
||||
if(material.isEmpty())
|
||||
return false;
|
||||
//check for DatabaseEntry with ID 1 and it's version
|
||||
Database::PdmSanitationMaterial matTemp;
|
||||
|
||||
//remove from DB only if version differs
|
||||
if (m_db->selectPdmSanitationMaterial(1, matTemp) && matTemp.version == m_version)
|
||||
return true;
|
||||
|
||||
//m_db->truncatePdmSanitationMaterial();
|
||||
DBTransaction trans(m_db->database());
|
||||
NSqlQuery q(m_db->database());
|
||||
|
||||
QString stmt = QStringLiteral("DELETE FROM pdm_sanitation_material");
|
||||
|
||||
q.prepare(stmt);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmt;
|
||||
|
||||
if (!q.exec())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not delete sanitation materials";
|
||||
return false;
|
||||
}
|
||||
|
||||
trans.commit();
|
||||
|
||||
QString myContext = QStringLiteral("SanitationMaterial");
|
||||
QVector<Database::PdmTranslation> translations;
|
||||
m_db->select(translations);
|
||||
QSet<quint64> idsToRemove;
|
||||
for (const auto &tr : std::as_const(translations))
|
||||
{
|
||||
if (tr.context == myContext)
|
||||
idsToRemove.insert(tr.id);
|
||||
}
|
||||
|
||||
for (quint64 id : idsToRemove )
|
||||
{
|
||||
m_db->removePdmTranslation(id);
|
||||
}
|
||||
|
||||
//insert into db
|
||||
for (const QString &entry: material)
|
||||
{
|
||||
QStringList material = entry.split(QStringLiteral(";"));
|
||||
if (material.size() < 3 )
|
||||
continue;
|
||||
Database::PdmSanitationMaterial mat;
|
||||
mat.id = material.at(0).toInt();
|
||||
mat.name = material.at(1);
|
||||
mat.version = m_version;
|
||||
|
||||
if(m_db->insert(mat))
|
||||
{
|
||||
Database::PdmTranslation trans;
|
||||
trans.key = material.at(1);
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.context = myContext;
|
||||
trans.translation = material.at(2);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = material.at(1);
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PvSanImport::addInjuryPlaces(const QVector<QString> &kind, const QVector<QString> &place1, const QVector<QString> &place2)
|
||||
{
|
||||
if (kind.isEmpty() || place1.isEmpty() || place2.isEmpty())
|
||||
return false;
|
||||
|
||||
//check for DatabaseEntry with ID 1 and it's version
|
||||
Database::PdmSanitationInjuryKind kindTemp;
|
||||
|
||||
if (m_db->selectPdmSanitationInjuryKind(1, kindTemp) && kindTemp.version == m_version)
|
||||
return true;
|
||||
|
||||
QString myContext = QStringLiteral("SanitationInjuryKind");
|
||||
Database::PdmTranslation trans;
|
||||
|
||||
//remove from DB
|
||||
m_db->truncatePdmSanitationInjuryKind();
|
||||
|
||||
QVector<Database::PdmTranslation> translations;
|
||||
m_db->select(translations);
|
||||
QSet<quint64> idsToRemove;
|
||||
for (const auto &tr : std::as_const(translations))
|
||||
{
|
||||
if (tr.context == myContext)
|
||||
idsToRemove.insert(tr.id);
|
||||
}
|
||||
|
||||
for (quint64 id : idsToRemove )
|
||||
{
|
||||
m_db->removePdmTranslation(id);
|
||||
}
|
||||
|
||||
//insert into db
|
||||
trans.context = myContext;
|
||||
Database::PdmSanitationInjuryKind injuryKindDb;
|
||||
for (const QString &kd : std::as_const(kind))
|
||||
{
|
||||
QStringList kde = kd.split(QStringLiteral(";"));
|
||||
if (kde.size() < 3 )
|
||||
continue;
|
||||
injuryKindDb.id = kde.at(0).toInt();
|
||||
injuryKindDb.name = kde.at(1);
|
||||
injuryKindDb.version = m_version;
|
||||
if(m_db->insert(injuryKindDb))
|
||||
{
|
||||
//Add Translation
|
||||
trans.id = 0;
|
||||
trans.key = injuryKindDb.name;
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.translation = kde.at(2);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = injuryKindDb.name;
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
}
|
||||
}
|
||||
//Place1
|
||||
//remove from DB
|
||||
myContext = QStringLiteral("SanitationInjuryPlace1");
|
||||
m_db->truncatePdmSanitationInjuryPlace1();
|
||||
idsToRemove.clear();
|
||||
for (const auto &tr : std::as_const(translations))
|
||||
{
|
||||
if (tr.context == myContext)
|
||||
idsToRemove.insert(tr.id);
|
||||
}
|
||||
|
||||
for (quint64 id : idsToRemove )
|
||||
{
|
||||
m_db->removePdmTranslation(id);
|
||||
}
|
||||
|
||||
//insert into db
|
||||
trans.context = myContext;
|
||||
Database::PdmSanitationInjuryPlace1 placeDb;
|
||||
for (const QString &place : std::as_const(place1))
|
||||
{
|
||||
QStringList pl = place.split(QStringLiteral(";"));
|
||||
if (pl.size() < 3 )
|
||||
continue;
|
||||
placeDb.id = pl.at(0).toInt();
|
||||
placeDb.name = pl.at(1);
|
||||
placeDb.version = m_version;
|
||||
if(m_db->insert(placeDb))
|
||||
{
|
||||
//Add Translation
|
||||
trans.id = 0;
|
||||
trans.key = placeDb.name;
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.translation = pl.at(2);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = placeDb.name;
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
}
|
||||
}
|
||||
|
||||
//Place2
|
||||
//remove from DB
|
||||
myContext = QStringLiteral("SanitationInjuryPlace2");
|
||||
m_db->truncatePdmSanitationInjuryPlace2();
|
||||
idsToRemove.clear();
|
||||
for (const auto &tr : std::as_const(translations))
|
||||
{
|
||||
if (tr.context == myContext)
|
||||
idsToRemove.insert(tr.id);
|
||||
}
|
||||
|
||||
for (quint64 id : idsToRemove )
|
||||
{
|
||||
m_db->removePdmTranslation(id);
|
||||
}
|
||||
|
||||
//insert into db
|
||||
trans.context = myContext;
|
||||
Database::PdmSanitationInjuryPlace2 place2Db;
|
||||
for (const QString &place : std::as_const(place2))
|
||||
{
|
||||
QStringList pl = place.split(QStringLiteral(";"));
|
||||
if (pl.size() < 3 )
|
||||
continue;
|
||||
place2Db.id = pl.at(0).toInt();
|
||||
place2Db.name = pl.at(1);
|
||||
place2Db.version = m_version;
|
||||
|
||||
if(m_db->insert(place2Db))
|
||||
{
|
||||
//Add Translation
|
||||
trans.id = 0;
|
||||
trans.key = place2Db.name;
|
||||
trans.disambiguation = QStringLiteral("name");
|
||||
trans.translation = pl.at(2);
|
||||
trans.isoCode = QStringLiteral("en_US");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.isoCode = QStringLiteral("en_GB");
|
||||
m_db->insert(trans);
|
||||
trans.id = 0;
|
||||
trans.translation = place2Db.name;
|
||||
trans.isoCode = QStringLiteral("de_DE");
|
||||
m_db->insert(trans);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PvSanImport::addInjuries(const QVector<QString> &injuries)
|
||||
{
|
||||
|
||||
if(injuries.isEmpty())
|
||||
return false;
|
||||
//check for DatabaseEntry with ID 1 and it's version
|
||||
QString myContext = QStringLiteral("SanitationInjury");
|
||||
Database::PdmTranslation trans;
|
||||
|
||||
//remove from DB
|
||||
m_db->truncatePdmSanitationInjury();
|
||||
|
||||
//insert into db
|
||||
trans.context = myContext;
|
||||
Database::PdmSanitationInjury injuryDb;
|
||||
int id = 1;
|
||||
for (const QString &injury : std::as_const(injuries))
|
||||
{
|
||||
QStringList kde = injury.split(QStringLiteral(";"));
|
||||
if (kde.size() < 29 )
|
||||
continue;
|
||||
if (kde.at(1).toInt() < 1)
|
||||
continue;
|
||||
injuryDb.id = id++;
|
||||
injuryDb.kind = kde.at(1).toInt();
|
||||
injuryDb.place1 = kde.at(2).toInt();
|
||||
injuryDb.place2 = kde.at(3).toInt();
|
||||
injuryDb.vbg = kde.at(4).toInt();
|
||||
injuryDb.name = kde.at(28) + QStringLiteral(" ") + kde.at(29);
|
||||
m_db->insert(injuryDb);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Handler to publish (project) static data to dds
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2017-07-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pdm_db.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include <string>
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
class PvSanImport
|
||||
{
|
||||
public:
|
||||
PvSanImport(const std::shared_ptr<DatabaseInterface> &db,
|
||||
NGL::INGLLogger &logger);
|
||||
private:
|
||||
qint64 getCode(const QString &type, int typeId);
|
||||
|
||||
bool publishDataPvSan();
|
||||
|
||||
|
||||
bool readFile(QVector<QString> &procedures, QVector<QString> &material,
|
||||
QVector<QString> &injuries, QVector<QString> &kind,
|
||||
QVector<QString> &place1, QVector<QString> &place2);
|
||||
|
||||
bool addProcedures(const QVector<QString> &procedures);
|
||||
bool addMaterial(const QVector<QString> &material);
|
||||
bool addInjuryPlaces(const QVector<QString> &kind, const QVector<QString> &place1, const QVector<QString> &place2);
|
||||
bool addInjuries(const QVector<QString> &injuries);
|
||||
|
||||
QString m_version;
|
||||
const std::shared_ptr<DatabaseInterface> &m_db;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace ProjectDataManagement
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
// Stub file for pdm - BUILD_RTI=OFF
|
||||
// Auto-generated stub to replace RTI IDL-generated code
|
||||
|
||||
#ifndef PDM_HPP
|
||||
#define PDM_HPP
|
||||
|
||||
#include "../pdm_enums_stub.hpp"
|
||||
#include "../pdm_stub.hpp"
|
||||
#include "../pdm_db_stub.hpp"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
// Forward declarations and stub types for ProjectDataManagement namespace
|
||||
// Used when BUILD_RTI=OFF to allow compilation without RTI Connext DDS
|
||||
|
||||
namespace ProjectDataManagement {
|
||||
|
||||
// Stub types for RTI IDL-generated classes
|
||||
struct RadioGroup {
|
||||
int m_id = 0;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
};
|
||||
|
||||
struct ChargeType {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct GearClass {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct GearType {
|
||||
int m_id = 0;
|
||||
int m_gearClassId = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
int gearClassId() const { return m_gearClassId; }
|
||||
void gearClassId(int val) { m_gearClassId = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct GearTypeChargeType {
|
||||
int m_id = 0;
|
||||
int m_gearTypeId = 0;
|
||||
int m_chargeTypeId = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
int gearTypeId() const { return m_gearTypeId; }
|
||||
void gearTypeId(int val) { m_gearTypeId = val; }
|
||||
int chargeTypeId() const { return m_chargeTypeId; }
|
||||
void chargeTypeId(int val) { m_chargeTypeId = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct BuildingChargeEffect {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct VulnerabilityKind {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct IgniterType {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct LoadType {
|
||||
int m_id = 0;
|
||||
QString m_properties;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString properties() const { return m_properties; }
|
||||
void properties(const QString& val) { m_properties = val; }
|
||||
};
|
||||
|
||||
struct CanComponentString {
|
||||
int m_id = 0;
|
||||
QString m_text;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString text() const { return m_text; }
|
||||
void text(const QString& val) { m_text = val; }
|
||||
};
|
||||
|
||||
struct BiteComponentText {
|
||||
int m_id = 0;
|
||||
QString m_text;
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString text() const { return m_text; }
|
||||
void text(const QString& val) { m_text = val; }
|
||||
};
|
||||
|
||||
struct SanitationProcedure {
|
||||
int m_id = 0;
|
||||
QString m_name;
|
||||
QString m_longName;
|
||||
QString m_type;
|
||||
int m_typeId = 0;
|
||||
int m_minimumQualification = 0;
|
||||
int m_dataCode = 0;
|
||||
QString m_version;
|
||||
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString name() const { return m_name; }
|
||||
void name(const QString& val) { m_name = val; }
|
||||
QString longName() const { return m_longName; }
|
||||
void longName(const QString& val) { m_longName = val; }
|
||||
QString type() const { return m_type; }
|
||||
void type(const QString& val) { m_type = val; }
|
||||
int typeId() const { return m_typeId; }
|
||||
void typeId(int val) { m_typeId = val; }
|
||||
int minimumQualification() const { return m_minimumQualification; }
|
||||
void minimumQualification(int val) { m_minimumQualification = val; }
|
||||
int dataCode() const { return m_dataCode; }
|
||||
void dataCode(int val) { m_dataCode = val; }
|
||||
QString version() const { return m_version; }
|
||||
void version(const QString& val) { m_version = val; }
|
||||
};
|
||||
|
||||
struct SanitationInjury {
|
||||
int m_id = 0;
|
||||
QString m_name;
|
||||
int m_kind = 0;
|
||||
int m_place1 = 0;
|
||||
int m_place2 = 0;
|
||||
int m_vbg = 0;
|
||||
|
||||
int id() const { return m_id; }
|
||||
void id(int val) { m_id = val; }
|
||||
QString name() const { return m_name; }
|
||||
void name(const QString& val) { m_name = val; }
|
||||
int kind() const { return m_kind; }
|
||||
void kind(int val) { m_kind = val; }
|
||||
int place1() const { return m_place1; }
|
||||
void place1(int val) { m_place1 = val; }
|
||||
int place2() const { return m_place2; }
|
||||
void place2(int val) { m_place2 = val; }
|
||||
int vbg() const { return m_vbg; }
|
||||
void vbg(int val) { m_vbg = val; }
|
||||
};
|
||||
|
||||
// Forward declaration for Interface::Dtc
|
||||
namespace Interface {
|
||||
class Dtc;
|
||||
}
|
||||
|
||||
} // namespace ProjectDataManagement
|
||||
|
||||
#endif // PDM_HPP
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// Stub file for pdm_db - BUILD_RTI=OFF
|
||||
// Auto-generated stub to replace RTI IDL-generated database code
|
||||
|
||||
#ifndef PDM_DB_STUB_HPP
|
||||
#define PDM_DB_STUB_HPP
|
||||
|
||||
#include "pdm_enums_stub.hpp"
|
||||
|
||||
namespace pdm {
|
||||
namespace db {
|
||||
|
||||
// Stub class to replace RTI IDL-generated database types
|
||||
class ProjectDatabase {
|
||||
public:
|
||||
virtual ~ProjectDatabase() = default;
|
||||
};
|
||||
|
||||
} // namespace db
|
||||
} // namespace pdm
|
||||
|
||||
#endif // PDM_DB_STUB_HPP
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Stub file for pdm_enums - BUILD_RTI=OFF
|
||||
// Auto-generated stub to replace RTI IDL-generated code
|
||||
|
||||
#ifndef PDM_ENUMS_STUB_HPP
|
||||
#define PDM_ENUMS_STUB_HPP
|
||||
|
||||
namespace pdm {
|
||||
namespace enums {
|
||||
|
||||
// Stub enums to replace RTI IDL-generated types
|
||||
enum class ProjectState : int {
|
||||
Unknown = 0
|
||||
};
|
||||
|
||||
enum class ProjectType : int {
|
||||
Unknown = 0
|
||||
};
|
||||
|
||||
enum class GearClass : int {
|
||||
Unknown = 0
|
||||
};
|
||||
|
||||
} // namespace enums
|
||||
} // namespace pdm
|
||||
|
||||
#endif // PDM_ENUMS_STUB_HPP
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// Stub file for pdm - BUILD_RTI=OFF
|
||||
// Auto-generated stub to replace RTI IDL-generated code
|
||||
|
||||
#ifndef PDM_STUB_HPP
|
||||
#define PDM_STUB_HPP
|
||||
|
||||
#include "pdm_enums_stub.hpp"
|
||||
|
||||
namespace pdm {
|
||||
|
||||
// Stub structs to replace RTI IDL-generated types
|
||||
struct ProjectData {
|
||||
int id = 0;
|
||||
};
|
||||
|
||||
struct ProjectConfig {
|
||||
int projectId = 0;
|
||||
};
|
||||
|
||||
} // namespace pdm
|
||||
|
||||
#endif // PDM_STUB_HPP
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* Load/Publish db-translations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "translation.h"
|
||||
#include <utility>
|
||||
#include "dds_handler.h"
|
||||
#include <QtCore/QTimer>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QCryptographicHash>
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
static const int s_translationBlobId = 1;
|
||||
|
||||
Translation::Translation(const std::shared_ptr<DdsHandler> &dds, const std::shared_ptr<DatabaseInterface> &db)
|
||||
: Interface::Fts::InsertUpdateTranslationRequestHandler(dds->fts())
|
||||
, m_dds(dds)
|
||||
, m_db(db)
|
||||
, m_logger(getLogger("Translation"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Translation ctor";
|
||||
m_publishTimer.setInterval(1000);
|
||||
m_publishTimer.setSingleShot(true);
|
||||
m_publishTimer.setTimerType(Qt::VeryCoarseTimer);
|
||||
connect(&m_publishTimer, &QTimer::timeout, this, &Translation::publishData);
|
||||
|
||||
QTimer::singleShot(1000, this, &Translation::collectAndPublishData);
|
||||
}
|
||||
|
||||
Translation::~Translation()
|
||||
{
|
||||
m_dds->dts()->removeTranslationBlobByKey(s_translationBlobId);
|
||||
}
|
||||
|
||||
void Translation::collectAndPublishData()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Collecting translation data";
|
||||
m_jsonData.clear();
|
||||
const auto cb = [this](const Database::PdmTranslation &data)
|
||||
{
|
||||
this->addToJson(data);
|
||||
};
|
||||
|
||||
if (!m_db->select(cb))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error fetching translations from db";
|
||||
return;
|
||||
}
|
||||
|
||||
publishData();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Collecting translation data - finished";
|
||||
}
|
||||
|
||||
void Translation::publishData()
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (const QJsonObject &obj : std::as_const(m_jsonData))
|
||||
arr += obj;
|
||||
|
||||
const QJsonObject jObj{ {QStringLiteral("translations"), arr} };
|
||||
const QByteArray data = QJsonDocument(jObj).toJson(QJsonDocument::Compact);
|
||||
const QByteArray compressed = qCompress(data, 9);
|
||||
const QByteArray md5Sum = QCryptographicHash::hash(compressed, QCryptographicHash::Md5).toHex();
|
||||
|
||||
INFO_LOG(m_logger) << "Created translation blob with " << arr.size() << " elements, size: " << compressed.size()
|
||||
<< " (uncompressed: " << data.size() << "), md5Sum: " << md5Sum;
|
||||
m_dds->dts()->publish(ProjectDataManagement::TranslationBlob(s_translationBlobId,
|
||||
LtsUtils::convert<std::vector<uint8_t>>(compressed),
|
||||
md5Sum.data()));
|
||||
}
|
||||
|
||||
static inline QJsonObject toJsonObject(const Database::PdmTranslation &data)
|
||||
{
|
||||
return QJsonObject({{QStringLiteral("isoCode"), data.isoCode},
|
||||
{QStringLiteral("context"), data.context},
|
||||
{QStringLiteral("key"), data.key},
|
||||
{QStringLiteral("disambiguation"), data.disambiguation},
|
||||
{QStringLiteral("translation"), data.translation}
|
||||
});
|
||||
}
|
||||
|
||||
void Translation::addToJson(const Database::PdmTranslation &data)
|
||||
{
|
||||
m_jsonData[data.id] = toJsonObject(data);
|
||||
}
|
||||
|
||||
void Translation::onInsertUpdateTranslationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const InsertUpdateTranslationRequest &request)
|
||||
{
|
||||
Database::PdmTranslation te;
|
||||
te.isoCode = QString::fromStdString(request.isoCode);
|
||||
te.context = QString::fromStdString(request.ctx);
|
||||
te.key = QString::fromStdString(request.key);
|
||||
te.disambiguation = QString::fromStdString(request.disambiguation);
|
||||
te.translation = QString::fromStdString(request.translation);
|
||||
|
||||
// not fast but also not really needed ...
|
||||
te.id = -1;
|
||||
auto end = m_jsonData.end();
|
||||
for (auto it = m_jsonData.begin(); it != end; ++it)
|
||||
{
|
||||
const QJsonObject &obj = it.value();
|
||||
if (obj.value(QStringLiteral("isoCode")).toString() == te.isoCode &&
|
||||
obj.value(QStringLiteral("context")).toString() == te.context &&
|
||||
obj.value(QStringLiteral("key")).toString() == te.key &&
|
||||
obj.value(QStringLiteral("disambiguation")).toString() == te.disambiguation)
|
||||
{
|
||||
te.id = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const bool bRet = (te.id > 0) ? m_db->insert(te) : m_db->update(te);
|
||||
Core::FunctionReplyObject fro(te.id);
|
||||
if (bRet)
|
||||
{
|
||||
addToJson(te);
|
||||
m_publishTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
fro = Core::FunctionReplyObject(te.id, tr_lts("dds", "Can not insert/update translation element"));
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
}
|
||||
m_dds->fts()->insertUpdateTranslationReply(cookie, fro);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Load/Publish db-translations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <ProjectDataManagement/pdm_db.h>
|
||||
#include <ProjectDataManagement/pdm_dts.h>
|
||||
#include <ProjectDataManagement/pdm_fts.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QJsonObject>
|
||||
#include <QtCore/QTimer>
|
||||
#include "logger.h"
|
||||
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
class DdsHandler;
|
||||
class Translation : public QObject,
|
||||
protected Interface::Fts::InsertUpdateTranslationRequestHandler
|
||||
{
|
||||
public:
|
||||
Translation(const std::shared_ptr<DdsHandler> &dds,
|
||||
const std::shared_ptr<ProjectDataManagement::DatabaseInterface> &db);
|
||||
~Translation();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void collectAndPublishData();
|
||||
void publishData();
|
||||
private:
|
||||
void addToJson(const Database::PdmTranslation &data);
|
||||
void onInsertUpdateTranslationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const InsertUpdateTranslationRequest &request) override;
|
||||
private:
|
||||
QHash<int, QJsonObject> m_jsonData;
|
||||
std::shared_ptr<DdsHandler> m_dds;
|
||||
std::shared_ptr<ProjectDataManagement::DatabaseInterface> m_db;
|
||||
QTimer m_publishTimer;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
## --------------------------------------------------------------------
|
||||
## $HeadURL$
|
||||
## --------------------------------------------------------------------
|
||||
##
|
||||
## Revision INFO:
|
||||
## --------------
|
||||
## $Revision$
|
||||
## $Date$
|
||||
## $Id$
|
||||
##
|
||||
##--------------------------------------------------------------------
|
||||
|
||||
# Alias fuers Wechseln ins LogDir
|
||||
alias ldir='cd `lts-config --query LogPath` '
|
||||
|
||||
# Alias fuer Testen der Prozesse
|
||||
alias cs='$HOME/bin/check_start'
|
||||
alias csp='$HOME/bin/check_start p'
|
||||
alias csn='$HOME/bin/check_start n'
|
||||
|
||||
alias sqlb='$HOME/bin/sqlbrowser'
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
|
||||
Abbr Service | Name (Namespace)
|
||||
-------------------------------------------------------------------
|
||||
AES | AreaEffectSimulation
|
||||
SCM | ServiceManagement
|
||||
ASM | AssetManagement
|
||||
AVM | AudioVideoManagement
|
||||
COD | CodificationManagement
|
||||
COM | CommunicatonManagement
|
||||
ESM | EffectShowManagement
|
||||
EVL | EvaluationManagement
|
||||
EVT | ExerciseEventManagement
|
||||
EXM | ExerciseManagement
|
||||
FLT | FilterManagement
|
||||
GIM | GuezIedManagement
|
||||
GMP | GuezMinelayerProcessing
|
||||
ISM | InfrastructureManagement
|
||||
LIC | LicenseManagement
|
||||
MRK | MarkerManagement
|
||||
MDM | MeteoDataManagement
|
||||
OBD | OcBaseDownload
|
||||
OCM | Observer/Controller Management
|
||||
OFC | OfficeManagement
|
||||
OSC | OcSituationClient
|
||||
OSS | OcSituationServer
|
||||
PDM | ProjectDataManagement
|
||||
PPM | ParticipantManagement
|
||||
PRE | PresentationManagement
|
||||
REC | RecordingManagement
|
||||
RPT | ReportManagement
|
||||
SBT | ShootBackTarget
|
||||
SIM | Simulated Players
|
||||
SRM | SituationReplayManagement
|
||||
SRP | SituationReplay
|
||||
THP | TakeHomePackage Management
|
||||
VOM | VideoOverlayManagement
|
||||
WMS | WarehouseManagement
|
||||
ZMB | ZombieManagement
|
||||
|
||||
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get domainId
|
||||
domainId=`lts-config --query DomainId`
|
||||
#domainId=$?
|
||||
|
||||
echo "Using domainId #${domainId}"
|
||||
cd ~/bin/
|
||||
|
||||
# ----------- Exercise independent ----------
|
||||
# Start Service Service Management (SCM)
|
||||
./svcServiceManagement -d ${domainId} -z
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
svcServiceManagement -s
|
||||
|
||||
exit
|
||||
+2
@@ -35,4 +35,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(CoPrtCnv
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../PrtCnv
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../PrtCnv
|
||||
)
|
||||
+2
-1
@@ -22,7 +22,8 @@ namespace N_LogView
|
||||
|
||||
|
||||
LogViewField::LogViewField(const QString& a_name, const E_FieldKind a_kind, const LogViewXdrElement* a_xdrElement)
|
||||
: m_Name(a_name),
|
||||
: m_logger(getLogger("LogViewField")),
|
||||
m_Name(a_name),
|
||||
m_IsRightAligned(false),
|
||||
m_Offset(0),
|
||||
m_Size(0),
|
||||
|
||||
+2
@@ -113,6 +113,8 @@ namespace N_LogView
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
QString m_Name;
|
||||
QString m_type;
|
||||
QStringList m_ValueList;
|
||||
|
||||
+5
-4
@@ -72,6 +72,7 @@ LogViewGui::LogViewGui(QWidget* a_parent)
|
||||
, m_InjectionThread(nullptr)
|
||||
, m_replayTimer(new QTimer(this))
|
||||
, m_currentReplayRow(-1)
|
||||
, m_logger(getLogger("LogViewGui"))
|
||||
{
|
||||
setWindowIcon(QIcon(QLatin1String(":icons/16x16/rde_16x16.png")));
|
||||
|
||||
@@ -655,10 +656,10 @@ void LogViewGui::updateLogfile()
|
||||
|
||||
QString filePath(fileInfo.absolutePath() + QLatin1Char('/'));
|
||||
const QString baseName = fileInfo.baseName();
|
||||
const QVector<QStringRef> parts = baseName.splitRef(QLatin1Char('_'));
|
||||
const QVector<QString> parts = baseName.split(QLatin1Char('_'));
|
||||
|
||||
for (int iterator = 0; iterator < parts.size() - 2; ++iterator)
|
||||
filePath += parts.at(iterator).toString() + QLatin1Char('_');
|
||||
filePath += parts.at(iterator) + QLatin1Char('_');
|
||||
|
||||
QString nextFile(filePath + nextDate + QLatin1Char('.') + fileInfo.completeSuffix());
|
||||
QString checkFile(filePath + checkDate + QLatin1Char('.') + fileInfo.completeSuffix());
|
||||
@@ -912,9 +913,9 @@ void LogViewGui::startInjectionThread()
|
||||
settings.beginGroup(QLatin1String("LogFiles"));
|
||||
QString filePath = settings.value(QLatin1String("Dir")).toString();
|
||||
QString exerciseName;
|
||||
QVector<QStringRef> parts = filePath.splitRef(QLatin1Char('/'));
|
||||
QVector<QString> parts = filePath.split(QLatin1Char('/'));
|
||||
if (parts.size() >= 2)
|
||||
exerciseName = QLatin1Char('_') + parts.at(parts.size() - 2).toString();
|
||||
exerciseName = QLatin1Char('_') + parts.at(parts.size() - 2);
|
||||
|
||||
QString portFilePath = QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("PrtCnv") + exerciseName + QLatin1String(".dat");
|
||||
QFileInfo checkPortFile(portFilePath);
|
||||
|
||||
+3
@@ -180,6 +180,9 @@ protected slots:
|
||||
|
||||
void onLogTelegramViewDoubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
private slots:
|
||||
void onSettingsChanged(uint32_t changedFlags);
|
||||
};
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@
|
||||
namespace N_LogView
|
||||
{
|
||||
LogViewInjectionThread::LogViewInjectionThread()
|
||||
: m_DoStartConnection(false)
|
||||
: m_logger(getLogger("LogViewInjectionThread"))
|
||||
, m_DoStartConnection(false)
|
||||
, m_SendingPossible(false)
|
||||
, m_Socket(nullptr)
|
||||
, m_Timer(nullptr)
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ namespace N_LogView
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_DoStartConnection;
|
||||
bool m_SendingPossible;
|
||||
QString m_Hostname;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ QVariant ParticipantModel::data(const QModelIndex &index, int role) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (role == Qt::BackgroundColorRole)
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if (p.first == 0)
|
||||
return QVariant();
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGui/QAbstractTableModel>
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <set>
|
||||
|
||||
+2
-1
@@ -25,11 +25,12 @@ namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
LogViewTabWidget::LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox)
|
||||
LogViewTabWidget::LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox, NGL::INGLLogger& logger)
|
||||
: QTabWidget(a_parent)
|
||||
, LogViewWidget(a_field, this, a_parent, false)
|
||||
, m_TelegramDialog(a_parent)
|
||||
, m_SpinBox(a_spinBox)
|
||||
, m_logger(logger)
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
+3
-1
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <QtWidgets/QTabWidget>
|
||||
#include "LogViewWidget.hpp"
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
namespace N_LogView
|
||||
@@ -29,7 +30,7 @@ namespace N_LogView
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox);
|
||||
LogViewTabWidget(LogViewField* a_field, LogViewTelegramDialog* a_parent, LogViewSpinBox* a_spinBox, NGL::INGLLogger& logger);
|
||||
|
||||
bool saveContent(LogViewTelegram* a_telegram) override;
|
||||
void addTab(LogViewField* a_field, const bool a_isEmpty, int arrayIdx);
|
||||
@@ -43,6 +44,7 @@ namespace N_LogView
|
||||
|
||||
LogViewTelegramDialog* m_TelegramDialog;
|
||||
LogViewSpinBox* m_SpinBox;
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -24,11 +24,12 @@ namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
LogViewTableWidget::LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly)
|
||||
LogViewTableWidget::LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly, NGL::INGLLogger& logger)
|
||||
: QTableWidget(0, 2, a_parent)
|
||||
, LogViewWidget(a_field, this, a_parent, a_readonly)
|
||||
, m_IsFloat(false)
|
||||
, m_IsEnum(false)
|
||||
, m_logger(logger)
|
||||
{
|
||||
switch (m_Field->xdrElement()->getKind())
|
||||
{
|
||||
|
||||
+3
-1
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <QTableWidget>
|
||||
#include "LogViewWidget.hpp"
|
||||
#include "logger.h"
|
||||
|
||||
namespace N_LogView
|
||||
{
|
||||
@@ -24,7 +25,7 @@ namespace N_LogView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly);
|
||||
LogViewTableWidget(LogViewField* a_field, QWidget* a_parent, const bool a_readonly, NGL::INGLLogger& logger);
|
||||
|
||||
|
||||
|
||||
@@ -42,5 +43,6 @@ namespace N_LogView
|
||||
private:
|
||||
bool m_IsFloat;
|
||||
bool m_IsEnum;
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
}
|
||||
+4
-1
@@ -73,6 +73,7 @@ LogViewTelegram::LogViewTelegram(const LogViewTelegram &o)
|
||||
, m_data(o.m_data)
|
||||
, m_json(o.m_json)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(o.m_logger)
|
||||
{
|
||||
if (!m_data.isEmpty())
|
||||
m_TetraTelegram = new N_CoPrtCnv::CoPrtCnvRadioTelegram(m_data);
|
||||
@@ -100,6 +101,7 @@ LogViewTelegram::LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnv
|
||||
, m_LogTime(0)
|
||||
, m_GpsTime(0)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(NGL::getLogger())
|
||||
{
|
||||
const uint32_t &waitTime = qgetenv("LogViewWaitTime").toUInt();
|
||||
if (waitTime > 0)
|
||||
@@ -143,6 +145,7 @@ LogViewTelegram::LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnv
|
||||
, m_GpsTime(0)
|
||||
, m_data(a_telegramData)
|
||||
, m_TetraTelegram(nullptr)
|
||||
, m_logger(NGL::getLogger())
|
||||
{
|
||||
const uint32_t &waitTime = qgetenv("LogViewWaitTime").toUInt();
|
||||
if (waitTime > 0)
|
||||
@@ -1630,7 +1633,7 @@ void LogViewTelegram::showMessageBox(const QString& a_errorText, const QString&
|
||||
QLatin1String("gesendete") : QLatin1String("gelesene"));
|
||||
QMessageBox::warning(QApplication::topLevelWidgets()[0], a_title,
|
||||
QString::fromUtf8("Das %5 Telegramm mit Protokoll %6 von %1 (Unix-Zeit: %2) und Länge %3 ist fehlerhaft:<br><br><b>%4</b>")
|
||||
.arg(dt.toString(Qt::SystemLocaleLongDate)).arg(logTimeSec).arg(m_data.size()).arg(a_errorText, destStr).arg(m_Protocol));
|
||||
.arg(dt.toString(Qt::TextDate)).arg(logTimeSec).arg(m_data.size()).arg(a_errorText, destStr).arg(m_Protocol));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
@@ -262,6 +262,7 @@ namespace N_LogView
|
||||
QJsonObject m_json;
|
||||
|
||||
N_CoPrtCnv::CoPrtCnvRadioTelegram *m_TetraTelegram;
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
LogViewField *getFieldTree(const QString& a_type, const QString& a_name,
|
||||
uint16_t a_arraySize, const LogViewXdrType* a_parentElement = nullptr,
|
||||
|
||||
+4
-3
@@ -47,9 +47,10 @@ namespace N_LogView
|
||||
|
||||
|
||||
|
||||
LogViewTelegramDialog::LogViewTelegramDialog(QWidget *a_parent, const bool a_readonly)
|
||||
LogViewTelegramDialog::LogViewTelegramDialog(QWidget *a_parent, const bool a_readonly, NGL::INGLLogger& logger)
|
||||
: QDialog(a_parent)
|
||||
, m_ReadOnly(a_readonly)
|
||||
, m_logger(logger)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
@@ -417,7 +418,7 @@ void LogViewTelegramDialog::showEditField(LogViewField *a_logViewField, QGridLay
|
||||
}
|
||||
|
||||
|
||||
LogViewTableWidget *tableWidget = new LogViewTableWidget(a_logViewField, this, m_ReadOnly);
|
||||
LogViewTableWidget *tableWidget = new LogViewTableWidget(a_logViewField, this, m_ReadOnly, m_logger);
|
||||
m_EditInfoList.push_back(tableWidget);
|
||||
a_box->addWidget(tableWidget, a_box->rowCount(), 0, 1, 2);
|
||||
|
||||
@@ -446,7 +447,7 @@ void LogViewTelegramDialog::showTab(LogViewField *a_logViewField, QGridLayout *a
|
||||
a_box->addWidget(spinBox, a_box->rowCount() - 1, 1);
|
||||
}
|
||||
|
||||
LogViewTabWidget *a_tabWidget = new LogViewTabWidget(a_logViewField, this, spinBox);
|
||||
LogViewTabWidget *a_tabWidget = new LogViewTabWidget(a_logViewField, this, spinBox, m_logger);
|
||||
m_EditInfoList.push_back(dynamic_cast<LogViewWidget *>(a_tabWidget));
|
||||
a_box->addWidget(a_tabWidget, a_box->rowCount(), 0, 1, 2);
|
||||
|
||||
|
||||
+2
-1
@@ -35,7 +35,7 @@ class LogViewTelegramDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LogViewTelegramDialog(QWidget *a_parent = nullptr, const bool a_readonly = true);
|
||||
explicit LogViewTelegramDialog(QWidget *a_parent = nullptr, const bool a_readonly = true, NGL::INGLLogger& logger = NGL::getLogger());
|
||||
|
||||
void showDialog(const QSharedPointer<LogViewTelegram> &a_telegram);
|
||||
void showDataDump(const QSharedPointer<LogViewTelegram> &a_telegram, bool showErrorMessage);
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
QLineEdit *m_NameEdit = nullptr;
|
||||
QLineEdit *m_WaitTimeEdit = nullptr;
|
||||
bool m_ReadOnly = false;
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+1
@@ -43,6 +43,7 @@ QString TelegramEdit::s_TELEGRAMLIST_FILES()
|
||||
|
||||
TelegramEdit::TelegramEdit(QWidget *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(getLogger("LogViewTelegramEdit"))
|
||||
, m_addTeleAction(new QAction(QIcon(QLatin1String(":icons/16x16/list-add.png")), tr("Add Telegram"), this))
|
||||
, m_editTeleAction(new QAction(QIcon(QLatin1String(":/image/Edit.png")), tr("Edit Telegram"), this))
|
||||
, m_copyTeleAction(new QAction(QIcon(QLatin1String(":icons/16x16/edit-copy.png")), tr("Copy Telegram"), this))
|
||||
|
||||
+4
-1
@@ -4,7 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "LogViewTelegram.hpp"
|
||||
#include <QtGui/QModelIndex>
|
||||
#include "logger.h"
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
class QAction;
|
||||
class QTableView;
|
||||
@@ -60,6 +61,8 @@ protected:
|
||||
int m_curEditTelegramRow;
|
||||
|
||||
TelegramEditModel *m_EditModel;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
static QString s_DIR();
|
||||
static QString s_EDIT_TELEGRAM_GROUP();
|
||||
static QString s_TELEGRAMLIST_FILE_ID();
|
||||
|
||||
+35
-34
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QStringView>
|
||||
|
||||
namespace N_LogView
|
||||
{
|
||||
@@ -87,16 +88,16 @@ bool LogViewTetraTelegramsParser::parse(const QString &filename)
|
||||
const QString content = QString::fromUtf8(f.readAll());
|
||||
f.close();
|
||||
|
||||
const QVector<QStringRef> lines = content.splitRef(QLatin1Char('\n'));
|
||||
QVector<QStringRef> linesTrimmed;
|
||||
const QVector<QStringView> lines = content.splitView(QLatin1Char('\n'));
|
||||
QVector<QStringView> linesTrimmed;
|
||||
linesTrimmed.reserve(lines.size());
|
||||
for (const QStringRef &line : lines)
|
||||
for (const QStringView &line : lines)
|
||||
linesTrimmed += line.trimmed();
|
||||
|
||||
int i = 0;
|
||||
while (i < linesTrimmed.size())
|
||||
{
|
||||
const QStringRef &line = linesTrimmed.at(i);
|
||||
const QStringView &line = linesTrimmed.at(i);
|
||||
if (line.startsWith(QLatin1String("struct")))
|
||||
{
|
||||
i = parseStruct(linesTrimmed, i);
|
||||
@@ -136,12 +137,12 @@ void LogViewTetraTelegramsParser::insertPod(const QString &type, int byteLen, bo
|
||||
}
|
||||
|
||||
|
||||
int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, int iStartPos)
|
||||
int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringView> &lines, int iStartPos)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() < 2)
|
||||
return -1;
|
||||
const QStringRef &structType = tokens.at(1);
|
||||
const QStringView &structType = tokens.at(1);
|
||||
if (structType.endsWith(QLatin1Char(';')))
|
||||
return iStartPos;
|
||||
|
||||
@@ -162,7 +163,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
WARNING_LOG(m_logger) << "Could not parse struct: '" << lines.at(iStartPos).toString() << "', line: " << iStartPos + 1;
|
||||
return -1;
|
||||
}
|
||||
QStringRef base = tokens.at(i);
|
||||
QStringView base = tokens.at(i);
|
||||
if (base == QLatin1String("public") ||
|
||||
base == QLatin1String("protected") ||
|
||||
base == QLatin1String("private"))
|
||||
@@ -181,7 +182,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i));
|
||||
if (!validStructTokens(tokens))
|
||||
{
|
||||
++i;
|
||||
@@ -204,15 +205,15 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
const int parserCommentPos = tokens.at(2) == QLatin1String("=") ? 4 : 2;
|
||||
if (tokens.size() > parserCommentPos)
|
||||
{
|
||||
const QStringRef &comment = tokens.at(parserCommentPos);
|
||||
const QStringView &comment = tokens.at(parserCommentPos);
|
||||
DEBUG_LOG(m_logger) << "comment: " << comment.toString();
|
||||
if (comment.startsWith(QLatin1String("//@array: ")))
|
||||
{
|
||||
const QStringRef hint = comment.mid(QLatin1String("//@array: ").size());
|
||||
const QStringView hint = comment.mid(QLatin1String("//@array: ").size());
|
||||
QString structStr = QLatin1String("struct ") + si.type + QLatin1String("::") + tokens.at(0).toString() + QLatin1Char('\n') + hint.toString();
|
||||
structStr.replace(QLatin1Char(';'), QLatin1String(";\n"));
|
||||
DEBUG_LOG(m_logger) << "structStr: " << structStr;
|
||||
parseStruct(structStr.splitRef(QLatin1Char('\n')), 0);
|
||||
parseStruct(structStr.splitView(QLatin1Char('\n')), 0);
|
||||
|
||||
mi.type = si.type + QLatin1String("::") + tokens.at(0).toString();
|
||||
mi.isArray = true;
|
||||
@@ -222,7 +223,7 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
}
|
||||
}
|
||||
|
||||
QStringRef name = tokens.at(1);
|
||||
QStringView name = tokens.at(1);
|
||||
if (name.endsWith(QLatin1Char(';')))
|
||||
name.chop(1);
|
||||
if (mi.type.isEmpty())
|
||||
@@ -265,12 +266,12 @@ int LogViewTetraTelegramsParser::parseStruct(const QVector<QStringRef> &lines, i
|
||||
return i;
|
||||
}
|
||||
|
||||
int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int iStartPos, const QString &ns, StructInformation *si)
|
||||
int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringView> &lines, int iStartPos, const QString &ns, StructInformation *si)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() < 2)
|
||||
return -1;
|
||||
QStringRef enumName = tokens.at(1);
|
||||
QStringView enumName = tokens.at(1);
|
||||
if (enumName == QLatin1String("class"))
|
||||
{
|
||||
if (tokens.size() < 3)
|
||||
@@ -287,7 +288,7 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i).split(QStringLiteral("//")).first());
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i).split(QStringLiteral("//")).first());
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")))
|
||||
{
|
||||
@@ -320,7 +321,7 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
ev.key = tokens.at(0).toString();
|
||||
if (tokens.size() == 3)
|
||||
{
|
||||
QStringRef value = tokens.at(2);
|
||||
QStringView value = tokens.at(2);
|
||||
if (value.endsWith(QLatin1Char(',')))
|
||||
value.chop(1);
|
||||
ev.value = value.toInt();
|
||||
@@ -346,28 +347,28 @@ int LogViewTetraTelegramsParser::parseEnum(const QVector<QStringRef> &lines, int
|
||||
return i;
|
||||
}
|
||||
|
||||
int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringRef> &lines, int iStartPos)
|
||||
int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringView> &lines, int iStartPos)
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(iStartPos));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(iStartPos));
|
||||
if (tokens.size() != 4)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(iStartPos).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
const QStringRef &cs = tokens.at(3);
|
||||
const QStringView &cs = tokens.at(3);
|
||||
if (!cs.startsWith(QLatin1String("Constraints<")) || !cs.endsWith(QLatin1Char('>')))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(iStartPos).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
QStringRef structName = cs.mid(QLatin1String("Constraints<").size());
|
||||
QStringView structName = cs.mid(QLatin1String("Constraints<").size());
|
||||
structName.chop(1);
|
||||
DEBUG_LOG(m_logger) << "Constraint: " << structName.toString();
|
||||
|
||||
int i = iStartPos + 1;
|
||||
while (i < lines.size())
|
||||
{
|
||||
const QVector<QStringRef> tokens = tokenize(lines.at(i));
|
||||
const QVector<QStringView> tokens = tokenize(lines.at(i));
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")))
|
||||
{
|
||||
@@ -381,14 +382,14 @@ int LogViewTetraTelegramsParser::parseConstraint(const QVector<QStringRef> &line
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
const QVector<QStringRef> parts = tokens.at(6).split(QLatin1String("::"));
|
||||
const QVector<QStringView> parts = tokens.at(6).split(QLatin1String("::"));
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not parse constraint: '" << lines.at(i).toString() << "'";
|
||||
return -1;
|
||||
}
|
||||
|
||||
QStringRef enumKey = parts.at(1);
|
||||
QStringView enumKey = parts.at(1);
|
||||
if (enumKey.endsWith(QLatin1Char(';')))
|
||||
enumKey.chop(1);
|
||||
bool bFound = false;
|
||||
@@ -434,7 +435,7 @@ void LogViewTetraTelegramsParser::categorizeMember(MemberInformation &mi) const
|
||||
mi.isBinary = (mi.type == QLatin1String("std::vector<unsigned char>") || mi.type == QLatin1String("QByteArray"));
|
||||
}
|
||||
|
||||
static inline void bracketCount(const QStringRef &str, int &cntLt, int &cntGt)
|
||||
static inline void bracketCount(const QStringView &str, int &cntLt, int &cntGt)
|
||||
{
|
||||
cntLt = 0;
|
||||
cntGt = 0;
|
||||
@@ -447,20 +448,20 @@ static inline void bracketCount(const QStringRef &str, int &cntLt, int &cntGt)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line) const
|
||||
QVector<QStringView> LogViewTetraTelegramsParser::tokenize(const QStringView &line) const
|
||||
{
|
||||
QVector<QStringRef> ret = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
QVector<QStringView> ret = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
int i = 0;
|
||||
while (i < ret.size())
|
||||
{
|
||||
const QStringRef &token = ret.at(i);
|
||||
const QStringView &token = ret.at(i);
|
||||
if (token.startsWith(QLatin1String("//")))
|
||||
{
|
||||
|
||||
if (i == ret.size() - 1)
|
||||
break;
|
||||
const QStringRef &lastToken = ret.last();
|
||||
const QStringRef newToken = QStringRef(token.string(), token.position(), lastToken.position() - token.position() + lastToken.size());
|
||||
const QStringView &lastToken = ret.last();
|
||||
const QStringView newToken = line.mid(token.position(), lastToken.position() - token.position() + lastToken.size());
|
||||
DEBUG_LOG(m_logger) << "New Token: " << newToken.toString();
|
||||
ret.resize(i + 1);
|
||||
ret[i] = newToken;
|
||||
@@ -476,8 +477,8 @@ QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
const QStringRef &nextToken = ret.at(i + 1);
|
||||
const QStringRef newToken = QStringRef(token.string(), token.position(), nextToken.position() - token.position() + nextToken.size());
|
||||
const QStringView &nextToken = ret.at(i + 1);
|
||||
const QStringView newToken = line.mid(token.position(), nextToken.position() - token.position() + nextToken.size());
|
||||
DEBUG_LOG(m_logger) << "New Token: " << newToken.toString();
|
||||
ret.removeAt(i + 1);
|
||||
ret[i] = newToken;
|
||||
@@ -486,7 +487,7 @@ QVector<QStringRef> LogViewTetraTelegramsParser::tokenize(const QStringRef &line
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LogViewTetraTelegramsParser::validStructTokens(const QVector<QStringRef> &tokens)
|
||||
bool LogViewTetraTelegramsParser::validStructTokens(const QVector<QStringView> &tokens)
|
||||
{
|
||||
if (tokens.isEmpty() ||
|
||||
(tokens.at(0) == QLatin1String("{")) ||
|
||||
|
||||
+7
-5
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringView>
|
||||
#include <QtCore/QVector>
|
||||
#include "logger.h"
|
||||
|
||||
@@ -72,17 +73,18 @@ public:
|
||||
static QString getInnerType(const QString &type);
|
||||
private:
|
||||
void insertPod(const QString &type, int byteLen, bool isSigned, bool isIntegral, bool isBoolean = false);
|
||||
int parseStruct(const QVector<QStringRef> &lines, int iStartPos);
|
||||
int parseEnum(const QVector<QStringRef> &lines, int iStartPos, const QString &ns, StructInformation *si = nullptr);
|
||||
int parseConstraint(const QVector<QStringRef> &lines, int iStartPos);
|
||||
int parseStruct(const QVector<QStringView> &lines, int iStartPos);
|
||||
int parseEnum(const QVector<QStringView> &lines, int iStartPos, const QString &ns, StructInformation *si = nullptr);
|
||||
int parseConstraint(const QVector<QStringView> &lines, int iStartPos);
|
||||
void categorizeMember(MemberInformation &mi) const;
|
||||
QVector<QStringRef> tokenize(const QStringRef &line) const;
|
||||
static bool validStructTokens(const QVector<QStringRef> &tokens);
|
||||
QVector<QStringView> tokenize(QStringView line) const;
|
||||
static bool validStructTokens(const QVector<QStringView> &tokens);
|
||||
private:
|
||||
EnumInformation m_telegramIdEnum;
|
||||
QVector<EnumInformation> m_enums;
|
||||
QHash<QString, StructInformation> m_structs;
|
||||
QHash<QString, PodInformation> m_pods;
|
||||
QHash<int, QString> m_visibleTelegrams;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+2
-2
@@ -317,8 +317,8 @@ void LogViewXdrParser::parseDefine(const QString &a_line)
|
||||
int sepPos = line.indexOf(QLatin1Char(' '));
|
||||
if (sepPos >= 0)
|
||||
{
|
||||
const QString name = line.leftRef(sepPos).trimmed().toString();
|
||||
QStringRef substitution = line.midRef(sepPos).trimmed();
|
||||
const QString name = line.left(sepPos).trimmed();
|
||||
QStringView substitution = line.mid(sepPos).trimmed();
|
||||
sepPos = substitution.indexOf(QLatin1Char(' '));
|
||||
if (sepPos >= 0)
|
||||
substitution = substitution.left(sepPos).trimmed();
|
||||
|
||||
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user