Perimeter.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_PERIMETER_HH_
19 #define IGNITION_RNDF_PERIMETER_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <vector>
24 
25 #include "ignition/rndf/Helpers.hh"
26 
27 namespace ignition
28 {
29  namespace rndf
30  {
31  // Forward declarations.
32  class Exit;
33  class PerimeterHeaderPrivate;
34  class PerimeterPrivate;
35  class Waypoint;
36 
40  {
42  public: PerimeterHeader();
43 
45  public: ~PerimeterHeader() = default;
46 
50 
60  public: bool Load(std::ifstream &_rndfFile,
61  const int _zoneId,
62  const int _perimeterId,
63  int &_lineNumber);
64 
68 
71  public: unsigned int NumExits() const;
72 
75  public: std::vector<Exit> &Exits();
76 
79  public: const std::vector<Exit> &Exits() const;
80 
85  public: bool AddExit(const Exit &_newExit);
86 
91  public: bool RemoveExit(const Exit &_exit);
92 
94  private: std::unique_ptr<PerimeterHeaderPrivate> dataPtr;
95  };
96 
102  {
105  public: Perimeter();
106 
110  public: Perimeter(const Perimeter &_other);
111 
113  public: virtual ~Perimeter();
114 
118 
127  public: bool Load(std::ifstream &_rndfFile,
128  const int _zoneId,
129  int &_lineNumber);
130 
134 
137  public: unsigned int NumPoints() const;
138 
141  public: std::vector<rndf::Waypoint> &Points();
142 
145  public: const std::vector<rndf::Waypoint> &Points() const;
146 
151  public: bool Point(const int _wpId, rndf::Waypoint &_wp) const;
152 
156  public: bool UpdatePoint(const rndf::Waypoint &_wp);
157 
163  public: bool AddPoint(const rndf::Waypoint &_newWaypoint);
164 
170  public: bool RemovePoint(const int _wpId);
171 
175 
178  public: unsigned int NumExits() const;
179 
182  public: std::vector<Exit> &Exits();
183 
186  public: const std::vector<Exit> &Exits() const;
187 
192  public: bool AddExit(const Exit &_newExit);
193 
198  public: bool RemoveExit(const Exit &_exit);
199 
203 
205  public: bool Valid() const;
206 
210 
214  public: bool operator==(const Perimeter &_other) const;
215 
219  public: bool operator!=(const Perimeter &_other) const;
220 
224  public: Perimeter &operator=(const Perimeter &_other);
225 
228  private: std::unique_ptr<PerimeterPrivate> dataPtr;
229  };
230  }
231 }
232 #endif
bool Load(std::ifstream &_rndfFile, const int _zoneId, const int _perimeterId, int &_lineNumber)
Parsing.
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
bool AddExit(const Exit &_newExit)
Add a new exit.
std::vector< Exit > & Exits()
Get a mutable reference to the vector of exits.
unsigned int NumExits() const
Exits.
PerimeterHeader()
Default constructor.
~PerimeterHeader()=default
Destructor.
Abstraction for representing a perimeter as a collection of perimeter points.
Definition: Perimeter.hh:101
bool RemoveExit(const Exit &_exit)
Remove an existing exit.
Definition: Perimeter.hh:39
An exit clas that shows how to go from an exit waypoint to an entry waypoint.
Definition: Exit.hh:32
Definition: Checkpoint.hh:25
A reference point.
Definition: Waypoint.hh:42