NBJoinedEdgesMap Class Reference

#include <NBJoinedEdgesMap.h>


Detailed Description

Definition at line 50 of file NBJoinedEdgesMap.h.


Public Member Functions

void appended (const std::string &to, const std::string &what)
 Informs the map that two edges have been joined.
void init (NBEdgeCont &ec)
 Initialises the map using the list of edge names.
 NBJoinedEdgesMap ()
 Constructor.
 ~NBJoinedEdgesMap ()
 Destructor.

Private Types

typedef std::map< std::string,
MappedEdgesVector
JoinedEdgesMap
 def. of a map of edge names to lists of previous edges the current edge is made of
typedef std::vector< std::string > MappedEdgesVector
 def. of a list of edges that make up an edge

Private Attributes

std::map< std::string, SUMOReal > myLengths
JoinedEdgesMap myMap
 Map of edge names to lists of previous edges the current edge is made of.

Friends

std::ostream & operator<< (std::ostream &os, const NBJoinedEdgesMap &map)
 Outputs the list of joined edges.

Member Typedef Documentation

typedef std::map<std::string, MappedEdgesVector> NBJoinedEdgesMap::JoinedEdgesMap [private]

def. of a map of edge names to lists of previous edges the current edge is made of

Definition at line 73 of file NBJoinedEdgesMap.h.

typedef std::vector<std::string> NBJoinedEdgesMap::MappedEdgesVector [private]

def. of a list of edges that make up an edge

Definition at line 70 of file NBJoinedEdgesMap.h.


Constructor & Destructor Documentation

NBJoinedEdgesMap::NBJoinedEdgesMap (  ) 

Constructor.

Definition at line 49 of file NBJoinedEdgesMap.cpp.

00049 {}

NBJoinedEdgesMap::~NBJoinedEdgesMap (  ) 

Destructor.

Definition at line 52 of file NBJoinedEdgesMap.cpp.

00052 {}


Member Function Documentation

void NBJoinedEdgesMap::appended ( const std::string &  to,
const std::string &  what 
)

Informs the map that two edges have been joined.

Definition at line 69 of file NBJoinedEdgesMap.cpp.

References myMap.

Referenced by NBNodeCont::removeUnwishedNodes().

00069                                                                      {
00070     copy(myMap[what].begin(), myMap[what].end(),
00071          back_inserter(myMap[to]));
00072 //    myMap[to].push_back(what);
00073     JoinedEdgesMap::iterator i = myMap.find(what);
00074     assert(i!=myMap.end());
00075     myMap.erase(i);
00076 }

void NBJoinedEdgesMap::init ( NBEdgeCont ec  ) 

Initialises the map using the list of edge names.

Definition at line 56 of file NBJoinedEdgesMap.cpp.

References NBEdgeCont::getAllNames(), NBEdge::getLength(), myLengths, myMap, and NBEdgeCont::retrieve().

Referenced by NBNetBuilder::compute().

00056                                      {
00057     const std::vector<std::string> edgeNames = ec.getAllNames();
00058     myMap.clear();
00059     for (std::vector<std::string>::const_iterator i=edgeNames.begin(); i!=edgeNames.end(); i++) {
00060         MappedEdgesVector e;
00061         e.push_back(*i);
00062         myMap[*i] = e;
00063         myLengths[*i] = ec.retrieve(*i)->getLength();
00064     }
00065 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const NBJoinedEdgesMap map 
) [friend]

Outputs the list of joined edges.

Definition at line 80 of file NBJoinedEdgesMap.cpp.

00080                                                           {
00081     NBJoinedEdgesMap::JoinedEdgesMap::const_iterator i;
00082     for (i=jemap.myMap.begin(); i!=jemap.myMap.end(); ++i) {
00083         os << (*i).first << "\t";
00084         const NBJoinedEdgesMap::MappedEdgesVector &e = (*i).second;
00085         for (NBJoinedEdgesMap::MappedEdgesVector::const_iterator j=e.begin(); j!=e.end(); ++j) {
00086             os << (*j) << ":" << jemap.myLengths.find(*j)->second << "\t";
00087         }
00088         os << std::endl;
00089     }
00090     return os;
00091 }


Field Documentation

std::map<std::string, SUMOReal> NBJoinedEdgesMap::myLengths [private]

Definition at line 78 of file NBJoinedEdgesMap.h.

Referenced by init(), and operator<<().

Map of edge names to lists of previous edges the current edge is made of.

Definition at line 76 of file NBJoinedEdgesMap.h.

Referenced by appended(), init(), and operator<<().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:51 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6