SUMO - Simulation of Urban MObility
|
A map of named object pointers. More...
#include <NamedObjectCont.h>
Public Types | |
typedef std::map< std::string, T > | IDMap |
Definition of the key to pointer map type. |
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 IDMap & | 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 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 54 of file NamedObjectCont.h.
typedef std::map< std::string, T > NamedObjectCont< T >::IDMap |
Definition of the key to pointer map type.
Definition at line 57 of file NamedObjectCont.h.
|
private |
Definition of the container type iterator.
Definition at line 231 of file NamedObjectCont.h.
|
private |
Definition objects vector.
Definition at line 237 of file NamedObjectCont.h.
|
inline |
Constructor.
Definition at line 60 of file NamedObjectCont.h.
|
inlinevirtual |
Destructor.
Definition at line 64 of file NamedObjectCont.h.
|
inlinevirtual |
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 80 of file NamedObjectCont.h.
Referenced by MSNet::addBusStop(), RONet::addEdge(), RONet::addFlow(), RONet::addNode(), GUIShapeContainer::addPOI(), ShapeContainer::addPOI(), GUIShapeContainer::addPolygon(), ShapeContainer::addPolygon(), RONet::addRouteDef(), RONet::addVehicleType(), ODDistrictHandler::closeDistrict(), NLJunctionControlBuilder::closeJunction(), and RONet::RONet().
|
inline |
Definition at line 179 of file NamedObjectCont.h.
|
inline |
Removes all items from the container (deletes them, too)
Reimplemented in ROVehicleCont.
Definition at line 123 of file NamedObjectCont.h.
Referenced by RONet::~RONet().
|
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 151 of file NamedObjectCont.h.
Referenced by RONet::checkFlows(), and RONet::saveAndRemoveRoutesUntil().
|
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 113 of file NamedObjectCont.h.
Referenced by ODMatrix::add(), RONet::checkVType(), MSNet::getBusStop(), RONet::getEdge(), GUINet::getJunctionPosition(), RONet::getNode(), TraCIServerAPI_POI::getPoI(), TraCIServerAPI_Polygon::getPolygon(), TraCIServerAPI_InductionLoop::getPosition(), TraCIServerAPI_Junction::getPosition(), RONet::getRouteDef(), RONet::getVehicleTypeSecure(), GUIShapeContainer::movePOI(), ShapeContainer::movePOI(), NLTriggerBuilder::parseAndBuildCalibrator(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), GUIShapeContainer::removePOI(), GUIShapeContainer::removePolygon(), GUIShapeContainer::reshapePolygon(), ShapeContainer::reshapePolygon(), and NLJunctionControlBuilder::retrieve().
|
inline |
Definition at line 224 of file NamedObjectCont.h.
Referenced by RONet::checkFlows(), MSNet::getBusStopID(), RONet::getEdgeMap(), GUIShapeContainer::getPOIIds(), GUIShapeContainer::getPolygonIDs(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_InductionLoop::getTree(), TraCIServerAPI_POI::getTree(), TraCIServerAPI_Polygon::getTree(), GUINet::initGUIStructures(), and MSDetectorControl::updateDetectors().
|
inline |
Definition at line 199 of file NamedObjectCont.h.
|
inline |
Definition at line 212 of file NamedObjectCont.h.
Referenced by TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), and TraCIServerAPI_InductionLoop::processGet().
|
inlinevirtual |
Removes an item.
[in] | id | The id of the item to remove |
Definition at line 94 of file NamedObjectCont.h.
Referenced by RONet::checkVType(), GUIShapeContainer::removePOI(), ShapeContainer::removePOI(), GUIShapeContainer::removePolygon(), and ShapeContainer::removePolygon().
|
inline |
Returns the number of items within the container.
Definition at line 137 of file NamedObjectCont.h.
Referenced by RONet::furtherStored(), RONet::getEdgeNo(), RONet::getEdgeNoWithoutInternal(), GUINet::initGUIStructures(), main(), and RONet::saveAndRemoveRoutesUntil().
|
mutableprivate |
Information whether the vector is out of sync with the map.
Definition at line 243 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::add(), NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), NamedObjectCont< RONode * >::erase(), and NamedObjectCont< RONode * >::remove().
|
private |
The map from key to object.
Definition at line 234 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().
|
mutableprivate |
The stored vector of all known items.
Definition at line 240 of file NamedObjectCont.h.
Referenced by NamedObjectCont< RONode * >::buildAndGetStaticVector(), NamedObjectCont< RONode * >::clear(), and NamedObjectCont< RONode * >::erase().