|
SUMO - Simulation of Urban MObility
|
A container for districts. More...
#include <ODDistrictCont.h>
Public Member Functions | |
| virtual bool | add (const std::string &id, ODDistrict *item) throw () |
| Adds an item. | |
| const std::vector< ODDistrict * > & | 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. | |
| ODDistrict * | get (const std::string &id) const throw () |
| Retrieves an item. | |
| const std::map< std::string, ODDistrict * > & | getMyMap () const throw () |
| std::string | getRandomSinkFromDistrict (const std::string &name) const throw (OutOfBoundsException, InvalidArgument) |
| Returns the id of a random sink from the named district. | |
| std::string | getRandomSourceFromDistrict (const std::string &name) const throw (OutOfBoundsException, InvalidArgument) |
| Returns the id of a random source from the named district. | |
| std::vector< ODDistrict * > | getTempVector () const throw () |
| void | insertIDs (std::vector< std::string > &into) const throw () |
| ODDistrictCont () 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. | |
| ~ODDistrictCont () throw () | |
| Destructor. | |
Private Member Functions | |
| ODDistrictCont (const ODDistrictCont &s) | |
| invalidated copy constructor | |
| ODDistrictCont & | operator= (const ODDistrictCont &s) |
| invalidated assignment operator | |
A container for districts.
Besides the inherited methods for adding/removing districts, this container allows to retrieve a random source or sink from a named district.
Definition at line 46 of file ODDistrictCont.h.
| ODDistrictCont::ODDistrictCont | ( | ) | throw () |
Constructor.
Definition at line 45 of file ODDistrictCont.cpp.
| ODDistrictCont::~ODDistrictCont | ( | ) | throw () |
Destructor.
Definition at line 48 of file ODDistrictCont.cpp.
| ODDistrictCont::ODDistrictCont | ( | const ODDistrictCont & | s | ) | [private] |
invalidated copy constructor
| virtual bool NamedObjectCont< ODDistrict * >::add | ( | const std::string & | id, |
| ODDistrict * | item | ||
| ) | throw () [inline, virtual, inherited] |
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 |
Definition at line 74 of file NamedObjectCont.h.
| const std::vector<ODDistrict * >& NamedObjectCont< ODDistrict * >::buildAndGetStaticVector | ( | ) | const throw () [inline, inherited] |
Definition at line 173 of file NamedObjectCont.h.
| void NamedObjectCont< ODDistrict * >::clear | ( | ) | throw () [inline, inherited] |
Removes all items from the container (deletes them, too)
Definition at line 117 of file NamedObjectCont.h.
| bool NamedObjectCont< ODDistrict * >::erase | ( | const std::string & | id | ) | throw () [inline, inherited] |
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 145 of file NamedObjectCont.h.
| ODDistrict * NamedObjectCont< ODDistrict * >::get | ( | const std::string & | id | ) | const throw () [inline, inherited] |
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.
| const std::map<std::string, ODDistrict * >& NamedObjectCont< ODDistrict * >::getMyMap | ( | ) | const throw () [inline, inherited] |
Definition at line 218 of file NamedObjectCont.h.
| std::string ODDistrictCont::getRandomSinkFromDistrict | ( | const std::string & | name | ) | const throw (OutOfBoundsException, InvalidArgument) |
Returns the id of a random sink from the named district.
At first, the named district is retrieved. If this fails, an InvalidArgument-exception is thrown. Otherwise, a sink (edge) is chosen randomly from this district using this district's getRandomSink-method which throws an OutOfBoundsException-exception if this district does not contain a sink.
| [in] | name | The id of the district to get a random sink from |
| InvalidArgument | If the named district is not known |
| OutOfBoundsException | If the named district has no sinks |
Definition at line 62 of file ODDistrictCont.cpp.
References ODDistrict::getRandomSink().
| std::string ODDistrictCont::getRandomSourceFromDistrict | ( | const std::string & | name | ) | const throw (OutOfBoundsException, InvalidArgument) |
Returns the id of a random source from the named district.
At first, the named district is retrieved. If this fails, an InvalidArgument-exception is thrown. Otherwise, a source (edge) is chosen randomly from this district using this district's getRandomSource-method which throws an OutOfBoundsException-exception if this district does not contain a source.
| [in] | name | The id of the district to get a random source from |
| InvalidArgument | If the named district is not known |
| OutOfBoundsException | If the named district has no sources |
Definition at line 52 of file ODDistrictCont.cpp.
References ODDistrict::getRandomSource().
| std::vector<ODDistrict * > NamedObjectCont< ODDistrict * >::getTempVector | ( | ) | const throw () [inline, inherited] |
Definition at line 193 of file NamedObjectCont.h.
| void NamedObjectCont< ODDistrict * >::insertIDs | ( | std::vector< std::string > & | into | ) | const throw () [inline, inherited] |
Definition at line 206 of file NamedObjectCont.h.
| ODDistrictCont& ODDistrictCont::operator= | ( | const ODDistrictCont & | s | ) | [private] |
invalidated assignment operator
| virtual bool NamedObjectCont< ODDistrict * >::remove | ( | const std::string & | id | ) | throw () [inline, virtual, inherited] |
Removes an item.
| [in] | id | The id of the item to remove |
Definition at line 88 of file NamedObjectCont.h.
| unsigned int NamedObjectCont< ODDistrict * >::size | ( | ) | const throw () [inline, inherited] |
Returns the number of items within the container.
Definition at line 131 of file NamedObjectCont.h.