SNAP Library , Developer Reference  2013-01-07 14:03:36
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
TB1Def Class Reference

#include <bits.h>

Collaboration diagram for TB1Def:

List of all members.

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

Definition at line 7 of file bits.cpp.

References B1Bits, B1BitsT, B1P2T, and MxB1.

              {
  B1P2T=new TB1[B1Bits+1]; B1P2T[0]=1;
  for (int BitN=1; BitN<B1Bits; BitN++){B1P2T[BitN]=TB1(2*B1P2T[BitN-1]);}
  B1P2T[B1Bits]=0;

  B1BitsT=new int[MxB1+1];
  for (int B1N=0; B1N<MxB1+1; B1N++){
    TB1 B1=(TB1)B1N; B1BitsT[B1]=0;
    for (int BitN=0; BitN<B1Bits; BitN++){B1BitsT[B1N]+=B1%2; B1/=(TB1)2;}}
}
TB1Def::~TB1Def ( ) [inline]

Definition at line 15 of file bits.h.

References B1BitsT, and B1P2T.

{delete[] B1P2T; delete[] B1BitsT;}

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

                                  {
  return B1Def.B1BitsT[B1];
}

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

                                                    {
  IAssert((0<=BitN)&&(BitN<=TB1Def::MxP2Exp));
  return (Val & B1Def.B1P2T[BitN])!=0;
}

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.

                                 {
  int L2=0;
  while ((L2<TB1Def::MxP2Exp)&&(Val>=B1Def.B1P2T[L2])){L2++;}
  return L2-1;
}
uint TB1Def::GetP2 ( const int &  P2Exp) [static]

Definition at line 22 of file bits.cpp.

References B1Def, B1P2T, IAssert, and MxP2Exp.

                                  {
  IAssert((0<=P2Exp)&&(P2Exp<=TB1Def::MxP2Exp));
  return B1Def.B1P2T[P2Exp];
}
TB1Def& TB1Def::operator= ( const TB1Def ) [inline]

Definition at line 17 of file bits.h.

References Fail.

{Fail; return *this;}

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

Definition at line 12 of file bits.h.

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

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: