7 #ifndef IG_OMW_UTILITY_H
8 #define IG_OMW_UTILITY_H
21 void shiftLeftAssign(int8_t& value,
unsigned int n);
22 void shiftLeftAssign(int16_t& value,
unsigned int n);
23 void shiftLeftAssign(int32_t& value,
unsigned int n);
24 void shiftLeftAssign(int64_t& value,
unsigned int n);
25 void shiftLeftAssign(uint8_t& value,
unsigned int n);
26 void shiftLeftAssign(uint16_t& value,
unsigned int n);
27 void shiftLeftAssign(uint32_t& value,
unsigned int n);
28 void shiftLeftAssign(uint64_t& value,
unsigned int n);
29 void shiftRightAssign(int8_t& value,
unsigned int n);
30 void shiftRightAssign(int16_t& value,
unsigned int n);
31 void shiftRightAssign(int32_t& value,
unsigned int n);
32 void shiftRightAssign(int64_t& value,
unsigned int n);
33 void shiftRightAssign(uint8_t& value,
unsigned int n);
34 void shiftRightAssign(uint16_t& value,
unsigned int n);
35 void shiftRightAssign(uint32_t& value,
unsigned int n);
36 void shiftRightAssign(uint64_t& value,
unsigned int n);
37 int8_t shiftLeft(int8_t value,
unsigned int n);
38 int16_t shiftLeft(int16_t value,
unsigned int n);
39 int32_t shiftLeft(int32_t value,
unsigned int n);
40 int64_t shiftLeft(int64_t value,
unsigned int n);
41 uint8_t shiftLeft(uint8_t value,
unsigned int n);
42 uint16_t shiftLeft(uint16_t value,
unsigned int n);
43 uint32_t shiftLeft(uint32_t value,
unsigned int n);
44 uint64_t shiftLeft(uint64_t value,
unsigned int n);
45 int8_t shiftRight(int8_t value,
unsigned int n);
46 int16_t shiftRight(int16_t value,
unsigned int n);
47 int32_t shiftRight(int32_t value,
unsigned int n);
48 int64_t shiftRight(int64_t value,
unsigned int n);
49 uint8_t shiftRight(uint8_t value,
unsigned int n);
50 uint16_t shiftRight(uint16_t value,
unsigned int n);
51 uint32_t shiftRight(uint32_t value,
unsigned int n);
52 uint64_t shiftRight(uint64_t value,
unsigned int n);
70 bool isNull()
const {
return m_isNull; }
72 virtual void makeNull() { m_isNull =
true; }
75 void setIsNull(
bool isNull) { m_isNull = isNull; }
86 using reference = value_type&;
87 using const_reference =
const value_type&;
94 const_reference get(const_reference fallback)
const {
return (isNull() ? fallback : m_value); }
95 void set(const_reference value) { setIsNull(
false); m_value = value; }
97 virtual void free() { m_value = value_type(); }
98 virtual void makeNull() { free(); Base_Nullable::makeNull(); }
100 explicit operator value_type()
const {
return m_value; }
110 inline void toggle(
bool& value) { value = !value; }
111 inline void toggle(
int& value) { value = (value ? 0 : 1); }
113 template <
class Type>
114 bool vectorContains(
const std::vector<Type>& v,
const Type& item)
117 for (
size_t i = 0; (i < v.size()) && !r; ++i)
118 if (v[i] == item) r =
true;
126 #endif // IG_OMW_UTILITY_H