SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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
TB1Def Class Reference

#include <bits.h>

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.

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.

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.

18  {
19  return B1Def.B1BitsT[B1];
20 }
int * B1BitsT
Definition: bits.h:12
static const TB1Def B1Def
Definition: bits.h:24
bool TB1Def::GetBit ( const int &  BitN,
const uchar Val 
)
static

Definition at line 33 of file bits.cpp.

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
int TB1Def::GetL2 ( const uchar Val)
static

Definition at line 27 of file bits.cpp.

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.

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.

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.

int* TB1Def::B1BitsT

Definition at line 12 of file bits.h.

const TB1Def TB1Def::B1Def
static

Definition at line 24 of file bits.h.

TB1* TB1Def::B1P2T

Definition at line 11 of file bits.h.

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

Definition at line 10 of file bits.h.

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

Definition at line 9 of file bits.h.


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