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
blobbs.h File Reference

Go to the source code of this file.

Classes

class  TGBlobBs
class  TMBlobBs

Enumerations

enum  TBlobBsState { bbsUndef, bbsOpened, bbsClosed }
enum  TBlobTag { btUndef, btBegin, btEnd }
enum  TBlobState { bsUndef, bsActive, bsFree }

Functions

 TBlobPt ()
 TBlobPt (const TBlobPt &Pt)
 TBlobPt (const uchar &_Seg, const uint &_Addr, const TB8Set &_FSet1, const TB8Set &_FSet2, const TB8Set &_FSet3)
 TBlobPt (const uchar &_Seg, const uint &_Addr)
 TBlobPt (const uint &_Addr)
 TBlobPt (const int &_Addr)
 ~TBlobPt ()
 TBlobPt (TSIn &SIn)
void Save (TSOut &SOut) const
TBlobPtoperator= (const TBlobPt &Pt)
bool operator== (const TBlobPt &Pt) const
bool operator< (const TBlobPt &Pt) const
int GetMemUsed () const
int GetPrimHashCd () const
int GetSecHashCd () const
bool Empty () const
void Clr ()
void PutSeg (const uchar &_Seg)
uchar GetSeg () const
void PutAddr (const uint &_Addr)
uint GetAddr () const
void PutFlag (const int &FlagN, const bool &Val)
bool IsFlag (const int &FlagN) const
void MergeFlags (const TBlobPt &Pt)
void PutFSet (const int &FSetN, const TB8Set &FSet)
TB8Set GetFSet (const int &FSetN)
static TBlobPt Load (const PFRnd &FRnd)
void Save (const PFRnd &FRnd) const
static TBlobPt LoadAddr (const PFRnd &FRnd, const uchar &Seg=0)
void SaveAddr (const PFRnd &FRnd) const
TStr GetAddrStr () const
TStr GetStr () const
 UndefCopyAssign (TBlobBs)
 TBlobBs ()
virtual ~TBlobBs ()
 TBlobBs (TSIn &)
static PBlobBs Load (TSIn &)
virtual TStr GetVersionStr () const =0
void PutVersionStr (const PFRnd &FBlobBs)
void AssertVersionStr (const PFRnd &FBlobBs)
TStr GetBlobBsStateStr (const TBlobBsState &BlobBsState)
int GetStateStrLen ()
void PutBlobBsStateStr (const PFRnd &FBlobBs, const TBlobBsState &State)
void AssertBlobBsStateStr (const PFRnd &FBlobBs, const TBlobBsState &State)
void PutMxSegLen (const PFRnd &FBlobBs, const int &MxSegLen)
int GetMxSegLen (const PFRnd &FBlobBs)
void GenBlockLenV (TIntV &BlockLenV)
void PutBlockLenV (const PFRnd &FBlobBs, const TIntV &BlockLenV)
void GetBlockLenV (const PFRnd &FBlobBs, TIntV &BlockLenV)
void GenFFreeBlobPtV (const TIntV &BlockLenV, TBlobPtV &FFreeBlobPtV)
void PutFFreeBlobPtV (const PFRnd &FBlobBs, const TBlobPtV &FFreeBlobPtV)
void GetFFreeBlobPtV (const PFRnd &FBlobBs, TBlobPtV &FFreeBlobPtV)
void GetAllocInfo (const int &BfL, const TIntV &BlockLenV, int &MxBfL, int &FFreeBlobPtN)
uint GetBeginBlobTag ()
uint GetEndBlobTag ()
void PutBlobTag (const PFRnd &FBlobBs, const TBlobTag &BlobTag)
void AssertBlobTag (const PFRnd &FBlobBs, const TBlobTag &BlobTag)
void PutBlobState (const PFRnd &FBlobBs, const TBlobState &State)
TBlobState GetBlobState (const PFRnd &FBlobBs)
void AssertBlobState (const PFRnd &FBlobBs, const TBlobState &State)
void AssertBfCsEqFlCs (const TCs &BfCs, const TCs &FCs)
virtual TBlobPt PutBlob (const PSIn &SIn)=0
TBlobPt PutBlob (const TStr &Str)
virtual TBlobPt PutBlob (const TBlobPt &BlobPt, const PSIn &SIn)=0
virtual PSIn GetBlob (const TBlobPt &BlobPt)=0
virtual void DelBlob (const TBlobPt &BlobPt)=0
virtual TBlobPt GetFirstBlobPt ()=0
virtual TBlobPt FFirstBlobPt ()=0
virtual bool FNextBlobPt (TBlobPt &TrvBlobPt, TBlobPt &BlobPt, PSIn &BlobSIn)=0
bool FNextBlobPt (TBlobPt &TrvBlobPt, PSIn &BlobSIn)

