Segment.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 IGNITION_RNDF_SEGMENT_HH_
19 #define IGNITION_RNDF_SEGMENT_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "ignition/rndf/Helpers.hh"
27 
28 namespace ignition
29 {
30  namespace rndf
31  {
32  // Forward declarations.
33  class Lane;
34  class SegmentHeaderPrivate;
35  class SegmentPrivate;
36 
37  // \internal
40  {
42  public: SegmentHeader();
43 
45  public: ~SegmentHeader() = default;
46 
50 
59  public: bool Load(std::ifstream &_rndfFile,
60  const int _segmentId,
61  int &_lineNumber);
62 
66 
69  public: std::string Name() const;
70 
73  public: void SetName(const std::string &_name) const;
74 
76  private: std::unique_ptr<SegmentHeaderPrivate> dataPtr;
77  };
78 
83  {
86  public: Segment();
87 
91  public: explicit Segment(const int _id);
92 
96  public: Segment(const Segment &_other);
97 
99  public: virtual ~Segment();
100 
104 
112  public: bool Load(std::ifstream &_rndfFile,
113  int &_lineNumber);
114 
118 
121  public: int Id() const;
122 
128  public: bool SetId(const int _id);
129 
133 
136  public: unsigned int NumLanes() const;
137 
140  public: std::vector<rndf::Lane> &Lanes();
141 
144  public: const std::vector<rndf::Lane> &Lanes() const;
145 
150  public: bool Lane(const int _laneId,
151  rndf::Lane &_lane) const;
152 
156  public: bool UpdateLane(const rndf::Lane &_lane);
157 
163  public: bool AddLane(const rndf::Lane &_newLane);
164 
170  public: bool RemoveLane(const int _laneId);
171 
175 
178  public: std::string Name() const;
179 
182  public: void SetName(const std::string &_name) const;
183 
187 
189  public: bool Valid() const;
190 
194 
198  public: bool operator==(const Segment &_other) const;
199 
203  public: bool operator!=(const Segment &_other) const;
204 
208  public: Segment &operator=(const Segment &_other);
209 
212  private: std::unique_ptr<SegmentPrivate> dataPtr;
213  };
214  }
215 }
216 #endif
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
void SetName(const std::string &_name) const
Set the segment name.
Abstraction for representing road segments.
Definition: Segment.hh:82
A class that represents a road lane composed by a set of waypoints.
Definition: Lane.hh:220
~SegmentHeader()=default
Destructor.
bool Load(std::ifstream &_rndfFile, const int _segmentId, int &_lineNumber)
Parsing.
SegmentHeader()
Default constructor.
std::string Name() const
Name.
An internal private segment header class.
Definition: Segment.hh:39
Definition: Checkpoint.hh:25