62 constexpr
mbool(
bool value =
false) :
value_{
static_cast<unsigned char>(value ? 1 : 0) }
72 {
if (value != this->
value_.bool_) { ++this->
value_.memory_; }
return (*
this); }
79 { ++this->
value_.memory_;
return (*
this); }
82 {
mbool temp = (*this); ++this->
value_.memory_;
return temp; }
85 constexpr
operator bool()
const 86 {
return this->
value_.bool_; }
90 {
return this->
value_.bool_ == other; }
93 {
return this->
value_.bool_ != other; }
104 {
return (!this->
value_.bool_); }
constexpr bool operator!=(bool other) const
Compares the mbool to a bool, returns true if the bool has a different value than the state of the mb...
Definition: mbool.h:92
constexpr bool operator!=(const mbool &other) const
Compares two mbools, returns true if they have a different memory value.
Definition: mbool.h:99
~mbool()=default
Destructor does nothing but not defining it might create a symbol (class is header only) ...
mbool & operator=(bool value)
Assigns a boolean value (and increases the memory value if the value is different to the old value)...
Definition: mbool.h:71
mbool operator++(int)
Increases the memory which also inverts it's state (mbool++).
Definition: mbool.h:81
constexpr mbool(const mbool &value)
Copy-constructor, copies state and memory.
Definition: mbool.h:65
union orxonox::mbool::@37 value_
A union containing the state and the memory of the mbool.
mbool is a small helper class that acts like a bool, but keeps track of the number of its state chang...
Definition: mbool.h:58
mbool & operator++()
Increases the memory which also inverts it's state (++mbool).
Definition: mbool.h:78
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
constexpr bool operator==(bool other) const
Compares the mbool to a bool, returns true if the bool has the same value as the state of the mbool...
Definition: mbool.h:89
Shared library macros, enums, constants and forward declarations for the util library ...
unsigned char memory_
The memory of the mbool, counts the state-changes (and the first bit represents also the boolean valu...
Definition: mbool.h:112
mbool & operator=(const mbool &value)
Assigns another mbool, copies state and memory.
Definition: mbool.h:74
unsigned char & getMemory()
Returns the memory value.
Definition: mbool.h:107
constexpr mbool(bool value=false)
Constructor: Creates the mbool and initializes the boolean value (default to false).
Definition: mbool.h:62
constexpr bool operator!() const
Returns the inverted state of the bool (doesn't change the internal state).
Definition: mbool.h:103
bool bool_
The boolean state of the mbool, is located on the first bit of the memory variable.
Definition: mbool.h:113
constexpr bool operator==(const mbool &other) const
Compares two mbools, returns true if their memory matches.
Definition: mbool.h:96