Variables

static ClassTVQ(TBlobPt,
TBlobPtV, TBlobPtQ) public
const int 
Flags
uchar Seg
uint Addr
TB8Set FSet1
TB8Set FSet2
TB8Set FSet3
static ClassTPV(TBlobBs,
PBlobBs, TBlobBsV) public
const int 
MxBlobFLen = 1000000000
static const TStr MxSegLenVNm = "MxSegLen"
static const TStr BlockLenVNm = "BlockLenV"
static const TStr FFreeBlobPtVNm = "FFreeBlobPtV"

Enumeration Type Documentation

Enumerator:
bbsUndef 
bbsOpened 
bbsClosed 

Definition at line 83 of file blobbs.h.

enum TBlobState
Enumerator:
bsUndef 
bsActive 
bsFree 

Definition at line 85 of file blobbs.h.

enum TBlobTag
Enumerator:
btUndef 
btBegin 
btEnd 

Definition at line 84 of file blobbs.h.


Function Documentation

void TBlobBs::AssertBfCsEqFlCs ( const TCs BfCs,
const TCs FCs 
)

Definition at line 205 of file blobbs.cpp.

                                                             {
  if (BfCs!=FCs){
    printf("[%d:%d]\n", BfCs.Get(), FCs.Get());}
  //EAssert(BfCs==FCs);
}
void TBlobBs::AssertBlobBsStateStr ( const PFRnd &  FBlobBs,
const TBlobBsState State 
)

Definition at line 90 of file blobbs.cpp.

                                                 {
  TStr CorrStateStr=GetBlobBsStateStr(State);
  bool IsOk;
  TStr TestStateStr=FBlobBs->GetStr(GetStateStrLen(), IsOk);
  if (!(IsOk && (CorrStateStr==TestStateStr))) {
        TExcept::ThrowFull("Error in AssertBlobBsStateStr!", TStr(__FILE__)+" line "+TInt::GetStr(__LINE__));
  }
}
void TBlobBs::AssertBlobState ( const PFRnd &  FBlobBs,
const TBlobState State 
)

Definition at line 201 of file blobbs.cpp.

                                                                          {
  EAssert(TBlobState(FBlobBs->GetCh())==State);
}
void TBlobBs::AssertBlobTag ( const PFRnd &  FBlobBs,
const TBlobTag BlobTag 
)

Definition at line 185 of file blobbs.cpp.

                                                                        {
  switch (BlobTag){
    case btBegin: EAssert(FBlobBs->GetUInt()==GetBeginBlobTag()); break;
    case btEnd: EAssert(FBlobBs->GetUInt()==GetEndBlobTag()); break;
        default: TExcept::Throw("Error asserting BlobTag");
  }
}
void TBlobBs::AssertVersionStr ( const PFRnd &  FBlobBs)

Definition at line 68 of file blobbs.cpp.

                                                  {
  TStr CorrVersionStr=GetVersionStr();
  bool IsOk=false;
  TStr TestVersionStr=FBlobBs->GetStr(CorrVersionStr.Len(), IsOk);
  EAssert(IsOk && (CorrVersionStr==TestVersionStr));
}
void Clr ( )

Definition at line 48 of file blobbs.h.

virtual void DelBlob ( const TBlobPt BlobPt) [pure virtual]
bool Empty ( ) const

Definition at line 47 of file blobbs.h.

