|
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) throw () |
| Adds an item. | |
| const std::vector< T > & | buildAndGetStaticVector () const throw () |
| void | clear () throw () |
| Removes all items from the container (deletes them, too) | |
| bool | erase (const std::string &id) throw () |
| Removes the named item from the container. | |
| T | get (const std::string &id) const throw () |
| Retrieves an item. | |
| const std::map< std::string, T > & | getMyMap () const throw () |
| std::vector< T > | getTempVector () const throw () |
| void | insertIDs (std::vector< std::string > &into) const throw () |
| NamedObjectCont () throw () | |
| Constructor. | |
| virtual bool | remove (const std::string &id) throw () |
| Removes an item. | |
| unsigned int | size () const throw () |
| Returns the number of items within the container. | |
| virtual | ~NamedObjectCont () throw () |
| 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 51 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 225 of file NamedObjectCont.h.
typedef IDMap::iterator NamedObjectCont< T >::myContIt [private] |
Definition of the container type iterator.
Definition at line 228 of file NamedObjectCont.h.
typedef std::vector<T> NamedObjectCont< T >::ObjectVector [private] |
Definition objects vector.
Definition at line 234 of file NamedObjectCont.h.
| NamedObjectCont< T >::NamedObjectCont | ( | ) | throw () [inline] |
Constructor.
Definition at line 54 of file NamedObjectCont.h.
| virtual NamedObjectCont< T >::~NamedObjectCont | ( | ) | throw () [inline, virtual] |
Destructor.
Definition at line 58 of file NamedObjectCont.h.
| virtual bool NamedObjectCont< T >::add | ( | const std::string & | id, |
| T | item | ||
| ) | throw () [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 74 of file NamedObjectCont.h.
Referenced by MSDetectorControl::add(), MSNet::addBusStop(), ODDistrictHandler::closeDistrict(), and NLJunctionControlBuilder::closeJunction().
| const std::vector<T>& NamedObjectCont< T >::buildAndGetStaticVector | ( | ) | const throw () [inline] |
Definition at line 173 of file NamedObjectCont.h.
| void NamedObjectCont< T >::clear | ( | ) | throw () [inline] |
Removes all items from the container (deletes them, too)
Reimplemented in ROVehicleCont.
Definition at line 117 of file NamedObjectCont.h.
Referenced by RONet::~RONet().
| bool NamedObjectCont< T >::erase | ( | const std::string & | id | ) | throw () [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 145 of file NamedObjectCont.h.
| T NamedObjectCont< T >::get | ( | const std::string & | id | ) | const throw () [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 107 of file NamedObjectCont.h.
Referenced by MSNet::getBusStop(), RONet::getEdge(), GUINet::getJunctionPosition(), RONet::getNode(), RONet::getRouteDef(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_InductionLoop::processGet(), and GUIShapeContainer::removePoI().
| const std::map<std::string, T>& NamedObjectCont< T >::getMyMap | ( | ) | const throw () [inline] |
Definition at line 218 of file NamedObjectCont.h.
Referenced by RONet::checkSourceAndDestinations(), MSNet::getBusStopID(), RONet::getEdgeMap(), and GUINet::initGUIStructures().
| std::vector<T> NamedObjectCont< T >::getTempVector | ( | ) | const throw () [inline] |
Definition at line 193 of file NamedObjectCont.h.
| void NamedObjectCont< T >::insertIDs | ( | std::vector< std::string > & | into | ) | const throw () [inline] |
Definition at line 206 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 | ) | throw () [inline, virtual] |
Removes an item.
| [in] | id | The id of the item to remove |
Definition at line 88 of file NamedObjectCont.h.
Referenced by GUIShapeContainer::removePoI().
| unsigned int NamedObjectCont< T >::size | ( | ) | const throw () [inline] |
Returns the number of items within the container.
Definition at line 131 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 240 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 231 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 237 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), and NamedObjectCont< RONode * >::erase().