]> git.mxchange.org Git - flightgear.git/blob - src/Airports/dynamicloader.hxx
Code cleanups, code updates and fix at least on (possible) devide-by-zero
[flightgear.git] / src / Airports / dynamicloader.hxx
1 // This program is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU General Public License as
3 // published by the Free Software Foundation; either version 2 of the
4 // License, or (at your option) any later version.
5 //
6 // This program is distributed in the hope that it will be useful, but
7 // WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9 // General Public License for more details.
10 //
11 // You should have received a copy of the GNU General Public License
12 // along with this program; if not, write to the Free Software
13 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14 //
15
16 #ifndef _DYNAMIC_LOADER_HXX_
17 #define _DYNAMIC_LOADER_HXX_
18
19 #include <set>
20
21 #include <simgear/xml/easyxml.hxx>
22
23 #include "groundnetwork.hxx"
24 #include <Airports/parking.hxx>
25
26 class FGGroundNetXMLLoader : public XMLVisitor {
27 public:
28     FGGroundNetXMLLoader(FGGroundNetwork* gn);
29
30 protected:
31     virtual void startXML (); 
32     virtual void endXML   ();
33     virtual void startElement (const char * name, const XMLAttributes &atts);
34     virtual void endElement (const char * name);
35     virtual void data (const char * s, int len);
36     virtual void pi (const char * target, const char * data);
37     virtual void warning (const char * message, int line, int column);
38     virtual void error (const char * message, int line, int column);
39
40 private:
41     void startParking(const XMLAttributes &atts);    
42     void startNode(const XMLAttributes &atts);
43     void startArc(const XMLAttributes &atts);
44   
45     FGGroundNetwork* _groundNetwork;
46     
47     std::string value;
48   
49     // map from local (groundnet.xml) ids to parking instances
50     typedef std::map<int, FGTaxiNodeRef> NodeIndexMap;
51     NodeIndexMap _indexMap;
52   
53   // data integrity - watch for unreferenced nodes and duplicated edges
54     typedef std::pair<int, int> IntPair;
55     std::set<IntPair> _arcSet;
56   
57     std::set<FGTaxiNodeRef> _unreferencedNodes;
58   
59     // map from allocated parking position to its local push-back node
60     // used to defer binding the push-back node until we've processed
61     // all nodes
62     typedef std::map<FGParkingRef, int> ParkingPushbackIndex;
63     ParkingPushbackIndex _parkingPushbacks;
64 };
65
66 #endif