{return Addr==TUInt::Mx;}
virtual TBlobPt FFirstBlobPt ( ) [pure virtual]
virtual bool FNextBlobPt ( TBlobPt TrvBlobPt,
TBlobPt BlobPt,
PSIn BlobSIn 
) [pure virtual]
bool FNextBlobPt ( TBlobPt TrvBlobPt,
PSIn BlobSIn 
)

Definition at line 146 of file blobbs.h.

                                                     {
    TBlobPt BlobPt; return FNextBlobPt(TrvBlobPt, BlobPt, BlobSIn);}
void TBlobBs::GenBlockLenV ( TIntV BlockLenV)

Definition at line 114 of file blobbs.cpp.

                                          {
  BlockLenV.Clr();
  for (int P2Exp=0; P2Exp<TB4Def::MxP2Exp; P2Exp++){
    BlockLenV.Add(TInt(TB4Def::GetP2(P2Exp)));}
  EAssert(int(BlockLenV.Last())<2000000000);

  {for (int Len=10; Len<100; Len+=10){BlockLenV.Add(Len);}}
  {for (int Len=100; Len<10000; Len+=100){BlockLenV.Add(Len);}}
  {for (int Len=10000; Len<100000; Len+=1000){BlockLenV.Add(Len);}}
  {for (int Len=100000; Len<1000000; Len+=25000){BlockLenV.Add(Len);}}
  {for (int Len=1000000; Len<10000000; Len+=1000000){BlockLenV.Add(Len);}}
  {for (int Len=10000000; Len<100000000; Len+=10000000){BlockLenV.Add(Len);}}

  BlockLenV.Sort();
}
void TBlobBs::GenFFreeBlobPtV ( const TIntV BlockLenV,
TBlobPtV &  FFreeBlobPtV 
)

Definition at line 148 of file blobbs.cpp.

                                                                           {
  FFreeBlobPtV.Gen(BlockLenV.Len()+1);
}
uint GetAddr ( ) const

Definition at line 52 of file blobbs.h.

{return Addr;}
TStr GetAddrStr ( ) const

Definition at line 74 of file blobbs.h.

                          {
    TChA AddrChA; AddrChA+=TInt::GetStr(Seg); AddrChA+=':';
    AddrChA+=TUInt::GetStr(Addr); return AddrChA;}
void TBlobBs::GetAllocInfo ( const int &  BfL,
const TIntV BlockLenV,
int &  MxBfL,
int &  FFreeBlobPtN 
)

Definition at line 168 of file blobbs.cpp.

                                                                       {
  int BlockLenN=0;
  while ((BlockLenN<BlockLenV.Len())&&(BfL>BlockLenV[BlockLenN])){
    BlockLenN++;}
  EAssert(BlockLenN<BlockLenV.Len());
  MxBfL=BlockLenV[BlockLenN]; FFreeBlobPtN=BlockLenN;
}

Definition at line 125 of file blobbs.h.

{return 0xABCDEFFF;}
virtual PSIn GetBlob ( const TBlobPt BlobPt) [pure virtual]
TStr TBlobBs::GetBlobBsStateStr ( const TBlobBsState BlobBsState)

Definition at line 75 of file blobbs.cpp.

                                                              {
  TStr StateStr;
  switch (BlobBsState){
    case bbsOpened: StateStr="Opened"; break;
    case bbsClosed: StateStr="Closed"; break;
    default: Fail; return TStr();
  }
  EAssert(StateStr.Len()==GetStateStrLen());
  return StateStr;
}
TBlobState TBlobBs::GetBlobState ( const PFRnd &  FBlobBs)

Definition at line 197 of file blobbs.cpp.

                                                    {
  return TBlobState(int(FBlobBs->GetCh()));
}
void TBlobBs::GetBlockLenV ( const PFRnd &  FBlobBs,
TIntV BlockLenV 
)

Definition at line 138 of file blobbs.cpp.

                                                                {
  EAssert(FBlobBs->GetStr(BlockLenVNm.Len())==BlockLenVNm);
  BlockLenV.Gen(FBlobBs->GetInt());
  for (int BlockLenN=0; BlockLenN<BlockLenV.Len(); BlockLenN++){
    BlockLenV[BlockLenN]=FBlobBs->GetInt();}
  EAssert(FBlobBs->GetInt()==-1);
}

