UniqueId.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_UNIQUEID_HH_
19 #define IGNITION_RNDF_UNIQUEID_HH_
20 
21 #include <iostream>
22 #include <string>
23 #include "ignition/rndf/Helpers.hh"
24 
25 namespace ignition
26 {
27  namespace rndf
28  {
33  {
35  public: UniqueId();
36 
41  public: explicit UniqueId(const int _x,
42  const int _y,
43  const int _z);
44 
47  public: explicit UniqueId(const std::string &_id);
48 
51  public: UniqueId(const UniqueId &_other);
52 
54  public: virtual ~UniqueId();
55 
58  public: int X() const;
59 
65  public: bool SetX(const int _x);
66 
69  public: int Y() const;
70 
76  public: bool SetY(const int _y);
77 
80  public: int Z() const;
81 
87  public: bool SetZ(const int _z);
88 
91  public: bool Valid() const;
92 
95  public: std::string String() const;
96 
100  public: bool operator==(const UniqueId &_other) const;
101 
105  public: bool operator!=(const UniqueId &_other) const;
106 
110  public: UniqueId &operator=(const UniqueId &_other);
111 
115  public: friend std::ostream &operator<<(std::ostream &_out,
116  const UniqueId &_id)
117  {
118  _out << _id.X() << "." << _id.Y() << "." << _id.Z();
119  return _out;
120  }
121 
123  private: int x;
124 
126  private: int y;
127 
129  private: int z;
130  };
131  }
132 }
133 #endif
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
int Y() const
Get the &#39;y&#39; value.
friend std::ostream & operator<<(std::ostream &_out, const UniqueId &_id)
Stream insertion operator.
Definition: UniqueId.hh:115
A unique id of the form x.y.z, where x and z are positive numbers and y is a non-negative number (per...
Definition: UniqueId.hh:32
Definition: Checkpoint.hh:25
int Z() const
Get the &#39;z&#39; value.
int X() const
Get &#39;x&#39; value.