SNAP Library , Developer Reference  2013-01-07 14:03:36
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
TB32Set Class Reference

#include <bits.h>

List of all members.

Public Member Functions

 TB32Set ()
 TB32Set (const TB32Set &B32Set)
 TB32Set (const uint &_B4)
 TB32Set (TSIn &SIn)
void Save (TSOut &SOut) const
TB32Setoperator= (const TB32Set &BSet)
bool operator== (const TB32Set &BSet) const
bool operator< (const TB32Set &BSet) const
bool Empty () const
TB32SetClr ()
TB32SetFill ()
bool IsPrefix (const TB32Set &BSet, const int &MnBitN) const
uint GetUInt () 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
void SwitchBit (const int &BitN)
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
TB32Setoperator~ ()
TB32Setoperator&= (const TB32Set &BSet)
TB32Setoperator|= (const TB32Set &BSet)
TB32Setoperator^= (const TB32Set &BSet)
TB32Setoperator>>= (const int &ShiftBits)
TB32Setoperator<<= (const int &ShiftBits)

Private Attributes

TB4Def::TB4 B4

Static Private Attributes

static const int Bits = 32

Friends

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

Detailed Description

Definition at line 239 of file bits.h.


Constructor & Destructor Documentation

TB32Set::TB32Set ( ) [inline]

Definition at line 244 of file bits.h.

: B4(0){}
TB32Set::TB32Set ( const TB32Set B32Set) [inline]

Definition at line 245 of file bits.h.

: B4(B32Set.B4){}
TB32Set::TB32Set ( const uint _B4) [inline]

Definition at line 246 of file bits.h.

: B4(_B4){}
TB32Set::TB32Set ( TSIn SIn) [inline]

Definition at line 247 of file bits.h.

References B4, and TSIn::LoadBf().

{SIn.LoadBf(&B4, sizeof(TB4Def::TB4));}

Here is the call graph for this function:


Member Function Documentation

TB32Set& TB32Set::Clr ( ) [inline]

Definition at line 255 of file bits.h.

References B4.

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

Definition at line 254 of file bits.h.

References B4.

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

Definition at line 265 of file bits.h.

References Assert, B4, TB4Def::B4P2T, and Bits.

Referenced by SetBit().

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B4&=~TB4Def::B4Def.B4P2T[BitN];}

Here is the caller graph for this function:

TB32Set& TB32Set::Fill ( ) [inline]

Definition at line 256 of file bits.h.

References B4, TB4Def::B4Def, and TB4Def::MxB4.

{B4=TB4Def::B4Def.MxB4; return *this;}
int TB32Set::Get0s ( ) const [inline]

Definition at line 280 of file bits.h.

References Bits, and Get1s().

{return Bits-Get1s();}

Here is the call graph for this function:

int TB32Set::Get1s ( ) const [inline]

Definition at line 279 of file bits.h.

References B4, TB4Def::B4Def, and TB4Def::GetB4Bits().

Referenced by Get0s().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 273 of file bits.h.

References Assert, B4, TB4Def::B4Def, and Bits.

Referenced by SwitchBit(), and Wr().

                                     {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}

Here is the caller graph for this function:

int TB32Set::GetBits ( ) const [inline]

Definition at line 278 of file bits.h.

References Bits.

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

Definition at line 288 of file bits.h.

References Assert, B4, TB4Def::B4Def, TB4Def::B4P2T, and Bits.

                                                         {
    Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
    return (B4>>MnBitN) & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1);}
TStr TB32Set::GetStr ( ) const

Definition at line 148 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:

uint TB32Set::GetUInt ( ) const [inline]

Definition at line 260 of file bits.h.

References B4.

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

Definition at line 268 of file bits.h.

References Assert, B4, TB4Def::B4Def, and Bits.

Referenced by GetStr(), and TBigNet< TNodeData, IsDir >::OnlySources().

                                 {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}

Here is the caller graph for this function:

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

Definition at line 262 of file bits.h.

References Assert, B4, TB4Def::B4Def, TB4Def::B4P2T, and Bits.

Referenced by SetBit(), and TBigNet< TNodeData, IsDir >::TBigNet().

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B4|=TB4Def::B4Def.B4P2T[BitN];}

Here is the caller graph for this function:

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

Definition at line 257 of file bits.h.

References Assert, B4, and Bits.

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

Definition at line 293 of file bits.h.

References B4.

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

Definition at line 252 of file bits.h.

References B4.

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

Definition at line 298 of file bits.h.

References B4.

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

Definition at line 250 of file bits.h.

References B4.

{B4=BSet.B4; return *this;}
bool TB32Set::operator== ( const TB32Set BSet) const [inline]

Definition at line 251 of file bits.h.

References B4.

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

Definition at line 297 of file bits.h.

References B4.

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

Definition at line 296 of file bits.h.

References B4.

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

Definition at line 294 of file bits.h.

References B4.

{B4|=BSet.B4; return *this;}
TB32Set& TB32Set::operator~ ( ) [inline]

Definition at line 292 of file bits.h.

References B4.

{B4=~B4; return *this;}
void TB32Set::PutInt ( const int &  MnBitN,
const int &  MxBitN,
const int &  Val 
) [inline]

Definition at line 284 of file bits.h.

References Assert, B4, TB4Def::B4Def, TB4Def::B4P2T, and Bits.

                                                                   {
    Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
    B4 &= (~(TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;
    B4 |= (Val & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;}
void TB32Set::Save ( TSOut SOut) const [inline]

Definition at line 248 of file bits.h.

References B4, and TSOut::SaveBf().

Referenced by TBigNet< TNodeData, IsDir >::SaveToDisk().

{SOut.SaveBf(&B4, sizeof(TB4Def::TB4));}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 271 of file bits.h.

References Excl(), and Incl().

Referenced by SwitchBit().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void TB32Set::SwitchBit ( const int &  BitN) [inline]

Definition at line 276 of file bits.h.

References GetBit(), and SetBit().

                                 {
    SetBit(BitN, !GetBit(BitN));}

Here is the call graph for this function:

void TB32Set::Wr ( )

Definition at line 155 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

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

Definition at line 302 of file bits.h.

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

Definition at line 306 of file bits.h.

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

Definition at line 304 of file bits.h.

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

Definition at line 300 of file bits.h.

                                               {
    return ~TB32Set(BSet);}

Member Data Documentation

const int TB32Set::Bits = 32 [static, private]

Definition at line 241 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: