All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
ParkingSpot.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_PARKINGSPOT_HH_
19 #define MANIFOLD_RNDF_PARKINGSPOT_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 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 
75  public: bool SetWidth(const double _newWidth);
76 
80 
83  public: rndf::Checkpoint &Checkpoint();
84 
87  public: const rndf::Checkpoint &Checkpoint() const;
88 
90  private: std::unique_ptr<ParkingSpotHeaderPrivate> dataPtr;
91  };
92 
95  {
97  public: ParkingSpot();
98 
101  public: explicit ParkingSpot(const int _spotId);
102 
105  public: ParkingSpot(const ParkingSpot &_other);
106 
108  public: virtual ~ParkingSpot();
109 
113 
122  public: bool Load(std::ifstream &_rndfFile,
123  const int _zoneId,
124  int &_lineNumber);
125 
129 
132  public: int Id() const;
133 
139  public: bool SetId(const int _id);
140 
144 
147  public: unsigned int NumWaypoints() const;
148 
151  public: std::vector<rndf::Waypoint> &Waypoints();
152 
155  public: const std::vector<rndf::Waypoint> &Waypoints() const;
156 
161  public: bool Waypoint(const int _wpId,
162  rndf::Waypoint &_wp) const;
163 
167  public: bool UpdateWaypoint(const rndf::Waypoint &_wp);
168 
174  public: bool AddWaypoint(const rndf::Waypoint &_newWaypoint);
175 
181  public: bool RemoveWaypoint(const int _wpId);
182 
186 
189  public: double Width() const;
190 
193  public: bool SetWidth(const double _newWidth);
194 
198 
201  public: rndf::Checkpoint &Checkpoint();
202 
205  public: const rndf::Checkpoint &Checkpoint() const;
206 
210 
212  public: bool Valid() const;
213 
217 
221  public: bool operator==(const ParkingSpot &_other) const;
222 
226  public: bool operator!=(const ParkingSpot &_other) const;
227 
231  public: ParkingSpot &operator=(const ParkingSpot &_other);
232 
235  private: std::unique_ptr<ParkingSpotPrivate> dataPtr;
236  };
237  }
238 }
239 #endif
A reference point.
Definition: Waypoint.hh:42
rndf::Checkpoint & Checkpoint()
Checkpoint.
bool Load(std::ifstream &_rndfFile, const int _zoneId, const int _spotId, int &_lineNumber)
Parsing.
ParkingSpotHeader()
Default constructor.
#define MANIFOLD_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
Definition: ParkingSpot.hh:39
A checkpoint is a waypoint that has to be visited.
Definition: Checkpoint.hh:34
double Width() const
Width.
An abstraction for representing a parking spot within a zone.
Definition: ParkingSpot.hh:94
~ParkingSpotHeader()=default
Destructor.
bool SetWidth(const double _newWidth)
Set the parking spot width.