SNAP Library 2.1, Developer Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TB8Set Class Reference

#include <bits.h>

List of all members.

Public Member Functions

 TB8Set ()
 TB8Set (const TB8Set &B8Set)
 TB8Set (const uchar &_B1)
 TB8Set (TSIn &SIn)
void Save (TSOut &SOut) const
TB8Setoperator= (const TB8Set &BSet)
TB8Setoperator= (const uchar &_B1)
bool operator== (const TB8Set &BSet) const
bool operator< (const TB8Set &BSet) const
bool Empty () const
TB8SetClr ()
TB8SetFill ()
bool IsPrefix (const TB8Set &BSet, const int &MnBitN) const
uchar GetUCh () const
void Incl (const int &BitN)
void Excl (const int &BitN)
bool In (const int &BitN) const
void SetBit (const int &BitN, const bool &Bool)
bool GetBit (const int &BitN) const
int GetBits () const
int Get1s () const
int Get0s () const
TStr GetStr () const
void Wr ()
void PutInt (const int &MnBitN, const int &MxBitN, const int &Val)
int GetInt (const int &MnBitN, const int &MxBitN) const
TB8Setoperator~ ()
TB8Setoperator&= (const TB8Set &BSet)
TB8Setoperator|= (const TB8Set &BSet)
TB8Setoperator|= (const int &BitN)
TB8Setoperator^= (const TB8Set &BSet)
TB8Setoperator>>= (const int &ShiftBits)
TB8Setoperator<<= (const int &ShiftBits)

Private Attributes

TB1Def::TB1 B1

Static Private Attributes

static const int Bits = 8

Friends

TB8Set operator~ (const TB8Set &BSet)
TB8Set operator& (const TB8Set &LBSet, const TB8Set &RBSet)
TB8Set operator| (const TB8Set &LBSet, const TB8Set &RBSet)
TB8Set operator^ (const TB8Set &LBSet, const TB8Set &RBSet)

Detailed Description

Definition at line 166 of file bits.h.


Constructor & Destructor Documentation

TB8Set::TB8Set ( ) [inline]

Definition at line 171 of file bits.h.

: B1(0){}
TB8Set::TB8Set ( const TB8Set B8Set) [inline]

Definition at line 172 of file bits.h.

: B1(B8Set.B1){}
TB8Set::TB8Set ( const uchar _B1) [inline]

Definition at line 173 of file bits.h.

: B1(_B1){}
TB8Set::TB8Set ( TSIn SIn) [inline]

Definition at line 174 of file bits.h.

References B1, and TSIn::LoadBf().

{SIn.LoadBf(&B1, sizeof(TB1Def::TB1));}

Here is the call graph for this function:


Member Function Documentation

TB8Set& TB8Set::Clr ( ) [inline]

Definition at line 183 of file bits.h.

References B1.

{B1=0; return *this;}
bool TB8Set::Empty ( ) const [inline]

Definition at line 182 of file bits.h.

References B1.

{return B1==0;}
void TB8Set::Excl ( const int &  BitN) [inline]

Definition at line 193 of file bits.h.

References Assert, B1, TB1Def::B1Def, and Bits.

Referenced by SetBit().

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B1&=TB1Def::TB1(~(TB1Def::B1Def.B1P2T[BitN]));}

Here is the caller graph for this function:

TB8Set& TB8Set::Fill ( ) [inline]

Definition at line 184 of file bits.h.

References B1, TB1Def::B1Def, and TB1Def::MxB1.

{B1=TB1Def::B1Def.MxB1; return *this;}
int TB8Set::Get0s ( ) const [inline]

Definition at line 206 of file bits.h.

References Bits, and Get1s().

{return Bits-Get1s();}

Here is the call graph for this function:

int TB8Set::Get1s ( ) const [inline]

Definition at line 205 of file bits.h.

References B1, TB1Def::B1Def, and TB1Def::GetB1Bits().

Referenced by Get0s().

Here is the call graph for this function:

Here is the caller graph for this function:

bool TB8Set::GetBit ( const int &  BitN) const [inline]

Definition at line 201 of file bits.h.

References Assert, B1, TB1Def::B1Def, and Bits.

Referenced by TBlobPt::IsFlag(), and Wr().

                                     {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B1 & TB1Def::B1Def.B1P2T[BitN])!=0;}

Here is the caller graph for this function:

int TB8Set::GetBits ( ) const [inline]

Definition at line 204 of file bits.h.

References Bits.

{return Bits;}
int TB8Set::GetInt ( const int &  MnBitN,
const int &  MxBitN 
) const [inline]

Definition at line 214 of file bits.h.

References Assert, B1, TB1Def::B1Def, TB1Def::B1P2T, and Bits.

                                                         {
    Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
    return (B1>>MnBitN) & (TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1);}
TStr TB8Set::GetStr ( ) const

Definition at line 131 of file bits.cpp.

References Bits, and In().

                          {
  TChA ChA;
  for (int BitN=0; BitN<Bits; BitN++){
    if (In(BitN)){ChA+='1';} else {ChA+='0';}}
  return ChA;
}

Here is the call graph for this function:

uchar TB8Set::GetUCh ( ) const [inline]

Definition at line 188 of file bits.h.

References B1.

{return B1;}
bool TB8Set::In ( const int &  BitN) const [inline]

