All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
RNDF.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef MANIFOLD_RNDF_RNDF_HH_
19 #define MANIFOLD_RNDF_RNDF_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "manifold/rndf/Lane.hh"
27 #include "manifold/Helpers.hh"
28 
29 namespace manifold
30 {
31  namespace rndf
32  {
33  // Forward declarations.
34  class RNDFHeaderPrivate;
35  class RNDFPrivate;
36  class Segment;
37  class UniqueId;
38  class Zone;
39 
40  // \internal
42  class RNDFHeader
43  {
45  public: RNDFHeader();
46 
48  public: ~RNDFHeader() = default;
49 
53 
61  public: bool Load(std::ifstream &_rndfFile,
62  int &_lineNumber);
63 
67 
70  public: std::string Version() const;
71 
74  public: void SetVersion(const std::string &_version) const;
75 
79 
82  public: std::string Date() const;
83 
86  public: void SetDate(const std::string &_newDate) const;
87 
89  private: std::unique_ptr<RNDFHeaderPrivate> dataPtr;
90  };
91 
96  {
98  public: RNDF();
99 
102  public: explicit RNDF(const std::string &_filepath);
103 
105  public: virtual ~RNDF();
106 
110 
116  public: bool Load(const std::string &_filePath);
117 
121 
124  public: std::string Name() const;
125 
128  public: void SetName(const std::string &_name);
129 
133 
136  public: unsigned int NumSegments() const;
137 
140  public: std::vector<rndf::Segment> &Segments();
141 
144  public: const std::vector<rndf::Segment> &Segments() const;
145 
150  public: bool Segment(const int _segmentId, rndf::Segment &_segment) const;
151 
155  public: bool UpdateSegment(const rndf::Segment &_segment);
156 
162  public: bool AddSegment(const rndf::Segment &_newSegment);
163 
169  public: bool RemoveSegment(const int _segmentId);
170 
174 
177  public: unsigned int NumZones() const;
178 
181  public: std::vector<rndf::Zone> &Zones();
182 
185  public: const std::vector<rndf::Zone> &Zones() const;
186 
191  public: bool Zone(const int _zoneId, rndf::Zone &_zone) const;
192 
196  public: bool UpdateZone(const rndf::Zone &_zone);
197 
203  public: bool AddZone(const rndf::Zone &_newZone);
204 
210  public: bool RemoveZone(const int _zoneId);
211 
215 
218  public: std::string Version() const;
219 
222  public: void SetVersion(const std::string &_version) const;
223 
227 
230  public: std::string Date() const;
231 
234  public: void SetDate(const std::string &_newDate) const;
235 
239 
241  public: bool Valid() const;
242 
245  private: std::unique_ptr<RNDFPrivate> dataPtr;
246  };
247  }
248 }
249 #endif
void SetVersion(const std::string &_version) const
Set the format version.
An abstraction for representing areas within free vehicle movement is permitted.
Definition: Zone.hh:85
~RNDFHeader()=default
Destructor.
RNDFHeader()
Default constructor.
std::string Version() const
Version.
void SetDate(const std::string &_newDate) const
Set the creation date.
#define MANIFOLD_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
Abstraction for representing road segments.
Definition: Segment.hh:82
std::string Date() const
Date.
bool Load(std::ifstream &_rndfFile, int &_lineNumber)
Parsing.
An internal private RNDF header class.
Definition: RNDF.hh:42
An abstraction to represent a Route Network Definition File (RNDF).
Definition: RNDF.hh:95