directions.h
Go to the documentation of this file.
1 #ifndef SLAM_CTOR_TESTS_DIRECTIONS
2 #define SLAM_CTOR_TESTS_DIRECTIONS
3 
4 class Directions {
5 private:
6  constexpr static int Left_Id = 1 << 0;
7  constexpr static int Right_Id = 1 << 1;
8  constexpr static int Top_Id = 1 << 2;
9  constexpr static int Bot_Id = 1 << 3;
10 public:
11  Directions& set_left() { _data |= Left_Id; return *this; }
12  Directions& set_right() { _data |= Right_Id; return *this; }
13  Directions& set_top() { _data |= Top_Id; return *this; }
14  Directions& set_bot() { _data |= Bot_Id; return *this; }
15 
16  bool left() const { return _data & Left_Id; }
17  bool right() const { return _data & Right_Id; }
18  bool top() const { return _data & Top_Id; }
19  bool bot() const { return _data & Bot_Id; }
20  int horz() const {
21  if (left() ^ right()) { return left() ? -1 : 1; }
22  return 0;
23  }
24  int vert() const {
25  if (bot() ^ top()) { return bot() ? -1 : 1; }
26  return 0;
27  }
28 
29 private:
30  int _data = 0;
31 };
32 
33 #endif
static constexpr int Right_Id
Definition: directions.h:7
bool right() const
Definition: directions.h:17
Directions & set_right()
Definition: directions.h:12
int horz() const
Definition: directions.h:20
bool bot() const
Definition: directions.h:19
bool left() const
Definition: directions.h:16
Directions & set_left()
Definition: directions.h:11
static constexpr int Left_Id
Definition: directions.h:6
int vert() const
Definition: directions.h:24
static constexpr int Top_Id
Definition: directions.h:8
Directions & set_bot()
Definition: directions.h:14
static constexpr int Bot_Id
Definition: directions.h:9
bool top() const
Definition: directions.h:18
Directions & set_top()
Definition: directions.h:13


slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25