Zone.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_ZONE_HH_
19 #define IGNITION_RNDF_ZONE_HH_
20 
21 #include <iosfwd>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "ignition/rndf/Helpers.hh"
27 
28 namespace ignition
29 {
30  namespace rndf
31  {
32  // Forward declarations.
33  class ParkingSpot;
34  class Perimeter;
35  class ZoneHeaderPrivate;
36  class ZonePrivate;
37 
40  class ZoneHeader
41  {
43  public: ZoneHeader();
44 
46  public: ~ZoneHeader() = default;
47 
51 
60  public: bool Load(std::ifstream &_rndfFile,
61  const int _zoneId,
62  int &_lineNumber);
63 
67 
70  public: std::string Name() const;
71 
74  public: void SetName(const std::string &_name) const;
75 
77  private: std::unique_ptr<ZoneHeaderPrivate> dataPtr;
78  };
79 
86  {
89  public: explicit Zone();
90 
94  public: explicit Zone(const int _id);
95 
99  public: Zone(const Zone &_other);
100 
102  public: virtual ~Zone();
103 
107 
115  public: bool Load(std::ifstream &_rndfFile,
116  int &_lineNumber);
117 
121 
124  public: int Id() const;
125 
130  public: bool SetId(const int _id);
131 
135 
138  public: unsigned int NumSpots() const;
139 
142  public: std::vector<ParkingSpot> &Spots();
143 
146  public: const std::vector<ParkingSpot> &Spots() const;
147 
152  public: bool Spot(const int _psId,
153  ParkingSpot &_ps) const;
154 
158  public: bool UpdateSpot(const ParkingSpot &_ps);
159 
165  public: bool AddSpot(const ParkingSpot &_newSpot);
166 
172  public: bool RemoveSpot(const int _psId);
173 
177 
180  public: rndf::Perimeter &Perimeter();
181 
184  public: const rndf::Perimeter &Perimeter() const;
185 
189 
192  public: std::string Name() const;
193 
196  public: void SetName(const std::string &_name) const;
197 
201 
204  public: bool Valid() const;
205 
209 
213  public: bool operator==(const Zone &_other) const;
214 
218  public: bool operator!=(const Zone &_other) const;
219 
223  public: Zone &operator=(const Zone &_other);
224 
227  private: std::unique_ptr<ZonePrivate> dataPtr;
228  };
229  }
230 }
231 #endif
Definition: Zone.hh:40
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
std::string Name() const
Name.
bool Load(std::ifstream &_rndfFile, const int _zoneId, int &_lineNumber)
Parsing.
An abstraction for representing a parking spot within a zone.
Definition: ParkingSpot.hh:96
~ZoneHeader()=default
Destructor.
An abstraction for representing areas within free vehicle movement is permitted.
Definition: Zone.hh:85
Abstraction for representing a perimeter as a collection of perimeter points.
Definition: Perimeter.hh:101
void SetName(const std::string &_name) const
Set the zone name.
Definition: Checkpoint.hh:25
ZoneHeader()
Default constructor.