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. More... | |
Public Member Functions | |
virtual bool | add (const std::string &id, T item) |
Adds an item. More... | |
const std::vector< T > & | buildAndGetStaticVector () const |
void | clear () |
Removes all items from the container (deletes them, too) More... | |
bool | erase (const std::string &id) |
Removes the named item from the container. More... | |
T | get (const std::string &id) const |
Retrieves an item. More... | |
const IDMap & | getMyMap () const |
std::vector< T > | getTempVector () const |
void | insertIDs (std::vector< std::string > &into) const |
NamedObjectCont () | |
Constructor. More... | |
virtual bool | remove (const std::string &id) |
Removes an item. More... | |
unsigned int | size () const |
Returns the number of items within the container. More... | |
virtual | ~NamedObjectCont () |
Destructor. More... | |
Private Types | |
typedef IDMap::iterator | myContIt |
Definition of the container type iterator. More... | |
typedef std::vector< T > | ObjectVector |
Definition objects vector. More... | |
Private Attributes | |
bool | myHaveChanged |
Information whether the vector is out of sync with the map. More... | |
IDMap | myMap |
The map from key to object. More... | |
ObjectVector | myVector |
The stored vector of all known items. More... | |
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 |
Definition of the key to pointer map type.
Definition at line 56 of file NamedObjectCont.h.
|
private |
Definition of the container type iterator.
Definition at line 230 of file NamedObjectCont.h.
|
private |
Definition objects vector.
Definition at line 236 of file NamedObjectCont.h.
|
inline |
Constructor.
Definition at line 59 of file NamedObjectCont.h.
|
inlinevirtual |
Destructor.
Definition at line 63 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 79 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 178 of file NamedObjectCont.h.
|
inline |
Removes all items from the container (deletes them, too)
Definition at line 122 of file NamedObjectCont.h.
Referenced by ROVehicleCont::clear(), and 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 |
Definition at line 150 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 112 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_InductionLoop::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), GUIShapeContainer::removePOI(), GUIShapeContainer::removePolygon(), GUIShapeContainer::reshapePolygon(), and ShapeContainer::reshapePolygon().
|
inline |
Definition at line 223 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 198 of file NamedObjectCont.h.
|
inline |
Definition at line 211 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 93 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 136 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 242 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 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().
|
mutableprivate |
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().