SectorZone: add attribute arc_boundary
[xcsoar.git] / src / Task / Serialiser.hpp
blobefe6152e743eafb6ed5b303dc314e7d47eba3832
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 SERIALISER_HPP
23 #define SERIALISER_HPP
25 #include "Task/Visitors/TaskPointVisitor.hpp"
26 #include "Task/Factory/TaskFactoryType.hpp"
27 #include "Task/Ordered/OrderedTaskBehaviour.hpp"
29 #include <tchar.h>
31 class DataNode;
32 struct GeoPoint;
33 struct Waypoint;
34 class OrderedTask;
35 class OrderedTaskPoint;
36 class ObservationZonePoint;
37 class SectorZone;
38 class LineSectorZone;
39 class CylinderZone;
40 class AnnularSectorZone;
41 class SymmetricSectorZone;
43 /**
44 * Class to serialise and de-serialise tasks to/from a #DataNode structure
46 class Serialiser {
47 DataNode &node;
49 bool mode_optional_start;
51 public:
52 /**
53 * Constructor
55 * @param the_node Node this serialiser will edit
56 * @param _waypoints a waypoint database to merge with (optional)
58 * @return Initialised object
60 Serialiser(DataNode &_node)
61 :node(_node), mode_optional_start(false) {};
63 /**
64 * Serialise a task (create a DataNode structure to reflect the task)
66 * @param data OrderedTask to serialise
68 void Serialise(const OrderedTask &task);
70 void Visit(const SectorZone &data);
71 void Visit(const LineSectorZone &data);
72 void Visit(const CylinderZone &data);
73 void Visit(const AnnularSectorZone &data);
74 void Visit(const SymmetricSectorZone &data);
76 protected:
77 /**
78 * Serialise OrderedTaskBehaviour
80 * @param data Item to serialise
82 void Serialise(const OrderedTaskBehaviour &data);
84 /**
85 * Serialise a Waypoint
87 * @param data Item to serialise
89 void Serialise(const Waypoint &data);
91 /**
92 * Serialise a GeoPoint
94 * @param data Item to serialise
96 void Serialise(const GeoPoint &data);
98 /**
99 * Serialise an ObservationZonePoint
101 * @param data Item to serialise
103 void Serialise(const ObservationZonePoint &data);
105 /**
106 * Serialise an OrderedTaskPoint
108 * @param data Item to serialise
109 * @param name Type of point
111 void Serialise(const OrderedTaskPoint &data, const TCHAR* name);
112 void Serialise(const OrderedTaskPoint &tp);
114 private:
115 const TCHAR *GetTaskFactoryType(TaskFactoryType type) const;
116 const TCHAR *GetHeightRef(AltitudeReference height_ref) const;
119 #endif