All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
UniqueId.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_UNIQUEID_HH_
19 #define MANIFOLD_RNDF_UNIQUEID_HH_
20 
21 #include <iostream>
22 #include "manifold/Helpers.hh"
23 
24 namespace manifold
25 {
26  namespace rndf
27  {
32  {
34  public: UniqueId();
35 
41  public: explicit UniqueId(const int _x,
42  const int _y,
43  const int _z);
44 
47  public: UniqueId(const UniqueId &_other);
48 
50  public: virtual ~UniqueId();
51 
54  public: int X() const;
55 
61  public: bool SetX(const int _x);
62 
65  public: int Y() const;
66 
72  public: bool SetY(const int _y);
73 
76  public: int Z() const;
77 
83  public: bool SetZ(const int _z);
84 
87  public: bool Valid() const;
88 
92  public: bool operator==(const UniqueId &_other) const;
93 
97  public: bool operator!=(const UniqueId &_other) const;
98 
102  public: UniqueId &operator=(const UniqueId &_other);
103 
107  public: friend std::ostream &operator<<(std::ostream &_out,
108  const UniqueId &_id)
109  {
110  _out << _id.X() << "." << _id.Y() << "." << _id.Z();
111  return _out;
112  }
113 
115  private: int x;
116 
118  private: int y;
119 
121  private: int z;
122  };
123  }
124 }
125 #endif
#define MANIFOLD_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
int Z() const
Get the 'z' value.
int Y() const
Get the 'y' value.
friend std::ostream & operator<<(std::ostream &_out, const UniqueId &_id)
Stream insertion operator.
Definition: UniqueId.hh:107
int X() const
Get 'x' value.
A unique id of the form x.y.z, where x and z are positive numbers and y is non-negative.
Definition: UniqueId.hh:31