Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/OperatorManagement/handler_locked_topics.h
T
torstenandCopilot d5af8b9764 Session 026: Lts/Services Qt5:: to Qt6:: migration
- Migrated all 104 CMakeLists.txt files in Lts/Services
- Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg,
  Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test,
  Qt5::SerialPort with Qt6:: equivalents
- 1244 files modified (CMakeLists.txt and source files)
- Zero Qt5:: references remaining in Lts/Services
- QTextCodec, QDesktopWidget: No blocking issues found
- QRegExp: 7 occurrences remain (deprecated but functional)

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

69 lines
2.3 KiB
C++
Executable File

/**
* Block/unblock topics
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2018-01-15
*/
#pragma once
#include <QObject>
#include "logger.h"
#include "opm_db.h"
#include <DDS/Core/core_fts_types.h>
#include <DDS/Core/core_dts_types.h>
#include <DDS/Core/topic_lock_master.h>
#include <DDS/DTS/generic_dts_impl.h>
#include <DDS/FTS/generic_fts_impl.h>
namespace OperatorManagement
{
class MainHandler;
class HandlerLockedTopics final : public QObject
{
Q_OBJECT
public:
explicit HandlerLockedTopics(MainHandler &mainHandler,
QObject *parent = nullptr);
bool init();
void operatorLoggedIn(int operatorId, int workstationId) { operatorLoggedInOut(operatorId, workstationId); }
void operatorLoggedOut(int operatorId) { operatorLoggedInOut(operatorId, 0); }
private:
// we logged out - unlock all still locked topics (workstationId should be zero then)
// we logged in again - unlock all still locked topics which are not for current workstation
void operatorLoggedInOut(int operatorId, int workstationId);
/// Lock
void onTryLockEntityRequest(const rti::core::SampleIdentity &cookie, const Core::TryLockEntityRequest &request);
Core::TryLockEntityReply tryLock(const Core::TryLockEntityRequest &request);
//Core::TryLockEntityReply tryLockModify(const Core::TryLockEntityRequest &request);
/// Unlock
void onTryUnlockEntityRequest(const rti::core::SampleIdentity &cookie, const Core::TryUnlockEntityRequest &request);
Core::FunctionReply tryUnlock(const Core::TryUnlockEntityRequest &request);
//bool removeReleaseOutdatedLock(int topicId);
void unlockInDb(const Database::OpmLockedTopics &data);
static Database::OpmLockedTopics toDb(const Core::LockedEntityBase &request);
bool publishLockedEntity(const Core::LockedEntity &entity);
bool removeLockedEntity(int64_t id);
//Core::key topicIdToKey(long id);
void dumpLockedTopics(int line);
private:
QHash<Core::key, Database::OpmLockedTopics> m_lockedTopics;
MainHandler &m_mainHandler;
std::shared_ptr<DatabaseInterface> m_db;
std::unique_ptr<FTS::TryLockEntity> m_ftsTryLockEntity;
std::unique_ptr<FTS::TryUnlockEntity>m_ftsTryUnlockEntity;
std::unique_ptr<DTS::LockedEntity> m_dtsLockedEntity;
LOGGER_T m_logger;
};
} // namespace OperatorManagement