NIImporter_OpenStreetMap::CompareNodesInPairs Class Reference

Inheritance diagram for NIImporter_OpenStreetMap::CompareNodesInPairs:

unary_function

Detailed Description

Functor which compares two NIOSMNodes according to their coordinates.

Both nodes are given as pointers in the second element of two pairs. This functor is helpful for example in the find_if algorithm.

Definition at line 68 of file NIImporter_OpenStreetMap.cpp.


Public Member Functions

 CompareNodesInPairs (const std::pair< int, NIOSMNode * > &p0)
 Initializes the functor with the fixed comparison partner.
bool operator() (const std::pair< int, NIOSMNode * > &p1) const
 Compares the NIOSMNode (p1.second) with the node given in the constructor for equality.

Private Attributes

std::pair< int, NIOSMNode * > myP0

Constructor & Destructor Documentation

NIImporter_OpenStreetMap::CompareNodesInPairs::CompareNodesInPairs ( const std::pair< int, NIOSMNode * > &  p0  )  [inline]

Initializes the functor with the fixed comparison partner.

Parameters:
[in] p0 A pair with the NIOSMNode all other nodes should be compared with.

Definition at line 77 of file NIImporter_OpenStreetMap.cpp.

00077                                                             :
00078             myP0(p0) {
00079     }


Member Function Documentation

bool NIImporter_OpenStreetMap::CompareNodesInPairs::operator() ( const std::pair< int, NIOSMNode * > &  p1  )  const [inline]

Compares the NIOSMNode (p1.second) with the node given in the constructor for equality.

The geo coordinates (lat and lon) are compared to test the equality.

Parameters:
[in] p1 A pair with the node to compare.
Returns:
true if both nodes are equal; otherwise false.

Definition at line 88 of file NIImporter_OpenStreetMap.cpp.

References myP0.

00088                                                               {
00089         return (p1.second->lat == myP0.second->lat) && (p1.second->lon
00090                 == myP0.second->lon);
00091     }


Field Documentation

Definition at line 94 of file NIImporter_OpenStreetMap.cpp.

Referenced by operator()().


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

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