Definition at line 126 of file blobbs.h.

{return 0xFFFEDCBA;}
void TBlobBs::GetFFreeBlobPtV ( const PFRnd &  FBlobBs,
TBlobPtV &  FFreeBlobPtV 
)

Definition at line 160 of file blobbs.cpp.

                                                                         {
  EAssert(FBlobBs->GetStr(FFreeBlobPtVNm.Len())==FFreeBlobPtVNm);
  FFreeBlobPtV.Gen(FBlobBs->GetInt());
  for (int FFreeBlobPtN=0; FFreeBlobPtN<FFreeBlobPtV.Len(); FFreeBlobPtN++){
    FFreeBlobPtV[FFreeBlobPtN]=TBlobPt::Load(FBlobBs);}
  EAssert(FBlobBs->GetInt()==-1);
}
virtual TBlobPt GetFirstBlobPt ( ) [pure virtual]
TB8Set TBlobPt::GetFSet ( const int &  FSetN)

Definition at line 34 of file blobbs.cpp.

                                       {
  switch (FSetN){
    case 1: return FSet1;
    case 2: return FSet2;
    case 3: return FSet3;
    default: Fail; return TB8Set();
  }
}
uint64 GetMemUsed ( ) const

Definition at line 42 of file blobbs.h.

{return sizeof(TBlobPt);}
int TBlobBs::GetMxSegLen ( const PFRnd &  FBlobBs)

Definition at line 107 of file blobbs.cpp.

                                            {
  EAssert(FBlobBs->GetStr(MxSegLenVNm.Len())==MxSegLenVNm);
  return FBlobBs->GetInt();
}
int GetPrimHashCd ( ) const

Definition at line 44 of file blobbs.h.

{return abs(int(Addr));}
int GetSecHashCd ( ) const

Definition at line 45 of file blobbs.h.

{return (abs(int(Addr))+int(Seg)*0x10);}
uchar GetSeg ( ) const

Definition at line 50 of file blobbs.h.

{return Seg;}
int GetStateStrLen ( )

Definition at line 104 of file blobbs.h.

{return 6;}
TStr GetStr ( ) const

Definition at line 201 of file html.h.

{return Str;}
virtual TStr GetVersionStr ( ) const [pure virtual]
bool TBlobPt::IsFlag ( const int &  FlagN) const

Definition at line 15 of file blobbs.cpp.

                                           {
  EAssert((0<=FlagN)&&(FlagN<Flags));
  switch (FlagN/8){
    case 0: return FSet1.GetBit(7-FlagN%8);
    case 1: return FSet2.GetBit(7-FlagN%8);
    case 2: return FSet3.GetBit(7-FlagN%8);
    default: Fail; return false;
  }
}
static TBlobPt Load ( const PFRnd &  FRnd) [static]

Definition at line 60 of file blobbs.h.

                                        {
    uchar Seg=FRnd->GetUCh(); uint Addr=FRnd->GetUInt();
    TB8Set B8Set1(FRnd->GetUCh()); TB8Set B8Set2(FRnd->GetUCh());
    TB8Set B8Set3(FRnd->GetUCh());
    return TBlobPt(Seg, Addr, B8Set1, B8Set2, B8Set3);}
static PBlobBs Load ( TSIn ) [static]

Definition at line 96 of file blobbs.h.

{Fail; return NULL;}
static TBlobPt LoadAddr ( const PFRnd &  FRnd,
const uchar Seg = 0 
) [static]

Definition at line 69 of file blobbs.h.

                                                                {
    return TBlobPt(Seg, FRnd->GetUInt());}
void MergeFlags ( const TBlobPt Pt)

Definition at line 55 of file blobbs.h.

                                    {
    FSet1|=Pt.FSet1; FSet2|=Pt.FSet2; FSet3|=Pt.FSet3;}
bool operator< ( const TBlobPt Pt) const

Definition at line 40 of file blobbs.h.

                                          {
    return (Seg<Pt.Seg)||((Seg==Pt.Seg)&&(Addr<Pt.Addr));}
TBlobPt& operator= ( const TBlobPt Pt)

