Files
qt-migration-legatus/qt5-before/dlbo/Lts/Viewer/SituationMap/Map/object_container.h
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

205 lines
4.8 KiB
C++

/**
* @RDE_HEADER@
* Interface for Storing of MapObjects
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "abstract_map_object.h"
#include <Common/situation_map_logging.h>
// Qt
#include <QMap>
#include <QSharedPointer>
#include <typeindex>
//----------------------------------------------------------------------------
namespace SituationMap
{
//forward
template<class> class RefPointer;
/**
* @brief The IdGenerator class generates a new UniqueMapId in a very simple manner.
*/
class SITUATIONMAP_EXPORT IdGenerator // final
{
public:
static const UniqueMapId INVALID_ID = SituationMap::INVALID_MAP_ID;
IdGenerator();
virtual ~IdGenerator(); // leave virtual to let UnitTestInternal succeed
IdGenerator(const IdGenerator &other) = delete;
IdGenerator &operator=(IdGenerator &other) = delete;
/**
* @brief Get next UniqueMapId
* @return Next UniqueMapId
*/
UniqueMapId getNextId()
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " nextId=" << m_counter;
return m_counter++;
}
/**
* @brief Check validity
* @param id to be checked
* @return True if id is not equal INVALID_ID
* @note Prefer SituationMap::isUniqueMapIdValid() due to runtime aspects.
*/
static bool idIsValid(const UniqueMapId &id)
{
return isUniqueMapIdValid(id); // same as ( id != INVALID_ID );
}
UniqueMapId nextFreeId() const { return m_counter; }
protected:
LOGGER_T m_logger; ///< Interface of the Logging-Facility
UniqueMapId m_counter = 0;
};
//----------------------------------------------------------------------------
/**
* @brief The ObjectContainer class maps UniqueMapId to MapObjects.
* It uses an external IdGenerator to generate a next UniqueMapId returned
* while inserting.
*/
class SITUATIONMAP_EXPORT ObjectContainer
{
public:
using UniqueObjectId = UniqueMapId;
using Object = AbstractMapObject;
/*! \name Construction, Destruction */
//@{
/**
* @brief Constructor of ObjectContainer.
* @param idGenerator to be used
* (can be shared among different ObjectContainer instances).
*/
explicit ObjectContainer(const QSharedPointer<IdGenerator> &idGenerator);
/**
* @brief Destructor. Will delete the IdGenerator when it goes
* out of scope, if no other QSharedPointer objects are referencing it.
*/
virtual ~ObjectContainer();
ObjectContainer(const ObjectContainer &other) = delete;
ObjectContainer &operator=(ObjectContainer &other) = delete;
/**
* @brief Get current IdGenerator.
* @return Current IdGenerator.
*/
virtual QSharedPointer<IdGenerator> idGenerator() const;
//@}
/*! \name Insert, Remove, Clear */
//@{
/**
* @brief insertObject.
* @param object to be inserted.
* @return UniqueId of inserted object.
*/
virtual UniqueObjectId insertObject(Object *object) = 0;
virtual UniqueObjectId insertObject(ObjectContainer::Object *object, const ObjectContainer::UniqueObjectId &uid) = 0;
/**
* @brief Remove object from the container.
* @param id to be removed.
* @return True on success, otherwise false.
*/
virtual bool removeObject(const UniqueObjectId &id) = 0;
/**
* @brief Clear the container (and remove objects from the view)
*/
virtual void clear() = 0;
//@}
/*! \name Access */
//@{
/**
* @brief getObject.
* @param id to access.
* @return Object if found, otherwise null.
*/
virtual Object *getObject(const UniqueObjectId &id) const = 0;
/**
* @brief Retrieves all UniqueIds.
* @return Get all UniqueIds.
*/
virtual QList<UniqueObjectId> getAllKeys() const = 0;
/**
* @brief Get all objects of any type.
* @return All objects.
*/
virtual QList<Object *> getAllObjects() const = 0;
/**
* @brief Get all objects of a certain type.
* @param type requested type.
* @return All objects fo requested type
*/
virtual QList<Object *> getAllObjects(const std::type_index &type) const = 0;
/**
* @brief Get mutable Iterator
* @return mutable Iterator
*/
virtual QMutableMapIterator<UniqueObjectId, RefPointer<Object>> mutableIterator() = 0;
//@}
/*! \name Check */
//@{
/**
* @brief Check existence.
* @param id to be checked.
* @return True if exists, otherwise false.
*/
virtual bool containsObject(const UniqueObjectId &id) const = 0;
//@}
/*! \name Count */
//@{
virtual qint64 countObjects() const = 0;
//@}
protected:
QSharedPointer<IdGenerator> m_idGenerator;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
} // namespace SituationMap