SNAP Library, User Reference  2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bits.h File Reference

Go to the source code of this file.

Classes

class  TB1Def
class  TB2Def
class  TB4Def
class  TFSet
class  TB8Set
class  TB32Set

Typedefs

typedef TVec< TB8SetTB8SetV
typedef TVec< TB32SetTB32SetV

Functions

void SetLastB4 ()
 TBSet ()
 TBSet (const TBSet &BSet)
PBSet Clone () const
 TBSet (const int &_Bits)
static PBSet New (const int &Bits)
 ~TBSet ()
 TBSet (TSIn &SIn)
static PBSet Load (TSIn &SIn)
void Save (TSOut &SOut) const
TBSetoperator= (const TBSet &BSet)
bool operator== (const TBSet &BSet) const
void Gen (const int &_Bits)
void Clr ()
void Fill ()
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 ()
int Get0s ()
uint64 GetUInt64 () const
void Wr ()
TBSetoperator~ ()
TBSetoperator&= (const TBSet &BSet)
TBSetoperator|= (const TBSet &BSet)
TBSetoperator|= (const int &BitN)
TBSetoperator^= (const TBSet &BSet)
TBSet operator~ (const TBSet &BSet)
TBSet operator& (const TBSet &LBSet, const TBSet &RBSet)
TBSet operator| (const TBSet &LBSet, const TBSet &RBSet)
TBSet operator^ (const TBSet &LBSet, const TBSet &RBSet)
TBSet operator& (const TBSet &LBSet, const int &BitN)
TBSet operator| (const TBSet &LBSet, const int &BitN)
TBSet operator^ (const TBSet &LBSet, const int &BitN)

Variables

ClassTPV(TBSet, PBSet, TBSetV)
private TB4Def::TB4 
LastB4Mask
TB4Def::TB4B4T

Typedef Documentation

typedef TVec<TB32Set> TB32SetV

Definition at line 307 of file bits.h.

typedef TVec<TB8Set> TB8SetV

Definition at line 233 of file bits.h.


Function Documentation

PBSet Clone ( ) const

Definition at line 320 of file bits.h.

{return PBSet(new TBSet(*this));}
void Clr ( )

Definition at line 48 of file blobbs.h.

void Excl ( const int &  BitN)

Definition at line 346 of file bits.h.

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B4T[BitN/TB4Def::B4Def.B4Bits]&=
     ~TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits];}
void Fill ( )
void Gen ( const int &  _Bits)

Definition at line 113 of file dt.h.

                           {
    Clr(); Resize(_BfL); BfL=_BfL;}
int Get0s ( )

Definition at line 364 of file bits.h.

{return Bits-Get1s();}
int Get1s ( )
bool GetBit ( const int &  BitN) const

Definition at line 356 of file bits.h.

                                     {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B4T[BitN/TB4Def::B4Def.B4Bits] &
     TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits])!=0;}
int GetBits ( ) const

Definition at line 362 of file bits.h.

{return Bits;}
uint64 GetUInt64 ( ) const

Definition at line 365 of file bits.h.

                           {
    Assert(Bits>=64); uint64 Val; memcpy(&Val, B4T, 8); return Val;}
bool In ( const int &  BitN) const

Definition at line 350 of file bits.h.

                                 {
    Assert((0<=BitN)&&(BitN<Bits));
    return (B4T[BitN/TB4Def::B4Def.B4Bits] &
     TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits])!=0;}
void Incl ( const int &  BitN)

Definition at line 342 of file bits.h.

                            {
    Assert((0<=BitN)&&(BitN<Bits));
    B4T[BitN/TB4Def::B4Def.B4Bits]|=
     TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits];}
static PBSet Load ( TSIn SIn) [static]

Definition at line 329 of file bits.h.

{return new TBSet(SIn);}
static PBSet New ( const int &  Bits) [static]

Definition at line 323 of file bits.h.

{return PBSet(new TBSet(Bits));}
friend TBSet operator& ( const TBSet LBSet,
const TBSet RBSet 
)

