SNAP Library 4.1, Developer Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TB32Set Class Reference

#include <bits.h>

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.

244 : B4(0){}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set::TB32Set ( const TB32Set B32Set)
inline

Definition at line 245 of file bits.h.

245 : B4(B32Set.B4){}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set::TB32Set ( const uint _B4)
inline

Definition at line 246 of file bits.h.

246 : B4(_B4){}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set::TB32Set ( TSIn SIn)
inline

Definition at line 247 of file bits.h.

References B4, and TSIn::LoadBf().

247 {SIn.LoadBf(&B4, sizeof(TB4Def::TB4));}
TB4Def::TB4 B4
Definition: bits.h:242
void LoadBf(const void *Bf, const TSize &BfL)
Definition: fl.h:81
uint TB4
Definition: bits.h:53

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.

255 {B4=0; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
bool TB32Set::Empty ( ) const
inline

Definition at line 254 of file bits.h.

References B4.

254 {return B4==0;}
TB4Def::TB4 B4
Definition: bits.h:242
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().

265  {
266  Assert((0<=BitN)&&(BitN<Bits));
267  B4&=~TB4Def::B4Def.B4P2T[BitN];}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
Definition: bits.h:51
TB4 * B4P2T
Definition: bits.h:57

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.

256 {B4=TB4Def::B4Def.MxB4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
static const TB4 MxB4
Definition: bits.h:56
static const TB4Def B4Def
Definition: bits.h:68
int TB32Set::Get0s ( ) const
inline

Definition at line 280 of file bits.h.

References Bits, and Get1s().

280 {return Bits-Get1s();}
static const int Bits
Definition: bits.h:241
int Get1s() const
Definition: bits.h:279

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().

279 {return TB4Def::B4Def.GetB4Bits(B4);}
TB4Def::TB4 B4
Definition: bits.h:242
static int GetB4Bits(const TB4 &B4)
Definition: bits.cpp:83
static const TB4Def B4Def
Definition: bits.h:68

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().

273  {
274  Assert((0<=BitN)&&(BitN<Bits));
275  return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
static const TB4Def B4Def
Definition: bits.h:68

Here is the caller graph for this function:

int TB32Set::GetBits ( ) const
inline

Definition at line 278 of file bits.h.

References Bits.

278 {return Bits;}
static const int Bits
Definition: bits.h:241
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.

288  {
289  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
290  return (B4>>MnBitN) & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1);}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
static const TB4Def B4Def
Definition: bits.h:68
TB4 * B4P2T
Definition: bits.h:57
TStr TB32Set::GetStr ( ) const

Definition at line 148 of file bits.cpp.

References Bits, and In().

148  {
149  TChA ChA;
150  for (int BitN=0; BitN<Bits; BitN++){
151  if (In(BitN)){ChA+='1';} else {ChA+='0';}}
152  return ChA;
153 }
static const int Bits
Definition: bits.h:241
bool In(const int &BitN) const
Definition: bits.h:268
Definition: dt.h:201

Here is the call graph for this function:

uint TB32Set::GetUInt ( ) const
inline

Definition at line 260 of file bits.h.

References B4.

260 {return B4;}
TB4Def::TB4 B4
Definition: bits.h:242
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().

268  {
269  Assert((0<=BitN)&&(BitN<Bits));
270  return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
static const TB4Def B4Def
Definition: bits.h:68

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().

262  {
263  Assert((0<=BitN)&&(BitN<Bits));
264  B4|=TB4Def::B4Def.B4P2T[BitN];}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
static const TB4Def B4Def
Definition: bits.h:68
TB4 * B4P2T
Definition: bits.h:57

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.

257  {
258  Assert((0<=MnBitN)&&(MnBitN<Bits));
259  return (B4>>MnBitN)==(BSet.B4>>MnBitN);}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
TB32Set& TB32Set::operator&= ( const TB32Set BSet)
inline

Definition at line 293 of file bits.h.

References B4.

293 {B4&=BSet.B4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
bool TB32Set::operator< ( const TB32Set BSet) const
inline

Definition at line 252 of file bits.h.

References B4.

252 {return B4<BSet.B4;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator<<= ( const int &  ShiftBits)
inline

Definition at line 298 of file bits.h.

References B4.

298 {B4<<=ShiftBits; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator= ( const TB32Set BSet)
inline

Definition at line 250 of file bits.h.

References B4.

250 {B4=BSet.B4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
bool TB32Set::operator== ( const TB32Set BSet) const
inline

Definition at line 251 of file bits.h.

References B4.

251 {return B4==BSet.B4;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator>>= ( const int &  ShiftBits)
inline

Definition at line 297 of file bits.h.

References B4.

297 {B4>>=ShiftBits; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator^= ( const TB32Set BSet)
inline

Definition at line 296 of file bits.h.

References B4.

296 {B4^=BSet.B4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator|= ( const TB32Set BSet)
inline

Definition at line 294 of file bits.h.

References B4.

294 {B4|=BSet.B4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
TB32Set& TB32Set::operator~ ( )
inline

Definition at line 292 of file bits.h.

References B4.

292 {B4=~B4; return *this;}
TB4Def::TB4 B4
Definition: bits.h:242
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.

284  {
285  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
286  B4 &= (~(TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;
287  B4 |= (Val & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;}
TB4Def::TB4 B4
Definition: bits.h:242
static const int Bits
Definition: bits.h:241
#define Assert(Cond)
Definition: bd.h:251
static const TB4Def B4Def
Definition: bits.h:68
TB4 * B4P2T
Definition: bits.h:57
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().

248 {SOut.SaveBf(&B4, sizeof(TB4Def::TB4));}
TB4Def::TB4 B4
Definition: bits.h:242
void SaveBf(const void *Bf, const TSize &BfL)
Definition: fl.h:172
uint TB4
Definition: bits.h:53

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().

271  {
272  if (Bool) Incl(BitN); else Excl(BitN);}
void Incl(const int &BitN)
Definition: bits.h:262
void Excl(const int &BitN)
Definition: bits.h:265

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().

276  {
277  SetBit(BitN, !GetBit(BitN));}
void SetBit(const int &BitN, const bool &Bool)
Definition: bits.h:271
bool GetBit(const int &BitN) const
Definition: bits.h:273

Here is the call graph for this function:

void TB32Set::Wr ( )

Definition at line 155 of file bits.cpp.

References Bits, and GetBit().

155  {
156  printf("[");
157  for (int BitN=0; BitN<Bits; BitN++){printf("%d", GetBit(BitN));}
158  printf("]\n");
159 }
static const int Bits
Definition: bits.h:241
bool GetBit(const int &BitN) const
Definition: bits.h:273

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.

302  {
303  return TB32Set(LBSet)&=RBSet;}
TB32Set()
Definition: bits.h:244
TB32Set operator^ ( const TB32Set LBSet,
const TB32Set RBSet 
)
friend

Definition at line 306 of file bits.h.

306  {
307  return TB32Set(LBSet)^=RBSet;}
TB32Set()
Definition: bits.h:244
TB32Set operator| ( const TB32Set LBSet,
const TB32Set RBSet 
)
friend

Definition at line 304 of file bits.h.

304  {
305  return TB32Set(LBSet)|=RBSet;}
TB32Set()
Definition: bits.h:244
TB32Set operator~ ( const TB32Set BSet)
friend

Definition at line 300 of file bits.h.

300  {
301  return ~TB32Set(BSet);}
Definition: bits.h:239

Member Data Documentation

const int TB32Set::Bits =32
staticprivate

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: