MNM::SAreaTypeAndFlags

MNM::SAreaTypeAndFlags< BaseType, areaTypeBitCount >

#include

Public Types

enum { bit_size = sizeof(value_type) * 8 }
enum { area_bitcount = areaTypeBitCount }
enum { flags_bitcount = bit_size - area_bitcount }
enum : value_type { flags_bitmask = (value_type(1) << flags_bitcount) - 1 }
enum : value_type { area_bitmask = ~flags_bitmask }
typedef BaseType value_type

Public Member Functions

SAreaTypeAndFlags (const value_type &value)
SAreaTypeAndFlags (const SAreaTypeAndFlags &other)
bool operator== (const SAreaTypeAndFlags &other) const
value_type GetFlags () const
void SetFlags (value_type flags)
value_type GetType () const
void SetType (value_type type)
value_type GetRawValue () const

Static Public Member Functions

static constexpr size_t MaxAreasCount ()
static constexpr size_t MaxFlagsCount ()

Detailed Description

template struct MNM::SAreaTypeAndFlags< BaseType, areaTypeBitCount >

Template structure that is combining values of area 'type' (index) and 'flags' in one variable. areaTypeBitCount template parameter specifies how many bits of the BaseType should be used for storing 'type', remaining bits are then used for 'flags'. Example: SAreaTypeAndFlags uses uint32 as base type. From that area type uses 6 bits (= 64 values from 0 to 63) and there can be 26 different flags