Files
qt5-legatus-legacy/Lts/Plugins/InfrastructureManagement/Data/ism_foreign_data_plugin.h
T
2026-08-13 18:33:10 +02:00

78 lines
2.4 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Data Plugin for InfrastructureManagement
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-08-24
*/
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <QHash>
#include <QSet>
#include <QMutex>
namespace InfrastructureManagement
{
class ForeignInterfaceImpl final : public ForeignDataInterface
{
Q_OBJECT
public:
explicit ForeignInterfaceImpl(const std::shared_ptr<Interface::Dtc> &dtc, int exerciseId = -1);
~ForeignInterfaceImpl();
// lazy-initialisation: // is called at beginning of every access method
void enableIsmForeignInterface() const;
// mainStructureElements (buildings)
//@{
bool mountingPoints(const std::function<void (const MountingPoint &)> &cb) override final;
bool mountingPoints(const std::function<bool(const MountingPoint &data)> &cb) override final;
QHash<int32_t, MountingPoint> mountingPoints() const override final;
MountingPoint mountingPoint(int32_t mountingPointId) const override final;
//@}
// mainSchedule
//@{
MainSchedule mainSchedule(int32_t scheduleId) override final;
void setScheduleId(int32_t scheduleId) override final;
int32_t scheduleId() const override final;
//@}
// buildings in current exercise
//@{
QSet<int> buildingsInCurrentExercise() override final;
const QSet<int>& buildingsInCurrentExercise() const override final;
bool isBuildingsInCurrentExercise(int buildingId) const override final;
//@}
private Q_SLOTS:
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType);
void onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType);
private: // methods
void init();
private: // attributes
std::shared_ptr<Interface::Dtc> m_dtc;
QMutex m_mutex;
QHash<int32_t, MountingPoint> m_mountingPoints; // By SeId
QHash<int32_t, int32_t> m_mountingPointAssetMap; // key: structureElementId/mountingPointId - value: assetId
QSet<int> m_bldgsInExcersise; // All Buildings avaiable in this Exercise
int32_t m_scheduleId;
int32_t m_exerciseId{-1};
NGL::INGLLogger &m_logger;
};
} // namespace InfrastructureManagement