Horizon
target.hpp
1 #pragma once
2 #include "common/common.hpp"
3 #include "util/uuid_path.hpp"
4 #include "util/layer_range.hpp"
5 
6 namespace horizon {
7 class Target {
8 public:
9  UUIDPath<2> path;
10  ObjectType type;
11  Coordi p;
12  unsigned int vertex = 0;
13  LayerRange layer = 10000;
14  Target(const UUIDPath<2> &uu, ObjectType ot, const Coordi &pi, unsigned int v = 0, LayerRange l = 10000)
15  : path(uu), type(ot), p(pi), vertex(v), layer(l){};
16  Target() : type(ObjectType::INVALID){};
17  bool is_valid() const
18  {
19  return type != ObjectType::INVALID;
20  }
21  bool operator<(const Target &other) const
22  {
23  if (type < other.type) {
24  return true;
25  }
26  if (type > other.type) {
27  return false;
28  }
29  if (path < other.path) {
30  return true;
31  }
32  else if (other.path < path) {
33  return false;
34  }
35  return vertex < other.vertex;
36  }
37  bool operator==(const Target &other) const
38  {
39  return (path == other.path) && (vertex == other.vertex) && (type == other.type);
40  }
41 };
42 } // namespace horizon