Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/asset_assignment_manager.h
T
torstenandCopilot b774f4035c Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung
- 44 Export-Header Include-Pfade korrigiert (_export.h)
- 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h)
- INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros
- Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits)
- FATAL_LOG Makro hinzugefügt
- InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h)
- FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h)
- AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp)
- SymbolAppearance Klasse vollständig definiert mit content() Methode
- BuildingComponentFilter Klasse definiert mit Copy-Konstruktor
- Ftc Factory: nullptr Return (abstract class)
- AesFilter Klasse in aes.hpp hinzugefügt
- Dtc Klasse in ppm.hpp mit participantChanged Signal
- AesType Enum: alle 15 At* Werte definiert
- AesEffectState_def: EsReceived hinzugefügt
- DataModification Enum: eAdded/eModified/eRemoved
- function_reply_object.h → core_types.h Include-Pfad (72 Dateien)
- Enum-Class-Streaming Template-Operator in INGLLogger.h
- ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen
- ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge
- QRegExp → QRegularExpression in tpm_js_parser.cpp
- .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert
- Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h

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

149 lines
5.2 KiB
C++
Executable File

/**
* @RDE_HEADER@
* InfrastructureBuilder
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Fröbel, SLSE, 2017-11-29
*/
#pragma once
#include "exercise_context.h"
#include "svcavmcommon_export.h"
#include "logger.h"
#include <QObject>
#include <boost/optional.hpp>
#include <map>
#include <set>
#include <memory>
#include <utility>
namespace InfrastructureManagement
{
class MainStructureElement;
class StructureElement;
class MountingPointAsset;
class InstrumentationAsset;
namespace Interface
{
class Dtc;
}
} // namespace InfrastructureManagement
enum class DataModification;
namespace AudioVideoManagement
{
class Exercise;
class Asset;
class MountingPoint;
/**
* The AssetAssignmentManager keeps track of whether an Asset is assigned to an Exercise or not.
* In AVM we're usually only interested in Assets that are Cameras or AnnouncementUnits.
* But here we keep track of all Assets and MountingPoints as this makes it easier
* to keep the data model consistent.
*
* There are two aspects:
* 1. An Asset can be mounted
* 2. The MountingPoint the Asset is mounted on can be assigned to an Exercise or not.
*
* From AVM perspective we're only interested in the fact of whether an Asset is assigned
* to an exercise or not.
*
* The difficulty here is to keep the data model consistent despite the fact that
* the data published on DDS has no defined ordering.
*
* The idea here is to have containers for Assets (and MountingPoints): an Exercise.
* There exists a "pool" Exercise where all Assets (and MountingPoints) reside that are
* not assigned to an Exercise.
* And there are concrete Exercise-containers for all existing Exercises.
* An Asset (and MountingPoint) will only be moved from the pool Exercise to the concrete
* Exercise if and only if the Asset is mounted and assigned to an Exercise.
*
* Mounting and Assigning are two distinct steps.
* Mounting only affects the mounting relation of Asset and MountingPoint but does not move
* the Asset (and MountingPoint). Thus the Mounting (and Unmounting) always happens in the pool Exercise.
* Assignment can only take place when the Asset is mounted. Assignment then moves the
* Asset (and MountingPoint) to the concrete Exercise.
*
* An Asset can be reassigned from one Exercise to another Exercise. This happens
* when the MountingPoint is reassigned while the Asset is mounted.
*
* @author Christian Fröbel
*/
class AVM_COMMON_EXPORT AssetAssignmentManager : public QObject
{
Q_OBJECT
public:
/** Creates *and* connects the relevant signals. */
static AssetAssignmentManager *create(InfrastructureManagement::Interface::Dtc *ismDtc);
/** Don't use! Use create() instead. Only provided to be used in UnitTests. */
AssetAssignmentManager();
~AssetAssignmentManager();
/**
* Implicitly creates an Exercise if it does not yet exist.
* The AssetAssignmentManager keeps ownership.
*/
Exercise *exercise(int id);
/** Called by the ExercisesHandler after the corresponding ExerciseHandler was removed. */
void removeExercise(int id);
/** For UnitTests only. */
bool hasPending() const;
public slots: // public only for use in UnitTests
void onAssetChanged(const InfrastructureManagement::InstrumentationAsset &asset, DataModification modType);
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onMountingChanged(const InfrastructureManagement::MountingPointAsset &mount, DataModification modType);
private:
void addAsset(const InfrastructureManagement::InstrumentationAsset &asset);
void modifyAsset(const InfrastructureManagement::InstrumentationAsset &asset);
void removeAsset(const InfrastructureManagement::InstrumentationAsset &asset);
void tryAssignAsset(Asset *asset, Exercise *currentExercise, Exercise *targetExercise, const boost::optional<InfrastructureManagement::InstrumentationAsset> &modifiedData);
void unassignAsset(Asset *asset, Exercise *exercise, const boost::optional<InfrastructureManagement::InstrumentationAsset> &modifiedData);
void addMount(const InfrastructureManagement::MountingPointAsset &mount);
void removeMount(const InfrastructureManagement::MountingPointAsset &mount);
void tryUnmount(Asset *asset, Exercise *exercise = nullptr);
void processPendingModifications();
void processPendingUnmounts();
void processPendingMounts();
void processPendingRemoves();
template<class Container, class Function>
void processPending(Container &pendingSource, Function f);
bool hasPendingModifications(int assetId);
void logPending();
Exercise *pool() const;
std::pair<Exercise *, Asset *> findAsset(int id);
std::pair<Exercise *, MountingPoint *> findMountingPoint(int id);
private:
std::map<ExerciseContext, std::unique_ptr<Exercise>> m_exercises;
std::vector<InfrastructureManagement::InstrumentationAsset> m_pendingModifications;
std::vector<Asset *> m_pendingUnmounts;
std::vector<InfrastructureManagement::MountingPointAsset> m_pendingMounts;
std::vector<InfrastructureManagement::InstrumentationAsset> m_pendingRemoves;
LOGGER_T m_logger;
};
} // namespace AudioVideoManagement