SNAP Library 2.1, User 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
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.

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

Member Function Documentation

TB32Set& TB32Set::Clr ( ) [inline]

Definition at line 255 of file bits.h.

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

Definition at line 254 of file bits.h.

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

Definition at line 265 of file bits.h.

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

Definition at line 256 of file bits.h.

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

Definition at line 280 of file bits.h.

{return Bits-Get1s();}
int TB32Set::Get1s ( ) const [inline]

Definition at line 279 of file bits.h.

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

Definition at line 273 of file bits.h.

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

Definition at line 278 of file bits.h.

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

Definition at line 288 of file bits.h.

                                                         {
    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.

                           {
  TChA ChA;
  for (int BitN=0; BitN<Bits; BitN++){
    if (In(BitN)){ChA+='1';} else {ChA+='0';}}
  return ChA;
}
uint TB32Set::GetUInt ( ) const [inline]

Definition at line 260 of file bits.h.

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

Definition at line 268 of file bits.h.

                                 {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}
void TB32Set::Incl ( const int &  BitN) [inline]

Definition at line 262 of file bits.h.

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B4|=TB4Def::B4Def.B4P2T[BitN];}
bool TB32Set::IsPrefix ( const TB32Set BSet,
const int &  MnBitN 
) const [inline]

Definition at line 257 of file bits.h.

                                                              {
    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.

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

Definition at line 252 of file bits.h.

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

Definition at line 298 of file bits.h.

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

Definition at line 250 of file bits.h.

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

Definition at line 251 of file bits.h.

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

Definition at line 297 of file bits.h.

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

Definition at line 296 of file bits.h.

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

Definition at line 294 of file bits.h.

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

Definition at line 292 of file bits.h.

{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.

                                                                   {
    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.

{SOut.SaveBf(&B4, sizeof(TB4Def::TB4));}
void TB32Set::SetBit ( const int &  BitN,
const bool &  Bool 
) [inline]

Definition at line 271 of file bits.h.

                                                {
    if (Bool) Incl(BitN); else Excl(BitN);}
void TB32Set::SwitchBit ( const int &  BitN) [inline]

Definition at line 276 of file bits.h.

                                 {
    SetBit(BitN, !GetBit(BitN));}
void TB32Set::Wr ( )

Definition at line 155 of file bits.cpp.

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

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

Definition at line 242 of file bits.h.

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

Definition at line 241 of file bits.h.


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