ARMS  3.1.1
Documentation for ARMS movement library
flags.h
1 #ifndef _ARMS_FLAGS_H_
2 #define _ARMS_FLAGS_H_
3 
4 namespace arms {
5 
40 struct MoveFlags {
41 
42  bool async;
43  bool relative;
44  bool thru;
45  bool reverse;
47  MoveFlags operator|(MoveFlags& o) {
48  MoveFlags ret;
49  ret.async = async || o.async;
50  ret.relative = relative || o.relative;
51  ret.thru = thru || o.thru;
52  ret.reverse = reverse || o.reverse;
53  return ret;
54  }
55 
56  MoveFlags operator&(MoveFlags& o) {
57  MoveFlags ret;
58  ret.async = async && o.async;
59  ret.relative = relative && o.relative;
60  ret.thru = thru && o.thru;
61  ret.reverse = reverse && o.reverse;
62  return ret;
63  }
64 
65  MoveFlags operator|(const MoveFlags& o) {
66  MoveFlags ret;
67  ret.async = async || o.async;
68  ret.relative = relative || o.relative;
69  ret.thru = thru || o.thru;
70  ret.reverse = reverse || o.reverse;
71  return ret;
72  }
73 
74  MoveFlags operator&(const MoveFlags& o) {
75  MoveFlags ret;
76  ret.async = async && o.async;
77  ret.relative = relative && o.relative;
78  ret.thru = thru && o.thru;
79  ret.reverse = reverse && o.reverse;
80  return ret;
81  }
82 
83  operator bool() {
84  return async || relative || thru || reverse;
85  }
87 };
89 inline MoveFlags operator|(const MoveFlags& f, MoveFlags& o) {
90  MoveFlags ret;
91  ret.async = f.async || o.async;
92  ret.relative = f.relative || o.relative;
93  ret.thru = f.thru || o.thru;
94  ret.reverse = f.reverse || o.reverse;
95  return ret;
96 }
97 
98 inline MoveFlags operator&(const MoveFlags& f, MoveFlags& o) {
99  MoveFlags ret;
100  ret.async = f.async && o.async;
101  ret.relative = f.relative && o.relative;
102  ret.thru = f.thru && o.thru;
103  ret.reverse = f.reverse && o.reverse;
104  return ret;
105 }
106 
107 inline MoveFlags operator|(const MoveFlags& f, const MoveFlags& o) {
108  MoveFlags ret;
109  ret.async = f.async || o.async;
110  ret.relative = f.relative || o.relative;
111  ret.thru = f.thru || o.thru;
112  ret.reverse = f.reverse || o.reverse;
113  return ret;
114 }
115 
116 inline MoveFlags operator&(const MoveFlags& f, const MoveFlags& o) {
117  MoveFlags ret;
118  ret.async = f.async && o.async;
119  ret.relative = f.relative && o.relative;
120  ret.thru = f.thru && o.thru;
121  ret.reverse = f.reverse && o.reverse;
122  return ret;
123 }
125 
129 const MoveFlags NONE = {false, false, false, false};
133 const MoveFlags ASYNC = {true, false, false, false};
137 const MoveFlags RELATIVE = {false, true, false, false};
141 const MoveFlags THRU = {false, false, true, false};
145 const MoveFlags REVERSE = {false, false, false, true};
146 
147 } // namespace arms
148 
149 #endif
Definition: flags.h:40
bool relative
Definition: flags.h:43
bool async
Definition: flags.h:42
bool reverse
Definition: flags.h:45
bool thru
Definition: flags.h:44