library: libCore #include "TBits.h"

# TBits

class description - source file - inheritance tree (.pdf)

## class TBits : public TObject

| Inheritance Chart:

`TObject`

<-

`TBits`

        protected:

          void ReserveBytes(UInt_t nbytes)

        public:

                          TBits(UInt_t nbits = 8)
                          TBits(const TBits&)
                  virtual ~TBits()
           static TClass* Class()
             virtual void Clear(Option_t* option = "")
                     void Compact()
                   UInt_t CountBits(UInt_t startBit = 0) const
                   UInt_t FirstNullBit(UInt_t startBit = 0) const
                   UInt_t FirstSetBit(UInt_t startBit = 0) const
                     void Get(Char_t* array) const
                     void Get(UChar_t* array) const
                     void Get(Short_t* array) const
                     void Get(UShort_t* array) const
                     void Get(Int_t* array) const
                     void Get(UInt_t* array) const
                     void Get(Long64_t* array) const
                     void Get(ULong64_t* array) const
                   UInt_t GetNbits() const
                   UInt_t GetNbytes() const
          virtual TClass* IsA() const
                   TBits& operator=(const TBits&)
                   Bool_t operator==(const TBits& other) const
             virtual void Paint(Option_t* option = "")
             virtual void Print(Option_t* option = "") const
                     void ResetAllBits(Bool_t value = kFALSE)
                     void ResetBitNumber(UInt_t bitnumber)
                     void Set(UInt_t nbits, const Char_t* array)
                     void Set(UInt_t nbits, const UChar_t* array)
                     void Set(UInt_t nbits, const Short_t* array)
                     void Set(UInt_t nbits, const UShort_t* array)
                     void Set(UInt_t nbits, const Int_t* array)
                     void Set(UInt_t nbits, const UInt_t* array)
                     void Set(UInt_t nbits, const Long64_t* array)
                     void Set(UInt_t nbits, const ULong64_t* array)
                     void SetBitNumber(UInt_t bitnumber, Bool_t value = kTRUE)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                   Bool_t TestBitNumber(UInt_t bitnumber) const

### Data Members

        protected:

            UInt_t fNbits    Number of bits (around fNbytes*8)
            UInt_t fNbytes   Number of UChars in fAllBits
          UChar_t* fAllBits  [fNbytes] array of UChars

## Class Description

TBits(UInt_t nbits) : fNbits(nbits)

     TBits constructor.  All bits set to 0

TBits(const TBits &original) : TObject(original), fNbits(original.fNbits), fNbytes(original.fNbytes)

     TBits copy constructor

~TBits()

     TBits destructor

void Clear(Option_t * /*option*/)

void Compact()

     Reduce the storage used by the object to a minimun

UInt_t CountBits(UInt_t startBit) const

     Return number of bits set to 1 starting at bit startBit

UInt_t FirstNullBit(UInt_t startBit) const

     Return position of first null bit

UInt_t FirstSetBit(UInt_t startBit) const

     Return position of first non null bit

void Paint(Option_t *)

     Once implemented, it will draw the bit field as an histogram.
     use the TVirtualPainter as the usual trick

void Print(Option_t *) const

     Print the list of active bits

void ResetAllBits(Bool_t)

     Reset all bits to 0 (false).

void ReserveBytes(UInt_t nbytes)

void Set(UInt_t nbits, const Char_t *array)

void Get(Char_t *array) const

void Set(UInt_t nbits, const Short_t *array)

void Set(UInt_t nbits, const Int_t *array)

void Set(UInt_t nbits, const Long64_t *array)

void Get(Short_t *array) const

void Get(Int_t *array) const

void Get(Long64_t *array) const

void Set(UInt_t nbits, const Short_t *array)

     make nbytes even so that the loop below is neat.

void Set(UInt_t nbits, const Int_t *array)

     make nbytes a multiple of 4 so that the loop below is neat.

void Set(UInt_t nbits, const Long64_t *array)

     make nbytes a multiple of 8 so that the loop below is neat.

void Get(Short_t *array) const

void Get(Int_t *array) const

void Get(Long64_t *array) const

### Inline Functions

                 TBits& operator=(const TBits&)
                   void ResetBitNumber(UInt_t bitnumber)
                   void SetBitNumber(UInt_t bitnumber, Bool_t value = kTRUE)
                 Bool_t TestBitNumber(UInt_t bitnumber) const
                   void Set(UInt_t nbits, const ULong64_t* array)
                   void Get(ULong64_t* array) const
                 UInt_t GetNbits() const
                 UInt_t GetNbytes() const
                 Bool_t operator==(const TBits& other) const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)

Author: Philippe Canal 05/02/2001
Last update: root/base:$Name: $:$Id: TBits.cxx,v 1.16 2004/01/26 11:52:40 brun Exp $