|
SUMO - Simulation of Urban MObility
|
A map of named object pointers. More...
#include <NamedObjectCont.h>
Public Member Functions | |
| virtual bool | add (const std::string &id, T item) |
| Adds an item. | |
| const std::vector< T > & | buildAndGetStaticVector () const |
| void | clear () |
| Removes all items from the container (deletes them, too) | |
| bool | erase (const std::string &id) |
| Removes the named item from the container. | |
| T | get (const std::string &id) const |
| Retrieves an item. | |
| const std::map< std::string, T > & | getMyMap () const |
| std::vector< T > | getTempVector () const |
| void | insertIDs (std::vector< std::string > &into) const |
| NamedObjectCont () | |
| Constructor. | |
| virtual bool | remove (const std::string &id) |
| Removes an item. | |
| unsigned int | size () const |
| Returns the number of items within the container. | |
| virtual | ~NamedObjectCont () |
| Destructor. | |
Private Types | |
| typedef std::map< std::string, T > | IDMap |
| Definition of the key to pointer map type. | |
| typedef IDMap::iterator | myContIt |
| Definition of the container type iterator. | |
| typedef std::vector< T > | ObjectVector |
| Definition objects vector. | |
Private Attributes | |
| bool | myHaveChanged |
| Information whether the vector is out of sync with the map. | |
| IDMap | myMap |
| The map from key to object. | |
| ObjectVector | myVector |
| The stored vector of all known items. | |
A map of named object pointers.
An associative storage (map) for objects (pointers to them to be exact), which do have a name. In order to get the stored objects as a list, each insertion/deletion sets the internal state value "myHaveChanged" to true, indicating the list must be rebuild.
Definition at line 53 of file NamedObjectCont.h.
typedef std::map< std::string, T > NamedObjectCont< T >::IDMap [private] |
Definition of the key to pointer map type.
Definition at line 227 of file NamedObjectCont.h.
typedef IDMap::iterator NamedObjectCont< T >::myContIt [private] |
Definition of the container type iterator.
Definition at line 230 of file NamedObjectCont.h.
typedef std::vector<T> NamedObjectCont< T >::ObjectVector [private] |
Definition objects vector.
Definition at line 236 of file NamedObjectCont.h.
| NamedObjectCont< T >::NamedObjectCont | ( | ) | [inline] |
Constructor.
Definition at line 56 of file NamedObjectCont.h.
| virtual NamedObjectCont< T >::~NamedObjectCont | ( | ) | [inline, virtual] |
Destructor.
Definition at line 60 of file NamedObjectCont.h.
| virtual bool NamedObjectCont< T >::add | ( | const std::string & | id, |
| T | item | ||
| ) | [inline, virtual] |
Adds an item.
If another item with the same name is already known, false is reported and the item is not added.
| [in] | id | The id of the item to add |
| [in] | item | The item to add |
Reimplemented in ROVehicleCont.
Definition at line 76 of file NamedObjectCont.h.
Referenced by MSDetectorControl::add(), MSNet::addBusStop(), RONet::addEdge(), RONet::addNode(), RONet::addRouteDef(), RONet::addVehicleType(), ODDistrictHandler::closeDistrict(), and NLJunctionControlBuilder::closeJunction().
| const std::vector<T>& NamedObjectCont< T >::buildAndGetStaticVector | ( | ) | const [inline] |
Definition at line 175 of file NamedObjectCont.h.
| void NamedObjectCont< T >::clear | ( | ) | [inline] |
Removes all items from the container (deletes them, too)
Reimplemented in ROVehicleCont.
Definition at line 119 of file NamedObjectCont.h.
Referenced by RONet::~RONet().
| bool NamedObjectCont< T >::erase | ( | const std::string & | id | ) | [inline] |
Removes the named item from the container.
If the named object exists, it is deleted, the key is removed from the map, and true is returned. If the id was not known, false is returned.
| [in] | id | The id of the item to delete |
Reimplemented in ROVehicleCont.
Definition at line 147 of file NamedObjectCont.h.
| T NamedObjectCont< T >::get | ( | const std::string & | id | ) | const [inline] |
Retrieves an item.
Returns 0 when no item with the given id is stored within the container
| [in] | id | The id of the item to retrieve |
Definition at line 109 of file NamedObjectCont.h.
Referenced by ODMatrix::add(), MSNet::getBusStop(), RONet::getEdge(), GUINet::getJunctionPosition(), RONet::getNode(), RONet::getRouteDef(), RONet::getVehicleTypeSecure(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_InductionLoop::processGet(), and GUIShapeContainer::removePoI().
| const std::map<std::string, T>& NamedObjectCont< T >::getMyMap | ( | ) | const [inline] |
Definition at line 220 of file NamedObjectCont.h.
Referenced by RONet::checkSourceAndDestinations(), MSNet::getBusStopID(), RONet::getEdgeMap(), GUINet::initGUIStructures(), and MSDetectorControl::updateDetectors().
| std::vector<T> NamedObjectCont< T >::getTempVector | ( | ) | const [inline] |
Definition at line 195 of file NamedObjectCont.h.
| void NamedObjectCont< T >::insertIDs | ( | std::vector< std::string > & | into | ) | const [inline] |
Definition at line 208 of file NamedObjectCont.h.
Referenced by TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), and TraCIServerAPI_InductionLoop::processGet().
| virtual bool NamedObjectCont< T >::remove | ( | const std::string & | id | ) | [inline, virtual] |
Removes an item.
| [in] | id | The id of the item to remove |
Definition at line 90 of file NamedObjectCont.h.
Referenced by GUIShapeContainer::removePoI().
| unsigned int NamedObjectCont< T >::size | ( | ) | const [inline] |
Returns the number of items within the container.
Definition at line 133 of file NamedObjectCont.h.
Referenced by RONet::furtherStored(), RONet::getEdgeNo(), GUINet::initGUIStructures(), main(), and RONet::saveAndRemoveRoutesUntil().
bool NamedObjectCont< T >::myHaveChanged [mutable, private] |
Information whether the vector is out of sync with the map.
Definition at line 242 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::add(), NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), NamedObjectCont< RONode * >::erase(), and NamedObjectCont< RONode * >::remove().
IDMap NamedObjectCont< T >::myMap [private] |
The map from key to object.
Definition at line 233 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::add(), NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), NamedObjectCont< RONode * >::erase(), NamedObjectCont< RONode * >::get(), NamedObjectCont< RONode * >::getMyMap(), NamedObjectCont< RONode * >::getTempVector(), NamedObjectCont< RONode * >::insertIDs(), NamedObjectCont< RONode * >::remove(), NamedObjectCont< RONode * >::size(), and NamedObjectCont< RONode * >::~NamedObjectCont().
ObjectVector NamedObjectCont< T >::myVector [mutable, private] |
The stored vector of all known items.
Definition at line 239 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), and NamedObjectCont< RONode * >::erase().