Eclipse SUMO - Simulation of Urban MObility
NamedObjectCont< T > Class Template Reference

A map of named object pointers. More...

#include <NamedObjectCont.h>

Collaboration diagram for NamedObjectCont< T >:

Public Types

typedef std::map< std::string, T > IDMap
 Definition of the key to pointer map type. More...
 

Public Member Functions

bool add (const std::string &id, T item)
 Adds an item. More...
 
IDMap::const_iterator begin () const
 Returns a reference to the begin iterator for the internal map. More...
 
bool changeID (const std::string &oldId, const std::string &newId)
 change ID of a stored object More...
 
void clear ()
 Removes all items from the container (deletes them, too) More...
 
IDMap::const_iterator end () const
 Returns a reference to the end iterator for the internal map. More...
 
get (const std::string &id) const
 Retrieves an item. More...
 
void insertIDs (std::vector< std::string > &into) const
 
bool remove (const std::string &id, const bool del=true)
 Removes an item. More...
 
int size () const
 Returns the number of stored items within the container. More...
 
virtual ~NamedObjectCont ()
 Destructor. More...
 

Private Attributes

IDMap myMap
 The map from key to object. More...
 

Detailed Description

template<class T>
class NamedObjectCont< T >

A map of named object pointers.

An associative storage (map) for objects (pointers to them to be exact), which do have a name.

Definition at line 44 of file NamedObjectCont.h.

Member Typedef Documentation

◆ IDMap

template<class T>
typedef std::map< std::string, T > NamedObjectCont< T >::IDMap

Definition of the key to pointer map type.

Definition at line 47 of file NamedObjectCont.h.

Constructor & Destructor Documentation

◆ ~NamedObjectCont()

template<class T>
virtual NamedObjectCont< T >::~NamedObjectCont ( )
inlinevirtual

Destructor.

Definition at line 50 of file NamedObjectCont.h.

Member Function Documentation

◆ add()

template<class T>
bool NamedObjectCont< T >::add ( const std::string &  id,
item 
)
inline

Adds an item.

If another item with the same name is already known, false is reported and the item is not added.

Parameters
[in]idThe id of the item to add
[in]itemThe item to add
Returns
If the item could been added (no item with the same id was within the container before)

Definition at line 66 of file NamedObjectCont.h.

Referenced by ShapeContainer::add(), RONet::addEdge(), RONet::addFlow(), RONet::addNode(), GUIShapeContainer::addPOI(), GNENet::addPOI(), GUIShapeContainer::addPolygon(), RONet::addRouteDef(), RONet::addVehicleType(), ODDistrictHandler::closeDistrict(), NLJunctionControlBuilder::closeJunction(), GNENet::insertShape(), and RONet::RONet().

◆ begin()

template<class T>
IDMap::const_iterator NamedObjectCont< T >::begin ( ) const
inline

Returns a reference to the begin iterator for the internal map.

Definition at line 145 of file NamedObjectCont.h.

Referenced by ROMAAssignments::incremental(), GUIViewTraffic::onGamingClick(), ROMAAssignments::resetFlows(), ROMAAssignments::sue(), and writeInterval().

◆ changeID()

template<class T>
bool NamedObjectCont< T >::changeID ( const std::string &  oldId,
const std::string &  newId 
)
inline

change ID of a stored object

Definition at line 131 of file NamedObjectCont.h.

Referenced by GNENet::changeShapeID().

◆ clear()

template<class T>
void NamedObjectCont< T >::clear ( )
inline

Removes all items from the container (deletes them, too)

Definition at line 109 of file NamedObjectCont.h.

Referenced by GNENet::computeAndUpdate(), and PCPolyContainer::~PCPolyContainer().

◆ end()

template<class T>
IDMap::const_iterator NamedObjectCont< T >::end ( ) const
inline

Returns a reference to the end iterator for the internal map.

Definition at line 150 of file NamedObjectCont.h.

Referenced by ROMAAssignments::incremental(), GUIViewTraffic::onGamingClick(), ROMAAssignments::resetFlows(), ROMAAssignments::sue(), and writeInterval().

◆ get()

◆ insertIDs()

template<class T>
void NamedObjectCont< T >::insertIDs ( std::vector< std::string > &  into) const
inline

◆ remove()

template<class T>
bool NamedObjectCont< T >::remove ( const std::string &  id,
const bool  del = true 
)
inline

Removes an item.

Parameters
[in]idThe id of the item to remove
[in]deldelete item after removing of container
Returns
If the item could been removed (an item with the id was within the container before)

Definition at line 79 of file NamedObjectCont.h.

Referenced by GUIShapeContainer::addPOI(), GUIShapeContainer::addPolygon(), RONet::checkVType(), GUIShapeContainer::removePOI(), ShapeContainer::removePOI(), ShapeContainer::removePolygon(), GNENet::removeShape(), RONet::saveAndRemoveRoutesUntil(), GNEChange_Shape::~GNEChange_Shape(), and RONet::~RONet().

◆ size()

Field Documentation

◆ myMap


The documentation for this class was generated from the following file: