NIImporter_DlrNavteq::TrafficlightsHandler Class Reference

#include <NIImporter_DlrNavteq.h>

Inheritance diagram for NIImporter_DlrNavteq::TrafficlightsHandler:

LineHandler

Detailed Description

Importer of traffic lights stored in DLRNavteq's (aka elmar) format.

Being a LineHandler, this class retrieves each line from a LineReader and parses these information assuming they contain traffic light definitions in DLRNavteq's format.

Definition at line 198 of file NIImporter_DlrNavteq.h.


Public Member Functions

bool report (const std::string &result) throw (ProcessError)
 Parsing method.
 TrafficlightsHandler (NBNodeCont &nc, NBTrafficLightLogicCont &tlc, const std::string &file) throw ()
 Constructor.
 ~TrafficlightsHandler () throw ()
 Destructor.

Protected Attributes

NBNodeContmyNodeCont
 The node container to get the referenced nodes from.
NBTrafficLightLogicContmyTLLogicCont
 The traffic lights container to add built tls to.

Private Member Functions

TrafficlightsHandleroperator= (const TrafficlightsHandler &)
 Invalidated assignment operator.
 TrafficlightsHandler (const TrafficlightsHandler &)
 Invalidated copy constructor.

Constructor & Destructor Documentation

NIImporter_DlrNavteq::TrafficlightsHandler::TrafficlightsHandler ( NBNodeCont nc,
NBTrafficLightLogicCont tlc,
const std::string &  file 
) throw ()

Constructor.

Parameters:
[in] nc The node control to retrieve nodes from
in,filled] tlc The traffic lights container to fill
[in] file The name of the parsed file

Definition at line 283 of file NIImporter_DlrNavteq.cpp.

00286         : myNodeCont(nc), myTLLogicCont(tlc) {}

NIImporter_DlrNavteq::TrafficlightsHandler::~TrafficlightsHandler (  )  throw ()

Destructor.

Definition at line 289 of file NIImporter_DlrNavteq.cpp.

00289 {}

NIImporter_DlrNavteq::TrafficlightsHandler::TrafficlightsHandler ( const TrafficlightsHandler  )  [private]

Invalidated copy constructor.


Member Function Documentation

TrafficlightsHandler& NIImporter_DlrNavteq::TrafficlightsHandler::operator= ( const TrafficlightsHandler  )  [private]

Invalidated assignment operator.

bool NIImporter_DlrNavteq::TrafficlightsHandler::report ( const std::string &  result  )  throw (ProcessError) [virtual]

Parsing method.

Implementation of the LineHandler-interface called by a LineReader; interprets the retrieved information and alters the nodes.

Parameters:
[in] result The read line
Returns:
Whether the parsing shall continue
Exceptions:
ProcessError if something fails
See also:
LineHandler::report

Implements LineHandler.

Definition at line 293 of file NIImporter_DlrNavteq.cpp.

References NBNode::getPosition(), NBNode::getType(), StringTokenizer::getVector(), NBTrafficLightLogicCont::insert(), myNodeCont, myTLLogicCont, NBNode::NODETYPE_TRAFFIC_LIGHT, NBNode::reinit(), NBNodeCont::retrieve(), StringTokenizer::WHITECHARS, and WRITE_WARNING.

00293                                                                                             {
00294 // #ID     POICOL-TYPE     DESCRIPTION     LONGITUDE       LATITUDE        NAVTEQ_LINK_ID  NODEID
00295 
00296     if (result[0]=='#') {
00297         return true;
00298     }
00299     StringTokenizer st(result, StringTokenizer::WHITECHARS);
00300     std::string nodeID = st.getVector().back();
00301     NBNode *node = myNodeCont.retrieve(nodeID);
00302     if (node==0) {
00303         WRITE_WARNING("The traffic light node '" + nodeID + "' could not be found");
00304     } else {
00305         if (node->getType() != NBNode::NODETYPE_TRAFFIC_LIGHT) {
00306             node->reinit(node->getPosition(), NBNode::NODETYPE_TRAFFIC_LIGHT);
00307             NBTrafficLightDefinition *tlDef = new NBOwnTLDef(nodeID, node);
00308             if (!myTLLogicCont.insert(tlDef)) {
00309                 // actually, nothing should fail here
00310                 delete tlDef;
00311                 throw ProcessError("Could not allocate tls for '" + nodeID + "'.");
00312             }
00313         }
00314     }
00315     return true;
00316 }


Field Documentation

The node container to get the referenced nodes from.

Definition at line 227 of file NIImporter_DlrNavteq.h.

Referenced by report().

The traffic lights container to add built tls to.

Definition at line 230 of file NIImporter_DlrNavteq.h.

Referenced by report().


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

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