41#include "enumInterface.hpp"
63 template<
typename T_Enum>
69 using UnderlyingEnumType =
typename std::underlying_type<Enum>::type;
70 using Bitset = std::bitset<static_cast<UnderlyingEnumType>(Enum::MaxElement)>;
72 static UnderlyingEnumType
constexpr ALL_VALUE = (1 <<
static_cast<UnderlyingEnumType
>(Enum::MaxElement)) - 1;
77 return static_cast<UnderlyingEnumType
>(v);
94 return bitset.test(get_value(pos));
99 bitset.reset(get_value(pos));
105 bitset.flip(get_value(pos));
112 bitset &= Bitset(ALL_VALUE);
118 bitset.set(get_value(pos));
152 return bitset != o.bitset;
162 return bitset == o.bitset;
172 return this->bitset.any();
192 template<
typename Enum>
201 template<
typename Enum>
210 template<
typename Enum>
216 template<
typename Enum>
225 template<
typename Enum>
234 template<
typename Enum>
240 template<
typename Enum>
246 template<
typename Enum>
252 template<
typename Out,
typename Enum>
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
inlineEnumBitset< Enum > operator|(EnumBitset< Enum > const &a, EnumBitset< Enum > const &b)
Or operation of two bitsets.
Definition enumBitset.hpp:193
inlineEnumBitset< Enum > operator&(EnumBitset< Enum > const &a, EnumBitset< Enum > const &b)
And operation of two bitsets.
Definition enumBitset.hpp:217
ExpressionTraits::EnableIfExpression< Expr, std::ostream > & operator<<(std::ostream &out, Expr const &v)
Write the primal value to the stream.
Definition expressionInterface.hpp:154
inlinebool operator!=(ExpressionInterface< std::complex< Real >, ArgA > const &argA, RealTraits::PassiveReal< Real > const &argB)
Function overload for OPERATOR(complex, passive real).
Definition allOperators.hpp:78
inlinebool operator==(ExpressionInterface< std::complex< Real >, ArgA > const &argA, RealTraits::PassiveReal< Real > const &argB)
Function overload for OPERATOR(complex, passive real).
Definition allOperators.hpp:78
A bitset with enum items as flags.
Definition enumBitset.hpp:64
inlineEnumBitset & operator&=(Enum const &pos)
And operation of the bitsets and and enum.
Definition enumBitset.hpp:146
inlineBitset getData() const
Get the underlying bitset.
Definition enumBitset.hpp:176
inlinebool operator==(Enum const &pos) const
Equal operation for a bitset and an enum.
Definition enumBitset.hpp:166
inlineEnumBitset & flip(Enum pos)
Flip the bit for the enum.
Definition enumBitset.hpp:104
inlineEnumBitset & flip()
Flip all bits.
Definition enumBitset.hpp:110
inlineEnumBitset & set(Enum pos)
Set the bit for the enum to true.
Definition enumBitset.hpp:117
inlinebool test(Enum pos) const
Test if the bit for the enum is set.
Definition enumBitset.hpp:93
T_Enum Enum
See EnumBitset.
Definition enumBitset.hpp:66
inlineEnumBitset & reset(Enum pos)
Reset the bit for the enum to false.
Definition enumBitset.hpp:98
inlinebool operator==(EnumBitset const &o) const
Equal operation for two bitsets.
Definition enumBitset.hpp:161
inlineEnumBitset & operator|=(EnumBitset const &o)
Or operation of two bitsets.
Definition enumBitset.hpp:129
inlinebool any()
Conversion to boolean.
Definition enumBitset.hpp:171
inlineEnumBitset & reset()
Reset all bits to false.
Definition enumBitset.hpp:123
inlinestatic constexpr EnumBitset NONE()
Constructor for a bitset with all values flagged as false.
Definition enumBitset.hpp:186
inlinestatic constexpr EnumBitset ALL()
Constructor for a bitset with all values flagged as true.
Definition enumBitset.hpp:181
inlineEnumBitset & operator&=(EnumBitset const &o)
And operation of two bitsets.
Definition enumBitset.hpp:140
inlinebool operator!=(EnumBitset const &o) const
Not equal operation for two bitsets.
Definition enumBitset.hpp:151
inlineEnumBitset & operator|=(Enum const &pos)
Or operation of the bitset and an enum.
Definition enumBitset.hpp:135
inlinebool operator!=(Enum const &pos) const
Not equal operation for a bitset and an enum.
Definition enumBitset.hpp:156