All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
Lane.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_LANE_HH_
19 #define MANIFOLD_RNDF_LANE_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <vector>
24 
25 #include "manifold/Helpers.hh"
26 
27 namespace manifold
28 {
29  namespace rndf
30  {
31  // Forward declarations.
32  class Checkpoint;
33  class Exit;
34  class LaneHeaderPrivate;
35  class LanePrivate;
36  class Waypoint;
37 
39  enum class Marking
40  {
50  UNDEFINED,
51  };
52 
55  class LaneHeader
56  {
58  public: LaneHeader();
59 
61  public: ~LaneHeader() = default;
62 
66 
76  public: bool Load(std::ifstream &_rndfFile,
77  const int _segmentId,
78  const int _laneId,
79  int &_lineNumber);
80 
84 
87  public: double Width() const;
88 
91  public: bool SetWidth(const double _newWidth);
92 
96 
99  public: Marking LeftBoundary() const;
100 
103  public: void SetLeftBoundary(const Marking &_boundary);
104 
107  public: Marking RightBoundary() const;
108 
111  public: void SetRightBoundary(const Marking &_boundary);
112 
116 
119  public: unsigned int NumCheckpoints() const;
120 
123  public: std::vector<rndf::Checkpoint> &Checkpoints();
124 
127  public: const std::vector<rndf::Checkpoint> &Checkpoints() const;
128 
133  public: bool Checkpoint(const int _cpId, rndf::Checkpoint &_cp) const;
134 
139  public: bool UpdateCheckpoint(const rndf::Checkpoint &_cp);
140 
146  public: bool AddCheckpoint(const rndf::Checkpoint &_newCheckpoint);
147 
153  public: bool RemoveCheckpoint(const int _cpId);
154 
158 
161  public: unsigned int NumStops() const;
162 
166  public: std::vector<int> &Stops();
167 
170  public: const std::vector<int> &Stops() const;
171 
177  public: bool AddStop(const int _waypointId);
178 
184  public: bool RemoveStop(const int _waypointId);
185 
189 
192  public: unsigned int NumExits() const;
193 
196  public: std::vector<Exit> &Exits();
197 
200  public: const std::vector<Exit> &Exits() const;
201 
206  public: bool AddExit(const Exit &_newExit);
207 
212  public: bool RemoveExit(const Exit &_exit);
213 
215  private: std::unique_ptr<LaneHeaderPrivate> dataPtr;
216  };
217 
221  {
224  public: Lane();
225 
229  public: explicit Lane(const int _id);
230 
234  public: explicit Lane(const Lane &_other);
235 
237  public: virtual ~Lane();
238 
242 
249  public: bool Load(std::ifstream &_rndfFile,
250  const int _segmentId,
251  int &_lineNumber);
252 
256 
259  public: int Id() const;
260 
266  public: bool SetId(const int _id);
267 
271 
274  public: unsigned int NumWaypoints() const;
275 
278  public: std::vector<rndf::Waypoint> &Waypoints();
279 
282  public: const std::vector<rndf::Waypoint> &Waypoints() const;
283 
288  public: bool Waypoint(const int _wpId, rndf::Waypoint &_wp) const;
289 
293  public: bool UpdateWaypoint(const rndf::Waypoint &_wp);
294 
300  public: bool AddWaypoint(const rndf::Waypoint &_newWaypoint);
301 
307  public: bool RemoveWaypoint(const int _wpId);
308 
312 
315  public: double Width() const;
316 
319  public: bool SetWidth(const double _newWidth);
320 
324 
327  public: Marking LeftBoundary() const;
328 
331  public: void SetLeftBoundary(const Marking &_boundary);
332 
335  public: Marking RightBoundary() const;
336 
339  public: void SetRightBoundary(const Marking &_boundary);
340 
344 
347  public: unsigned int NumCheckpoints() const;
348 
351  public: std::vector<rndf::Checkpoint> &Checkpoints();
352 
355  public: const std::vector<rndf::Checkpoint> &Checkpoints() const;
356 
361  public: bool Checkpoint(const int _cpId, rndf::Checkpoint &_cp) const;
362 
367  public: bool UpdateCheckpoint(const rndf::Checkpoint &_cp);
368 
374  public: bool AddCheckpoint(const rndf::Checkpoint &_newCheckpoint);
375 
381  public: bool RemoveCheckpoint(const int _cpId);
382 
386 
389  public: unsigned int NumStops() const;
390 
394  public: std::vector<int> &Stops();
395 
398  public: const std::vector<int> &Stops() const;
399 
405  public: bool AddStop(const int _waypointId);
406 
412  public: bool RemoveStop(const int _waypointId);
413 
417 
420  public: unsigned int NumExits() const;
421 
424  public: std::vector<Exit> &Exits();
425 
428  public: const std::vector<Exit> &Exits() const;
429 
434  public: bool AddExit(const Exit &_newExit);
435 
440  public: bool RemoveExit(const Exit &_exit);
441 
445 
447  public: bool Valid() const;
448 
452 
456  public: bool operator==(const Lane &_other) const;
457 
461  public: bool operator!=(const Lane &_other) const;
462 
466  public: Lane &operator=(const Lane &_other);
467 
470  private: std::unique_ptr<LanePrivate> dataPtr;
471  };
472  }
473 }
474 #endif
Definition: Lane.hh:55
unsigned int NumStops() const
Stops.
double Width() const
Width.
bool AddCheckpoint(const rndf::Checkpoint &_newCheckpoint)
Add a new checkpoint.
bool AddStop(const int _waypointId)
Add a new stop.
std::vector< rndf::Checkpoint > & Checkpoints()
Get a mutable reference to the vector of checkpoints;.
A reference point.
Definition: Waypoint.hh:42
Marking LeftBoundary() const
Boundaries.
LaneHeader()
Default constructor.
An exit clas that shows how to go from an exit waypoint to an entry waypoint.
Definition: Exit.hh:32
Marking RightBoundary() const
Get the right boundary type.
void SetRightBoundary(const Marking &_boundary)
Set the new right boundary type.
unsigned int NumExits() const
Exits.
std::vector< Exit > & Exits()
Get a mutable reference to the vector of exits.
bool SetWidth(const double _newWidth)
Set the lane width.
bool Checkpoint(const int _cpId, rndf::Checkpoint &_cp) const
Get the details of one of the checkpoints with Id _cpId.
bool UpdateCheckpoint(const rndf::Checkpoint &_cp)
Update an existing checkpoint.
bool RemoveStop(const int _waypointId)
Remove an existing stop.
void SetLeftBoundary(const Marking &_boundary)
Set the new left boundary type.
#define MANIFOLD_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
bool RemoveExit(const Exit &_exit)
Remove an existing exit.
Marking
Definition: Lane.hh:39
unsigned int NumCheckpoints() const
Checkpoints.
A checkpoint is a waypoint that has to be visited.
Definition: Checkpoint.hh:34
bool AddExit(const Exit &_newExit)
Add a new exit.
~LaneHeader()=default
Destructor.
bool RemoveCheckpoint(const int _cpId)
Remove an existing checkpoint.
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, const int _laneId, int &_lineNumber)
Parsing.
std::vector< int > & Stops()
Get a mutable reference to the vector of stops.