All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
Segment.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_SEGMENT_HH_
19 #define MANIFOLD_RNDF_SEGMENT_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "manifold/Helpers.hh"
27 
28 namespace manifold
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, rndf::Lane &_lane) const;
151 
155  public: bool UpdateLane(const rndf::Lane &_lane);
156 
162  public: bool AddLane(const rndf::Lane &_newLane);
163 
169  public: bool RemoveLane(const int _laneId);
170 
174 
177  public: std::string Name() const;
178 
181  public: void SetName(const std::string &_name) const;
182 
186 
188  public: bool Valid() const;
189 
193 
197  public: bool operator==(const Segment &_other) const;
198 
202  public: bool operator!=(const Segment &_other) const;
203 
207  public: Segment &operator=(const Segment &_other);
208 
211  private: std::unique_ptr<SegmentPrivate> dataPtr;
212  };
213  }
214 }
215 #endif
void SetName(const std::string &_name) const
Set the segment name.
SegmentHeader()
Default constructor.
#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 Name() const
Name.
A class that represents a road lane composed by a set of waypoints.
Definition: Lane.hh:220
bool Load(std::ifstream &_rndfFile, const int _segmentId, int &_lineNumber)
Parsing.
~SegmentHeader()=default
Destructor.
An internal private segment header class.
Definition: Segment.hh:39