Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of ObjectContainer
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
// Own
|
||||
#include <Map/object_container.h>
|
||||
#include <Common/ref_pointer.h>
|
||||
#include <Common/situation_map_logging.h>
|
||||
|
||||
|
||||
// Qt
|
||||
#include <QMap>
|
||||
|
||||
#include <typeindex>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @brief The ObjectContainerCTC class implements the interface SituationMap::ObjectContainer.
|
||||
* It is a map of UniqueMapId to MapObjects.
|
||||
* It uses a external IdGenerator to generate a next UniqueMapId returned
|
||||
* while inserting.
|
||||
* For documentation of inherented methods, see interface class SituationMap::ObjectContainer.
|
||||
*/
|
||||
class SITUATIONMAP_EXPORT ObjectContainerCTC : public ObjectContainer
|
||||
{
|
||||
|
||||
using BaseClass = ObjectContainer;
|
||||
|
||||
public:
|
||||
/*! \name Construction, Destruction */
|
||||
//@{
|
||||
/**
|
||||
* @brief ObjectContainerCTC.
|
||||
* @param idGenerator to be used
|
||||
* (can be shared among different ObjectContainer instances).
|
||||
*/
|
||||
explicit ObjectContainerCTC(const QSharedPointer<IdGenerator> &idGenerator);
|
||||
virtual ~ObjectContainerCTC();
|
||||
//@}
|
||||
|
||||
/*! \name Insert, Remove, Clear */
|
||||
//@{
|
||||
|
||||
virtual UniqueObjectId insertObject( Object *object ) override;
|
||||
virtual UniqueObjectId insertObject( ObjectContainer::Object *object
|
||||
, const ObjectContainer::UniqueObjectId &uid ) override;
|
||||
virtual bool removeObject( const UniqueObjectId &id ) override;
|
||||
|
||||
virtual void clear() override;
|
||||
//@}
|
||||
|
||||
/*! \name Access */
|
||||
//@{
|
||||
virtual QList<UniqueObjectId> getAllKeys() const override;
|
||||
|
||||
virtual Object *getObject(const UniqueObjectId &id) const override; // Returns pointer to object
|
||||
virtual QList<Object *> getAllObjects() const override;
|
||||
virtual QList<Object *> getAllObjects(const std::type_index &type) const override; // without template
|
||||
|
||||
QMutableMapIterator<UniqueObjectId, RefPointer<Object>> mutableIterator() override
|
||||
{
|
||||
return QMutableMapIterator<UniqueObjectId, RefPointer<Object>> (m_map);
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Check */
|
||||
//@{
|
||||
virtual bool containsObject(const UniqueObjectId &id) const override;
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/*! \name Count */
|
||||
//@{
|
||||
/**
|
||||
* @brief Number of objects.
|
||||
* @return Current number of objects.
|
||||
*/
|
||||
virtual qint64 countObjects() const override;
|
||||
//@}
|
||||
|
||||
QMap<UniqueObjectId, RefPointer<Object> > m_map;
|
||||
|
||||
private:
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
Reference in new issue
Block a user