Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.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

123 lines
2.7 KiB
C++

#pragma once
#ifdef BUILD_RTI
#include <DDS/Core/core_ftc.h>
#include <LtsSession/ltssession_export.h>
#include <LtsWidgets/lts_dialog.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QPointer>
#include <memory>
/*
Anmerkungen:
slotTryLock
-> slotTryLock
-> tryLockEntityRequest
<- onTryLockEntityReply
emit signalLockDialog | emit signalUnlockDialog
PpmGuiPlugin:
- ParticipantOrganisationDialog (asSupportService==false)
a) avoid disabling by overloading ::lock() -> yes
b) use tryLockTopicNew -> yes
- ParticipantEdit (asSupportService==false||true)
a) avoid disabling by overloading ::lock() -> yes
b) use tryLockTopicNew -> yes
3 TacticalOrganisation
-> left and right <-
onReinitLeft, onReinitRight
*/
namespace LtsSession
{
class LTSSESSION_EXPORT TopicLockHandler : public QObject
{
Q_OBJECT
public:
TopicLockHandler();
~TopicLockHandler();
bool init(const std::shared_ptr<Core::Interface::Ftc>& coreFtc, int exerciseId);
bool isLocked() const
{
return m_locked;
}
LtsWidgets::TopicInfo getTopicInfo() const
{
return m_topicInfo;
}
public slots:
void slotTryLock(const LtsWidgets::TopicInfo& topicInfo);
bool slotUnlock();
void slotFinalize(); // unlock, finally delete
signals:
void signalLockDialog(const QString& lockedBy);
void signalUnlockDialog();
private:
bool lock();
bool unlock();
std::string objStateAsString() const;
std::shared_ptr<Core::Interface::Ftc> m_coreFtc;
LtsWidgets::TopicInfo m_topicInfo;
int m_lockEntityId{0}; // reply.id(); / set by reply of ddsCall
int m_exerciseId{0};
bool m_locked{false};
bool m_askedForLock{false}; // reply does not tell..
bool m_deleteAfterAnswer{false};
NGL::INGLLogger& m_logger;
};
class LTSSESSION_EXPORT TopicLockHanderData : public QObject
{
Q_OBJECT
public:
TopicLockHanderData();
~TopicLockHanderData();
void init(const std::shared_ptr<Core::Interface::Ftc>& coreFtc, int exerciseId);
void unlock();
void slotTryLock(const LtsWidgets::TopicInfo& topicInfo);
bool isLocked() const;
LtsWidgets::TopicInfo getTopicInfo() const;
const QString& getLockedBy() const
{
return m_lockedBy;
}
Q_SIGNALS:
void lockDataChanged();
private Q_SLOTS:
void slotLock(const QString& lockedBy);
void slotUnlock();
public:
QString m_debugName;
private:
QPointer<TopicLockHandler> m_topicLockHandler;
QString m_lockedBy;
};
} // namespace LtsSession
#else // BUILD_RTI
#include "lts_session_lock_handler_stub.h"
#endif // BUILD_RTI