Belle II Software development
TRGState Class Reference

A class to represent a state of multi bits. More...

#include <State.h>

Public Member Functions

 TRGState (unsigned bitSize=0)
 Default constructor.
 
 TRGState (unsigned bitSize, unsigned value)
 Constructor with unsigned.
 
 TRGState (std::vector< bool > states)
 Constructor.
 
 TRGState (unsigned bitSize, const bool *const states)
 Constructor.
 
 TRGState (std::vector< unsigned > &states, unsigned order)
 Constructor. order: 0=>inVector[0] is lsb. 1=>inVector[0] is msb.
 
 TRGState (const char *, unsigned type)
 Constructor. type: 0-> binary, 1->hex.
 
 TRGState (const TRGState &)=default
 Default copy constructor.
 
virtual ~TRGState ()
 Destructor.
 
unsigned size (void) const
 returns bit size.
 
bool active (void) const
 returns true if there are active bits.
 
bool active (unsigned bitPosition) const
 returns true if there are active bits.
 
void copy2bool (bool *array) const
 returns a filled array.
 
TRGState subset (unsigned i, unsigned n) const
 returns subset from i with n bits.
 
void dump (const std::string &message="", const std::string &pre="") const
 dumps contents.
 
void clear (void)
 clears state.
 
const TRGStateset (unsigned position, bool state=true)
 sets state at bit i.
 
const TRGStateset (unsigned position, unsigned size, const bool *const array)
 sets state.
 
const TRGStateset (unsigned position, unsigned size, unsigned value)
 sets state.
 
const TRGStateset (unsigned position, const TRGState &)
 sets state.
 
 operator unsigned () const
 Conversion to unsigned.
 
 operator unsigned long long () const
 Conversion to unsigned long long.
 
 operator std::string () const
 Conversion to string.
 
TRGStateoperator+= (const TRGState &)
 appends TRGState (as MSB).
 
bool operator[] (unsigned i) const
 returns state of i'th bit.
 
TRGStateoperator= (const TRGState &)
 Copy operator.
 
bool operator< (const TRGState &) const
 Copy operator.
 
TRGStateshift (unsigned i)
 shifts bits.
 

Static Public Member Functions

static unsigned toUnsigned (unsigned n, const bool *array)
 Coverts from bool array to unsigned.
 

Private Attributes

unsigned _size
 bit size.
 
unsigned _n
 bit storage size.
 
unsigned * _state
 bit state.
 

Static Private Attributes

static const unsigned _su = sizeof(unsigned)
 size of unsigned.
 
static const unsigned _bsu = 8 * sizeof(unsigned)
 bit size of unsigned.
 

Detailed Description

A class to represent a state of multi bits.

Definition at line 24 of file State.h.

Member Data Documentation

◆ _n

unsigned _n
private

bit storage size.

Definition at line 139 of file State.h.

◆ _size

unsigned _size
private

bit size.

Definition at line 136 of file State.h.

◆ _state

unsigned* _state
private

bit state.

Definition at line 142 of file State.h.


The documentation for this class was generated from the following files: