SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TB1Def Class Reference

#include <bits.h>

Collaboration diagram for TB1Def:

Public Types

typedef uchar TB1
 

Public Member Functions

 TB1Def ()
 
 ~TB1Def ()
 
TB1Defoperator= (const TB1Def &)
 

Static Public Member Functions

static int GetB1Bits (const TB1 &B1)
 
static uint GetP2 (const int &P2Exp)
 
static int GetL2 (const uchar &Val)
 
static bool GetBit (const int &BitN, const uchar &Val)
 

Public Attributes

TB1B1P2T
 
int * B1BitsT
 

Static Public Attributes

static const int B1Bits =8
 
static const int MxP2Exp =TB1Def::B1Bits-1
 
static const TB1 MxB1 =0xFF
 
static const TB1Def B1Def
 

Detailed Description

Definition at line 5 of file bits.h.

Member Typedef Documentation

typedef uchar TB1Def::TB1

Definition at line 7 of file bits.h.

Constructor & Destructor Documentation

TB1Def::TB1Def ( )

Definition at line 7 of file bits.cpp.

References B1Bits, B1BitsT, B1P2T, and MxB1.

7  {
8  B1P2T=new TB1[B1Bits+1]; B1P2T[0]=1;
9  for (int BitN=1; BitN<B1Bits; BitN++){B1P2T[BitN]=TB1(2*B1P2T[BitN-1]);}
10  B1P2T[B1Bits]=0;
11 
12  B1BitsT=new int[MxB1+1];
13  for (int B1N=0; B1N<MxB1+1; B1N++){
14  TB1 B1=(TB1)B1N; B1BitsT[B1]=0;
15  for (int BitN=0; BitN<B1Bits; BitN++){B1BitsT[B1N]+=B1%2; B1/=(TB1)2;}}
16 }
int * B1BitsT
Definition: bits.h:12
TB1 * B1P2T
Definition: bits.h:11
static const TB1 MxB1
Definition: bits.h:10
static const int B1Bits
Definition: bits.h:8
uchar TB1
Definition: bits.h:7
TB1Def::~TB1Def ( )
inline

Definition at line 15 of file bits.h.

References B1BitsT, and B1P2T.

15 {delete[] B1P2T; delete[] B1BitsT;}
int * B1BitsT
Definition: bits.h:12
TB1 * B1P2T
Definition: bits.h:11

Member Function Documentation

int TB1Def::GetB1Bits ( const TB1 B1)
static

Definition at line 18 of file bits.cpp.

References B1BitsT, and B1Def.

Referenced by TB8Set::Get1s().

18  {
19  return B1Def.B1BitsT[B1];
20 }
int * B1BitsT
Definition: bits.h:12
static const TB1Def B1Def
Definition: bits.h:24

Here is the caller graph for this function:

bool TB1Def::GetBit ( const int &  BitN,
const uchar Val 
)
static

Definition at line 33 of file bits.cpp.

References B1Def, B1P2T, IAssert, and MxP2Exp.

Referenced by TSparseGroup< TVal, GroupSize >::OffsetToPos().

33  {
34  IAssert((0<=BitN)&&(BitN<=TB1Def::MxP2Exp));
35  return (Val & B1Def.B1P2T[BitN])!=0;
36 }
#define IAssert(Cond)
Definition: bd.h:262
static const int MxP2Exp
Definition: bits.h:9
TB1 * B1P2T
Definition: bits.h:11
static const TB1Def B1Def
Definition: bits.h:24

Here is the caller graph for this function:

int TB1Def::GetL2 ( const uchar Val)
static

Definition at line 27 of file bits.cpp.

References B1Def, B1P2T, and MxP2Exp.

27  {
28  int L2=0;
29  while ((L2<TB1Def::MxP2Exp)&&(Val>=B1Def.B1P2T[L2])){L2++;}
30  return L2-1;
31 }
static const int MxP2Exp
Definition: bits.h:9
TB1 * B1P2T
Definition: bits.h:11
static const TB1Def B1Def
Definition: bits.h:24
uint TB1Def::GetP2 ( const int &  P2Exp)
static

Definition at line 22 of file bits.cpp.

References B1Def, B1P2T, IAssert, and MxP2Exp.

22  {
23  IAssert((0<=P2Exp)&&(P2Exp<=TB1Def::MxP2Exp));
24  return B1Def.B1P2T[P2Exp];
25 }
#define IAssert(Cond)
Definition: bd.h:262
static const int MxP2Exp
Definition: bits.h:9
TB1 * B1P2T
Definition: bits.h:11
static const TB1Def B1Def
Definition: bits.h:24
TB1Def& TB1Def::operator= ( const TB1Def )
inline

Definition at line 17 of file bits.h.

References Fail.

17 {Fail; return *this;}
#define Fail
Definition: bd.h:238

Member Data Documentation

const int TB1Def::B1Bits =8
static

Definition at line 8 of file bits.h.

Referenced by TB2Def::GetB2Bits(), TB4Def::GetB4Bits(), and TB1Def().

int* TB1Def::B1BitsT

Definition at line 12 of file bits.h.

Referenced by GetB1Bits(), TB2Def::GetB2Bits(), TB4Def::GetB4Bits(), TB1Def(), and ~TB1Def().

TB1* TB1Def::B1P2T

Definition at line 11 of file bits.h.

Referenced by GetBit(), TB8Set::GetInt(), GetL2(), GetP2(), TB8Set::Incl(), TB1Def(), and ~TB1Def().

const TB1Def::TB1 TB1Def::MxB1 =0xFF
static

Definition at line 10 of file bits.h.

Referenced by TB8Set::Fill(), TB2Def::GetB2Bits(), TB4Def::GetB4Bits(), and TB1Def().

const int TB1Def::MxP2Exp =TB1Def::B1Bits-1
static

Definition at line 9 of file bits.h.

Referenced by GetBit(), GetL2(), and GetP2().


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