Definition at line 33 of file blobbs.h.

                                       {
    if (this!=&Pt){
      Seg=Pt.Seg; Addr=Pt.Addr;
      FSet1=Pt.FSet1; FSet2=Pt.FSet2; FSet3=Pt.FSet3;}
    return *this;}
bool operator== ( const TBlobPt Pt) const

Definition at line 38 of file blobbs.h.

                                           {
    return (Seg==Pt.Seg)&&(Addr==Pt.Addr);}
void PutAddr ( const uint _Addr)

Definition at line 51 of file blobbs.h.

{Addr=_Addr;}
virtual TBlobPt PutBlob ( const PSIn SIn) [pure virtual]
TBlobPt PutBlob ( const TStr Str)

Definition at line 137 of file blobbs.h.

                                  {
    PSIn SIn=TStrIn::New(Str); return PutBlob(SIn);}
virtual TBlobPt PutBlob ( const TBlobPt BlobPt,
const PSIn SIn 
) [pure virtual]
void TBlobBs::PutBlobBsStateStr ( const PFRnd &  FBlobBs,
const TBlobBsState State 
)

Definition at line 86 of file blobbs.cpp.

                                                                              {
  FBlobBs->PutStr(GetBlobBsStateStr(State));
}
void TBlobBs::PutBlobState ( const PFRnd &  FBlobBs,
const TBlobState State 
)

Definition at line 193 of file blobbs.cpp.

                                                                       {
  FBlobBs->PutCh(char(State));
}
void TBlobBs::PutBlobTag ( const PFRnd &  FBlobBs,
const TBlobTag BlobTag 
)

Definition at line 177 of file blobbs.cpp.

                                                                     {
  switch (BlobTag){
    case btBegin: FBlobBs->PutUInt(GetBeginBlobTag()); break;
    case btEnd: FBlobBs->PutUInt(GetEndBlobTag()); break;
    default: Fail;
  }
}
void TBlobBs::PutBlockLenV ( const PFRnd &  FBlobBs,
const TIntV BlockLenV 
)

Definition at line 130 of file blobbs.cpp.

                                                                      {
  FBlobBs->PutStr(BlockLenVNm);
  FBlobBs->PutInt(BlockLenV.Len());
  for (int BlockLenN=0; BlockLenN<BlockLenV.Len(); BlockLenN++){
    FBlobBs->PutInt(BlockLenV[BlockLenN]);}
  FBlobBs->PutInt(-1);
}
void TBlobBs::PutFFreeBlobPtV ( const PFRnd &  FBlobBs,
const TBlobPtV &  FFreeBlobPtV 
)

Definition at line 152 of file blobbs.cpp.

                                                                               {
  FBlobBs->PutStr(FFreeBlobPtVNm);
  FBlobBs->PutInt(FFreeBlobPtV.Len());
  for (int BlockLenN=0; BlockLenN<FFreeBlobPtV.Len(); BlockLenN++){
    FFreeBlobPtV[BlockLenN].Save(FBlobBs);}
  FBlobBs->PutInt(-1);
}
void TBlobPt::PutFlag ( const int &  FlagN,
const bool &  Val 
)

Definition at line 5 of file blobbs.cpp.

                                                      {
  EAssert((0<=FlagN)&&(FlagN<Flags));
  switch (FlagN/8){
    case 0: FSet1.SetBit(7-FlagN%8, Val); break;
    case 1: FSet2.SetBit(7-FlagN%8, Val); break;
    case 2: FSet3.SetBit(7-FlagN%8, Val); break;
    default: Fail;
  }
}
void TBlobPt::PutFSet ( const int &  FSetN,
const TB8Set FSet 
)

Definition at line 25 of file blobbs.cpp.

                                                         {
  switch (FSetN){
    case 1: FSet1=FSet; break;
    case 2: FSet2=FSet; break;
    case 3: FSet3=FSet; break;
    default: Fail;
  }
}
void TBlobBs::PutMxSegLen ( const PFRnd &  FBlobBs,
const int &  MxSegLen 
)

Definition at line 102 of file blobbs.cpp.

                                                                  {
  FBlobBs->PutStr(MxSegLenVNm);
  FBlobBs->PutInt(MxSegLen);
}
void PutSeg ( const uchar _Seg)

