Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWebSocket/data_manager_base_dl.h
T
torstenandCopilot d6b6ffce7c Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files)
- Formatted LtsAppDescriptor module files
- Formatted LtsAppManager/AppChooser files
- Applied clang-format to all DTC and enum headers across modules
- Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/)

Cosmetic changes only, no functional modifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 14:46:29 +02:00

41 lines
1.0 KiB
C++

#pragma once
#include "reply_message.h"
#include <NGLLogger/INGLLogger.h>
#include <memory>
namespace LtsWebSocket
{
template <typename T> class DataManagerBaseDl
{
protected:
explicit DataManagerBaseDl(const std::shared_ptr<T>& dbInterface, NGL::INGLLogger& logger)
: m_logger(logger), m_dbInterface(dbInterface)
{
}
template <typename DbType, typename MessageType> ReplyMessage* toBaseDataMessageFromDb(const QString& uuid) const
{
QVector<DbType> dataVec;
if (!m_dbInterface->select(dataVec))
{
const QString errorMessage = QStringLiteral("Error reading data from database!");
ERROR_LOG(m_logger) << errorMessage;
ErrorMessage::ErrorData errData;
errData.errorMessage = errorMessage;
errData.uuid = uuid;
return new ErrorMessage(errData);
}
return new MessageType(m_dbInterface->template toJson<DbType>(dataVec), uuid);
}
protected:
std::shared_ptr<T> m_dbInterface;
};
} // namespace LtsWebSocket