FlightGear next
dynamicloader.hxx
Go to the documentation of this file.
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
26class FGGroundNetXMLLoader : public XMLVisitor {
27public:
29
30 bool hasErrors() const
31 {
32 return _hasErrors;
33 }
34
35protected:
36 virtual void startXML ();
37 virtual void endXML ();
38 virtual void startElement (const char * name, const XMLAttributes &atts);
39 virtual void endElement (const char * name);
40 virtual void data (const char * s, int len);
41 virtual void pi (const char * target, const char * data);
42 virtual void warning (const char * message, int line, int column);
43 virtual void error (const char * message, int line, int column);
44
45private:
46 void startParking(const XMLAttributes &atts);
47 void startNode(const XMLAttributes &atts);
48 void startArc(const XMLAttributes &atts);
49
50 FGGroundNetwork* _groundNetwork;
51
52 // we set this flag if the ground-network has any problems
53 bool _hasErrors = false;
54
55 std::string value;
56
57 // map from local (groundnet.xml) ids to parking instances
58 typedef std::map<int, FGTaxiNodeRef> NodeIndexMap;
59 NodeIndexMap _indexMap;
60
61 // data integrity - watch for unreferenced nodes and duplicated edges
62 typedef std::pair<int, int> IntPair;
63 std::set<IntPair> _arcSet;
64
65 std::set<FGTaxiNodeRef> _unreferencedNodes;
66
67 // map from allocated parking position to its local push-back node
68 // used to defer binding the push-back node until we've processed
69 // all nodes
70 typedef std::map<FGParkingRef, int> ParkingPushbackIndex;
71 ParkingPushbackIndex _parkingPushbacks;
72};
73
74#endif
virtual void endXML()
virtual void startElement(const char *name, const XMLAttributes &atts)
virtual void warning(const char *message, int line, int column)
virtual void data(const char *s, int len)
FGGroundNetXMLLoader(FGGroundNetwork *gn)
virtual void startXML()
virtual void error(const char *message, int line, int column)
virtual void endElement(const char *name)
const char * name
static const double pi
Definition sview.cxx:59