Definition at line 196 of file bits.h.

References Assert, B1, TB1Def::B1Def, and Bits.

Referenced by GetStr().

                                 {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B1 & TB1Def::B1Def.B1P2T[BitN])!=0;}

Here is the caller graph for this function:

void TB8Set::Incl ( const int &  BitN) [inline]

Definition at line 190 of file bits.h.

References Assert, B1, TB1Def::B1Def, TB1Def::B1P2T, and Bits.

Referenced by operator|=(), and SetBit().

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B1|=TB1Def::B1Def.B1P2T[BitN];}

Here is the caller graph for this function:

bool TB8Set::IsPrefix ( const TB8Set BSet,
const int &  MnBitN 
) const [inline]

Definition at line 185 of file bits.h.

References Assert, B1, and Bits.

                                                             {
    Assert((0<=MnBitN)&&(MnBitN<Bits));
    return (B1>>MnBitN)==(BSet.B1>>MnBitN);}
TB8Set& TB8Set::operator&= ( const TB8Set BSet) [inline]

Definition at line 219 of file bits.h.

References B1.

{B1&=BSet.B1; return *this;}
bool TB8Set::operator< ( const TB8Set BSet) const [inline]

Definition at line 180 of file bits.h.

References B1.

{return B1<BSet.B1;}
TB8Set& TB8Set::operator<<= ( const int &  ShiftBits) [inline]

Definition at line 224 of file bits.h.

References B1.

{B1<<=ShiftBits; return *this;}
TB8Set& TB8Set::operator= ( const TB8Set BSet) [inline]

Definition at line 177 of file bits.h.

References B1.

{B1=BSet.B1; return *this;}
TB8Set& TB8Set::operator= ( const uchar _B1) [inline]

Definition at line 178 of file bits.h.

References B1.

{B1=_B1; return *this;}
bool TB8Set::operator== ( const TB8Set BSet) const [inline]

Definition at line 179 of file bits.h.

References B1.

{return B1==BSet.B1;}
TB8Set& TB8Set::operator>>= ( const int &  ShiftBits) [inline]

Definition at line 223 of file bits.h.

References B1.

{B1>>=ShiftBits; return *this;}
TB8Set& TB8Set::operator^= ( const TB8Set BSet) [inline]

Definition at line 222 of file bits.h.

References B1.

{B1^=BSet.B1; return *this;}
TB8Set& TB8Set::operator|= ( const TB8Set BSet) [inline]

Definition at line 220 of file bits.h.

References B1.

{B1|=BSet.B1; return *this;}
TB8Set& TB8Set::operator|= ( const int &  BitN) [inline]

Definition at line 221 of file bits.h.

References Incl().

{Incl(BitN); return *this;}

Here is the call graph for this function:

TB8Set& TB8Set::operator~ ( ) [inline]

Definition at line 218 of file bits.h.

References B1.

{B1=TB1Def::TB1(~B1); return *this;}
void TB8Set::PutInt ( const int &  MnBitN,
const int &  MxBitN,
const int &  Val 
) [inline]

Definition at line 210 of file bits.h.

References Assert, B1, TB1Def::B1Def, and Bits.

                                                                   {
    Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
    B1 &= TB1Def::TB1((~(TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1)) << MnBitN);
    B1 |= TB1Def::TB1((Val & (TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1)) << MnBitN);}
void TB8Set::Save ( TSOut SOut) const [inline]

Definition at line 175 of file bits.h.

References B1, and TSOut::SaveBf().

{SOut.SaveBf(&B1, sizeof(TB1Def::TB1));}

Here is the call graph for this function:

void TB8Set::SetBit ( const int &  BitN,
const bool &  Bool 
) [inline]

Definition at line 199 of file bits.h.

References Excl(), and Incl().

Referenced by TBlobPt::PutFlag().

                                                {
    if (Bool) Incl(BitN); else Excl(BitN);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TB8Set::Wr ( )

Definition at line 138 of file bits.cpp.

References Bits, and GetBit().

               {
  printf("[");
  for (int BitN=0; BitN<Bits; BitN++){printf("%d", GetBit(BitN));}
  printf("]\n");
}

Here is the call graph for this function:


Friends And Related Function Documentation

TB8Set operator& ( const TB8Set LBSet,
const TB8Set RBSet 
) [friend]

Definition at line 228 of file bits.h.

                                                                   {
    return TB8Set(LBSet)&=RBSet;}
TB8Set operator^ ( const TB8Set LBSet,
const TB8Set RBSet 
) [friend]

Definition at line 232 of file bits.h.

                                                                   {
    return TB8Set(LBSet)^=RBSet;}
TB8Set operator| ( const TB8Set LBSet,
const TB8Set RBSet 
) [friend]

Definition at line 230 of file bits.h.

                                                                   {
    return TB8Set(LBSet)|=RBSet;}
TB8Set operator~ ( const TB8Set BSet) [friend]

Definition at line 226 of file bits.h.

                                             {
    return ~TB8Set(BSet);}

Member Data Documentation

const int TB8Set::Bits = 8 [static, private]

Definition at line 168 of file bits.h.

Referenced by Excl(), Get0s(), GetBit(), GetBits(), GetInt(), GetStr(), In(), Incl(), IsPrefix(), PutInt(), and Wr().


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