ParkingSpot.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_PARKINGSPOT_HH_
19 #define IGNITION_RNDF_PARKINGSPOT_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 Checkpoint;
33  class ParkingSpotPrivate;
34  class ParkingSpotHeaderPrivate;
35  class Waypoint;
36 
40  {
42  public: ParkingSpotHeader();
43 
45  public: ~ParkingSpotHeader() = default;
46 
50 
60  public: bool Load(std::ifstream &_rndfFile,
61  const int _zoneId,
62  const int _spotId,
63  int &_lineNumber);
64 
68 
71  public: double Width() const;
72 
77  public: bool SetWidth(const double _newWidth);
78 
82 
85  public: rndf::Checkpoint &Checkpoint();
86 
89  public: const rndf::Checkpoint &Checkpoint() const;
90 
92  private: std::unique_ptr<ParkingSpotHeaderPrivate> dataPtr;
93  };
94 
97  {
99  public: ParkingSpot();
100 
103  public: explicit ParkingSpot(const int _spotId);
104 
107  public: ParkingSpot(const ParkingSpot &_other);
108 
110  public: virtual ~ParkingSpot();
111 
115 
124  public: bool Load(std::ifstream &_rndfFile,
125  const int _zoneId,
126  int &_lineNumber);
127 
131 
134  public: int Id() const;
135 
141  public: bool SetId(const int _id);
142 
146 
149  public: unsigned int NumWaypoints() const;
150 
153  public: std::vector<rndf::Waypoint> &Waypoints();
154 
157  public: const std::vector<rndf::Waypoint> &Waypoints() const;
158 
163  public: bool Waypoint(const int _wpId,
164  rndf::Waypoint &_wp) const;
165 
169  public: bool UpdateWaypoint(const rndf::Waypoint &_wp);
170 
176  public: bool AddWaypoint(const rndf::Waypoint &_newWaypoint);
177 
183  public: bool RemoveWaypoint(const int _wpId);
184 
188 
191  public: double Width() const;
192 
197  public: bool SetWidth(const double _newWidth);
198 
202 
205  public: rndf::Checkpoint &Checkpoint();
206 
209  public: const rndf::Checkpoint &Checkpoint() const;
210 
214 
216  public: bool Valid() const;
217 
221 
225  public: bool operator==(const ParkingSpot &_other) const;
226 
230  public: bool operator!=(const ParkingSpot &_other) const;
231 
235  public: ParkingSpot &operator=(const ParkingSpot &_other);
236 
239  private: std::unique_ptr<ParkingSpotPrivate> dataPtr;
240  };
241  }
242 }
243 #endif
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
An abstraction for representing a parking spot within a zone.
Definition: ParkingSpot.hh:96
ParkingSpotHeader()
Default constructor.
bool Load(std::ifstream &_rndfFile, const int _zoneId, const int _spotId, int &_lineNumber)
Parsing.
bool SetWidth(const double _newWidth)
Set the parking spot width.
A checkpoint is a waypoint that has to be visited.
Definition: Checkpoint.hh:34
Definition: ParkingSpot.hh:39
~ParkingSpotHeader()=default
Destructor.
Definition: Checkpoint.hh:25
double Width() const
Width.
rndf::Checkpoint & Checkpoint()
Checkpoint.
A reference point.
Definition: Waypoint.hh:42