Definition at line 385 of file bits.h.

                                                                {
    return TBSet(LBSet)&=RBSet;}
friend TBSet operator& ( const TBSet LBSet,
const int &  BitN 
)

Definition at line 392 of file bits.h.

                                                             {
    return TBSet(LBSet)&=BitN;}
TBSet& operator&= ( const TBSet BSet)

Definition at line 371 of file bits.h.

                                      {
    Assert(B4s==BSet.B4s);
    for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]&=BSet.B4T[B4N];} return *this;}
TBSet& operator= ( const TBSet BSet)
bool operator== ( const TBSet BSet) const
friend TBSet operator^ ( const TBSet LBSet,
const TBSet RBSet 
)

Definition at line 389 of file bits.h.

                                                                {
    return TBSet(LBSet)^=RBSet;}
friend TBSet operator^ ( const TBSet LBSet,
const int &  BitN 
)

Definition at line 396 of file bits.h.

                                                             {
    return TBSet(LBSet)^=BitN;}
TBSet& operator^= ( const TBSet BSet)

Definition at line 379 of file bits.h.

                                      {
    Assert(B4s==BSet.B4s);
    for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]^=BSet.B4T[B4N];} return *this;}
friend TBSet operator| ( const TBSet LBSet,
const TBSet RBSet 
)

Definition at line 387 of file bits.h.

                                                                {
    return TBSet(LBSet)|=RBSet;}
friend TBSet operator| ( const TBSet LBSet,
const int &  BitN 
)

Definition at line 394 of file bits.h.

                                                             {
    return TBSet(LBSet)|=BitN;}
TBSet& operator|= ( const TBSet BSet)

Definition at line 374 of file bits.h.

                                      {
    Assert(B4s==BSet.B4s);
    for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]|=BSet.B4T[B4N];} return *this;}
TBSet& operator|= ( const int &  BitN)

Definition at line 377 of file bits.h.

                                    {
    Incl(BitN); return *this;}

Definition at line 369 of file bits.h.

                    {
    for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]=~B4T[B4N];} return *this;}
friend TBSet operator~ ( const TBSet BSet)

Definition at line 383 of file bits.h.

                                           {
    return ~TBSet(BSet);}
void Save ( TSOut SOut) const

Definition at line 330 of file bits.h.

                               {
    SOut.Save(B4s); SOut.Save(Bits);
    SOut.SaveBf(&LastB4Mask, sizeof(TB4Def::TB4));
    SOut.SaveBf(B4T, B4s*sizeof(TB4Def::TB4));}
void SetBit ( const int &  BitN,
const bool &  Bool 
)

Definition at line 354 of file bits.h.

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

Definition at line 316 of file bits.h.

{B4T[B4s-1]&=LastB4Mask;}
void SwitchBit ( const int &  BitN)

Definition at line 360 of file bits.h.

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

Definition at line 318 of file bits.h.

: B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){}
TBSet::TBSet ( const TBSet BSet)

Definition at line 163 of file bits.cpp.

                             :
  B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){
  Gen(BSet.Bits);
  for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]=BSet.B4T[B4N];}
}
TBSet ( const int &  _Bits)

Definition at line 321 of file bits.h.

                         :
    B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){Gen(_Bits);}
TBSet ( TSIn SIn)

Definition at line 325 of file bits.h.

                  {
    SIn.Load(B4s); SIn.Load(Bits);
    SIn.LoadBf(&LastB4Mask, sizeof(TB4Def::TB4));
    B4T=(TB4Def::TB4*)SIn.LoadNewBf(B4s*sizeof(TB4Def::TB4));}
void Wr ( )
~TBSet ( )

Definition at line 324 of file bits.h.

{delete[] B4T;}

Variable Documentation

Definition at line 315 of file bits.h.

ClassTPV (TBSet, PBSet, TBSetV) private TB4Def::TB4 LastB4Mask

Definition at line 311 of file bits.h.