SectorZone: add attribute arc_boundary
[xcsoar.git] / src / Task / Deserialiser.hpp
blobb5774fa56876f5703816e95440da1220f49cdf1c
1 /* Copyright_License {
3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef DESERIALISER_HPP
23 #define DESERIALISER_HPP
25 #include "Task/Factory/TaskFactoryType.hpp"
26 #include "Task/Ordered/OrderedTaskBehaviour.hpp"
28 #include <tchar.h>
30 class DataNode;
31 struct GeoPoint;
32 struct Waypoint;
33 class Waypoints;
34 class OrderedTask;
35 class ObservationZonePoint;
37 /**
38 * Class to serialise and de-serialise tasks to/from a #DataNode structure
40 class Deserialiser
42 DataNode &node;
44 const Waypoints *waypoints;
46 public:
47 /**
48 * Constructor
50 * @param the_node Node this Deserialiser will edit
51 * @param _waypoints a waypoint database to merge with (optional)
53 * @return Initialised object
55 Deserialiser(DataNode &_node, const Waypoints *_waypoints=nullptr)
56 :node(_node), waypoints(_waypoints) {}
58 /**
59 * De-serialise a task (create a task to reflect the DataNode structure)
61 * @param data OrderedTask to serialise
63 void Deserialise(OrderedTask &task);
65 protected:
66 /**
67 * Deserialise OrderedTaskBehaviour
69 * @param data Item to deserialise
71 void Deserialise(OrderedTaskBehaviour &data);
73 /**
74 * Deserialise a Waypoint; client responsible for deletion
76 * @return Newly constructed Waypoint or nullptr on failure
78 Waypoint* DeserialiseWaypoint();
80 /**
81 * Deserialise a GeoPoint
83 * @param data Item to deserialise
85 void Deserialise(GeoPoint &data);
87 /**
88 * Deserialise an ObservationZonePoint; client responsible for deletion
90 * @param wp Waypoint base of point
91 * @param is_turnpoint Whether the point is a turnpoint
93 * @return Newly constructed ObservationZonePoint or nullptr on failure
95 ObservationZonePoint* DeserialiseOZ(const Waypoint &wp, bool is_turnpoint);
97 /**
98 * Deserialise a point, appending it to the task
100 * @param data OrderedTask to append to
102 void DeserialiseTaskpoint(OrderedTask &data);
104 private:
105 AltitudeReference GetHeightRef(const TCHAR *nodename) const;
106 TaskFactoryType GetTaskFactoryType() const;
109 #endif