Definition at line 49 of file blobbs.h.

{Seg=_Seg;}
void TBlobBs::PutVersionStr ( const PFRnd &  FBlobBs)

Definition at line 64 of file blobbs.cpp.

                                               {
  FBlobBs->PutStr(GetVersionStr());
}
void Save ( TSOut SOut) const

Definition at line 29 of file blobbs.h.

                               {
    SOut.Save(Seg); SOut.Save(Addr);
    FSet1.Save(SOut); FSet2.Save(SOut); FSet3.Save(SOut);}
void Save ( const PFRnd &  FRnd) const

Definition at line 65 of file blobbs.h.

                                     {
    FRnd->PutUCh(Seg); FRnd->PutUInt(Addr);
    FRnd->PutUCh(FSet1.GetUCh()); FRnd->PutUCh(FSet2.GetUCh());
    FRnd->PutUCh(FSet3.GetUCh());}
void SaveAddr ( const PFRnd &  FRnd) const

Definition at line 71 of file blobbs.h.

                                         {
    FRnd->PutUInt(Addr);}
TBlobBs ( )

Definition at line 93 of file blobbs.h.

{}
TBlobBs ( TSIn )

Definition at line 95 of file blobbs.h.

{Fail;}
TBlobPt ( )

Definition at line 11 of file blobbs.h.

           :
    Seg(0), Addr(TUInt::Mx), FSet1(), FSet2(), FSet3(){}
TBlobPt ( const TBlobPt Pt)

Definition at line 13 of file blobbs.h.

                            :
    Seg(Pt.Seg), Addr(Pt.Addr),
    FSet1(Pt.FSet1), FSet2(Pt.FSet2), FSet3(Pt.FSet3){}
TBlobPt ( const uchar _Seg,
const uint _Addr,
const TB8Set _FSet1,
const TB8Set _FSet2,
const TB8Set _FSet3 
)

Definition at line 16 of file blobbs.h.

                                                                    :
    Seg(_Seg), Addr(_Addr), FSet1(_FSet1), FSet2(_FSet2), FSet3(_FSet3){}
TBlobPt ( const uchar _Seg,
const uint _Addr 
)

Definition at line 19 of file blobbs.h.

                                               :
    Seg(_Seg), Addr(_Addr), FSet1(), FSet2(), FSet3(){}
TBlobPt ( const uint _Addr)

Definition at line 21 of file blobbs.h.

                            :
    Seg(0), Addr(_Addr), FSet1(), FSet2(), FSet3(){}
TBlobPt ( const int &  _Addr)

Definition at line 23 of file blobbs.h.

                           :
    Seg(0), Addr(uint(_Addr)), FSet1(), FSet2(), FSet3(){IAssert(_Addr>=0);}
TBlobPt ( TSIn SIn)

Definition at line 26 of file blobbs.h.

                    {
    SIn.Load(Seg); SIn.Load(Addr);
    FSet1=TB8Set(SIn); FSet2=TB8Set(SIn); FSet3=TB8Set(SIn);}
virtual ~TBlobBs ( ) [virtual]

Definition at line 94 of file blobbs.h.

{}
~TBlobPt ( )

Definition at line 25 of file blobbs.h.

{}

Variable Documentation

Definition at line 8 of file blobbs.h.

const TStr TBlobBs::BlockLenVNm = "BlockLenV" [static]

Definition at line 112 of file blobbs.h.

const TStr TBlobBs::FFreeBlobPtVNm = "FFreeBlobPtV" [static]

Definition at line 117 of file blobbs.h.

ClassTVQ (TBlobPt, TBlobPtV, TBlobPtQ) public const int Flags [static]

Definition at line 3 of file blobbs.h.

Definition at line 9 of file blobbs.h.

Definition at line 9 of file blobbs.h.

Definition at line 9 of file blobbs.h.

const int TBlobBs::MxBlobFLen = 1000000000 [static]

Definition at line 87 of file blobbs.h.

const TStr TBlobBs::MxSegLenVNm = "MxSegLen" [static]

Definition at line 108 of file blobbs.h.

Definition at line 7 of file blobbs.h.