MKI_BITFIELD (Basic Classes) Changed in Version 2022.1

www.CAD6.com

C++ Syntax

template <unsigned Size> class MKI_BITFIELD

{

  public:

 

  BYTE m_abData[(Size+7)/8];

 

  MKI_BITFIELD( void ){};

 

  operator BYTE*();

 

  unsigned

  GetBitSize( void ) const;

 

  size_t

  GetByteSize( void ) const;

 

  bool

  IsAllClear( void ) const;

 

  bool

  IsIdentical( const MKI_BITFIELD<Size>& f_rData ) const; New in Version 2022.1

 

  void

  SetAll( void );

 

  void

  ClearAll( void );

 

  void

  InvertAll( void );

 

  void

  BitwiseOrAll( const MKI_BITFIELD<f_unSize>& f_rData );

 

  void

  BitwiseAndAll( const MKI_BITFIELD<f_unSize>& f_rData );

 

  void

  BitwiseXOrAll( const MKI_BITFIELD<f_unSize>& f_rData );

 

  void

  SetBit( const unsigned f_unBitNum );

 

  void

  ClearBit( const unsigned f_unBitNum );

 

  void

  InvertBit( const unsigned f_unBitNum );

 

  bool

  IsBitSet( const unsigned f_unBitNum ) const;

 

  void

  CopyBitsToField(

 const BYTE* f_pSource,

 const unsigned f_unSourceBit,

 const unsigned f_unDestinBit,

 const unsigned f_unBitCount );

 

  void

  CopyFieldToBits(

 const unsigned f_unSourceBit,

 BYTE* f_pDestin,

 const unsigned f_unDestinBit,

 const unsigned f_unBitCount ) const;

};

 

This structure contains a packed bitfield, i.e. an array of Size bits packed in bytes with each bit being separately addressable as a boolean value. Bit 0 is the highest bit in the first byte, bit 7 is the lowest bit in the first byte, bit 8 is the highest bit in the second byte, and so on.

 

Element Description

m_abData

[BYTE[]] Storage space for Size bits.

 

MKD Syntax

Data[0], ... ,Data[(Size+7)/8]

 

All zero bytes at the end may be omitted.

 

CAD6interface 2024.2 - Copyright 2024 Malz++Kassner® GmbH