SUMO - Simulation of Urban MObility
NIXMLConnectionsHandler.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Importer for edge connections stored in XML
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef NIXMLConnectionsHandler_h
00023 #define NIXMLConnectionsHandler_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <utils/xml/SUMOSAXHandler.h>
00036 #include <netbuild/NBConnection.h>
00037 
00038 
00039 // ===========================================================================
00040 // class declarations
00041 // ===========================================================================
00042 class NBEdge;
00043 class NBEdgeCont;
00044 class MsgHandler;
00045 
00046 
00047 // ===========================================================================
00048 // class definitions
00049 // ===========================================================================
00057 class NIXMLConnectionsHandler : public SUMOSAXHandler {
00058 public:
00062     NIXMLConnectionsHandler(NBEdgeCont& ec) ;
00063 
00064 
00066     ~NIXMLConnectionsHandler() ;
00067 
00068 
00069 protected:
00071 
00072 
00080     void myStartElement(int element,
00081                         const SUMOSAXAttributes& attrs) ;
00083 
00084 private:
00093     NBConnection parseConnection(const std::string& defRole, const std::string& def) ;
00094 
00095 
00101     void parseLaneBound(const SUMOSAXAttributes& attrs, NBEdge* from, NBEdge* to) ;
00102 
00103 
00111     bool parseLaneInfo(const SUMOSAXAttributes& attributes, NBEdge* fromEdge, NBEdge* toEdge, int* fromLane, int* toLane);
00112 
00113 
00121     inline bool parseDeprecatedLaneDefinition(const SUMOSAXAttributes& attributes,
00122             NBEdge* fromEdge, NBEdge* toEdge,
00123             int* fromLane, int* toLane);
00124 
00125 
00131     inline bool parseLaneDefinition(const SUMOSAXAttributes& attributes, int* fromLane, int* toLane);
00132 
00141     bool validateLaneInfo(bool canLanesBeNegative, NBEdge* fromEdge, NBEdge* toEdge, int fromLane, int toLane);
00142 
00143 
00144 private:
00146     NBEdgeCont& myEdgeCont;
00147 
00149     bool myHaveWarnedAboutDeprecatedLanes;
00150 
00152     MsgHandler* const myErrorMsgHandler;
00153 
00154 private:
00156     NIXMLConnectionsHandler(const NIXMLConnectionsHandler& s);
00157 
00159     NIXMLConnectionsHandler& operator=(const NIXMLConnectionsHandler& s);
00160 
00161 
00162 };
00163 
00164 
00165 #endif
00166 
00167 /****************************************************************************/
00168 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines