|
SNAP Library, Developer Reference
2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
|

Go to the source code of this file.
Classes | |
| class | TRnd |
| class | TMemIn |
| class | TMemOut |
| class | TChA |
| class | TChAIn |
| class | TRStr |
| class | TStr |
| class | TStrIn |
| class | TDbStr |
| class | TVoid |
| class | TBool |
| class | TCh |
| class | TUCh |
| class | TSInt |
| class | TInt |
| class | TUInt |
| class | TUInt64 |
| class | TFlt |
| class | TAscFlt |
| class | TSFlt |
| class | TLFlt |
| class | TFltRect |
Typedefs | |
| typedef TVec< TStr > | TStrV |
Functions | |
| ClassHdTP (TXmlTok, PXmlTok) | |
| void | Resize (const int &_MxBfL) |
| bool | DoFitLen (const int &LBfL) const |
| TMem (const int &_MxBfL=0) | |
| static PMem | New (const int &MxBfL=0) |
| TMem (const void *_Bf, const int &_BfL) | |
| static PMem | New (const void *Bf, const int &BfL) |
| TMem (const TMem &Mem) | |
| static PMem | New (const TMem &Mem) |
| static PMem | New (const PMem &Mem) |
| TMem (const TStr &Str) | |
| static PMem | New (const TStr &Str) |
| ~TMem () | |
| TMem (TSIn &SIn) | |
| void | Save (TSOut &SOut) const |
| void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm) |
| void | SaveXml (TSOut &SOut, const TStr &Nm) const |
| TMem & | operator= (const TMem &Mem) |
| char * | operator() () const |
| TMem & | operator+= (const char &Ch) |
| TMem & | operator+= (const TMem &Mem) |
| TMem & | operator+= (const TStr &Str) |
| TMem & | operator+= (const PSIn &SIn) |
| char & | operator[] (const int &ChN) const |
| int | GetMemUsed () const |
| void | Gen (const int &_BfL) |
| void | GenZeros (const int &_BfL) |
| void | Reserve (const int &_MxBfL, const bool &DoClr=true) |
| void | Del (const int &BChN, const int &EChN) |
| void | Clr (const bool &DoDel=true) |
| int | Len () const |
| bool | Empty () const |
| void | Trunc (const int &_BfL) |
| void | Push (const char &Ch) |
| char | Pop () |
| bool | DoFitStr (const TStr &Str) const |
| void | AddBf (const void *Bf, const int &BfL) |
| char * | GetBf () const |
| TStr | GetAsStr (const char &NewNullCh='\0') const |
| PSIn | GetSIn () const |
| static void | LoadMem (const PSIn &SIn, TMem &Mem) |
| static void | LoadMem (const PSIn &SIn, const PMem &Mem) |
| void | SaveMem (const PSOut &SOut) const |
| void | Resize (uint _MxBfL) |
| TStrPool (uint MxBfLen=0, uint _GrowBy=16 *1024 *1024) | |
| TStrPool (TSIn &SIn, bool LoadCompact=true) | |
| TStrPool (const TStrPool &Pool) | |
| ~TStrPool () | |
| static PStrPool | New (uint _MxBfLen=0, uint _GrowBy=16 *1024 *1024) |
| static PStrPool | New (TSIn &SIn) |
| static PStrPool | Load (TSIn &SIn, bool LoadCompacted=true) |
| void | Save (const TStr &FNm) |
| uint | Size () const |
| TStrPool & | operator= (const TStrPool &Pool) |
| uint | AddStr (const char *Str, uint Len) |
| uint | AddStr (const char *Str) |
| uint | AddStr (const TStr &Str) |
| TStr | GetStr (uint Offset) const |
| const char * | GetCStr (uint Offset) const |
| void | Clr (bool DoDel=false) |
| int | Cmp (uint Offset, const char *Str) const |
| static int | GetPrimHashCd (const char *CStr) |
| static int | GetSecHashCd (const char *CStr) |
| int | GetPrimHashCd (uint Offset) |
| int | GetSecHashCd (uint Offset) |
| void | Resize (const ::TSize &_MxBfL) |
| TStrPool64 (::TSize _MxBfL=0,::TSize _GrowBy=16 *1024 *1024) | |
| TStrPool64 (const TStrPool64 &StrPool) | |
| TStrPool64 (TSIn &SIn, bool LoadCompact=true) | |
| ~TStrPool64 () | |
| static PStrPool64 | New (::TSize MxBfL=0,::TSize GrowBy=16 *1024 *1024) |
| TStrPool64 & | operator= (const TStrPool64 &StrPool) |
| uint64 | Reserved () const |
| int | Cmp (uint64 Offset, const char *Str) const |
| TStr | GetStr (const uint64 &StrId) const |
Variables | |
| ClassTP(TMem, PMem) private char * | Bf |
| void TMem::AddBf | ( | const void * | Bf, |
| const int & | BfL | ||
| ) |
Definition at line 279 of file dt.cpp.
References Bf, IAssert, Len(), and Reserve().
{
IAssert((_BfL>=0) && (_Bf != NULL));
Reserve(Len() + _BfL, false);
memcpy(Bf + BfL, _Bf, _BfL);
BfL+=_BfL;
//char* ChBf=(char*)Bf;
//for (int BfC=0; BfC<BfL; BfC++){
// char Ch=ChBf[BfC];
// operator+=(Ch);
//}
}

| int TBigStrPool::AddStr | ( | const char * | Str, |
| uint | Len | ||
| ) |
Definition at line 1680 of file dt.cpp.
References Assert, Bf, IAssertR, Len(), and Resize().
Referenced by AddStr(), TBigStrPool(), TStrPool(), and TStrPool64().
{
IAssertR(Len > 0, "String too short (length includes the null character)"); //J: if (! Len) return -1;
if (Len == 1 && BfL > 0) { return 0; } // empty string
Assert(Str); Assert(Len > 0);
if (BfL + Len > MxBfL) Resize(BfL + Len);
memcpy(Bf + BfL, Str, Len);
uint Pos = BfL; BfL += Len; return Pos;
}


Definition at line 791 of file dt.h.
References AddStr(), TStr::CStr(), and TStr::Len().

| void Clr | ( | const bool & | DoDel = true | ) |
| void Clr | ( | bool | DoDel = false | ) |
| void Del | ( | const int & | BChN, |
| const int & | EChN | ||
| ) |
Referenced by TVec< TVal >::AddSorted(), TLst< TVal >::Del(), TVec< TVal >::DelAll(), TVec< TVal >::DelIfIn(), and TCache< TKey, TDat, THashFunc >::Purge().

| bool DoFitLen | ( | const int & | LBfL | ) | const |
Definition at line 72 of file dt.h.
Referenced by DoFitStr().
{return BfL+LBfL<=MxBfL;}

| bool TMem::DoFitStr | ( | const TStr & | Str | ) | const |
Definition at line 235 of file dt.cpp.
References DoFitLen(), and TStr::Len().

| void Gen | ( | const int & | _BfL | ) |
Definition at line 113 of file dt.h.
References Clr(), and Resize().
Referenced by TCliqueOverlap::CalculateOverlapMtx(), TVec< TVal >::LoadXml(), and TBSet().


| void GenZeros | ( | const int & | _BfL | ) |
| char* GetBf | ( | ) | const |
Definition at line 795 of file dt.h.
References Assert, Bf, TStr::CStr(), and TStr::GetNullStr().
Referenced by TMAGFitBern::RandomInit(), and TMAGFitBern::UpdateAffMtx().
{ Assert(Offset < BfL);
if (Offset == 0) return TStr::GetNullStr().CStr(); else return Bf + Offset; }


| int GetMemUsed | ( | ) | const |
| static int GetPrimHashCd | ( | const char * | CStr | ) | [static] |
| int GetPrimHashCd | ( | uint | Offset | ) |
Definition at line 806 of file dt.h.
References Assert, Bf, and GetPrimHashCd().
{ Assert(Offset < BfL);
if (Offset != 0) return GetPrimHashCd(Bf + Offset); else return GetPrimHashCd(""); }

| static int GetSecHashCd | ( | const char * | CStr | ) | [static] |
| int GetSecHashCd | ( | uint | Offset | ) |
Definition at line 808 of file dt.h.
References Assert, Bf, and GetSecHashCd().
{ Assert(Offset < BfL);
if (Offset != 0) return GetSecHashCd(Bf + Offset); else return GetSecHashCd(""); }

Definition at line 136 of file dt.h.
References Bf, TMOut::GetSIn(), and TSOut::SaveBf().

Definition at line 793 of file dt.h.
References Assert, Bf, and TStr::GetNullStr().
{ Assert(Offset < BfL);
if (Offset == 0) return TStr::GetNullStr(); else return TStr(Bf + Offset); }

Definition at line 124 of file dt.h.
Referenced by AddBf(), TBigNet< TNodeData, IsDir >::AddSorted(), TVec< TVal >::AddSorted(), AddStr(), TVec< TVal >::AddV(), TVec< TVal >::AddVMerged(), TVecPool< TVal >::CompactPool(), TVec< TVal >::Count(), TVec< TVal >::Diff(), TStrHashF_DJB::DJBHash(), TLinAlg::DotProduct(), Empty(), TLAMisc::FillIdentity(), TLAMisc::FillRnd(), TAGM::GenAGM(), GenBlockLenV(), TSnap::GetBiConSzCnt(), THash< TKey, TDat, THashFunc >::GetDatKeyKdV(), THash< TKey, TDat, THashFunc >::GetDatKeyPrV(), TSparseHash< TKey, TDat, GroupSize >::GetDatKeyPrV(), TStrHash< TDat, TStringPool, THashFunc >::GetDatKeyPrV(), THash< TKey, TDat, THashFunc >::GetDatV(), TSparseHash< TKey, TDat, GroupSize >::GetDatV(), TStrHash< TDat, TStringPool, THashFunc >::GetDatV(), THash< TKey, TDat, THashFunc >::GetKeyDatKdV(), THash< TKey, TDat, THashFunc >::GetKeyDatPrV(), TSparseHash< TKey, TDat, GroupSize >::GetKeyDatPrV(), TStrHash< TDat, TStringPool, THashFunc >::GetKeyDatPrV(), TGHash< TDat >::GetKeyIdByDat(), TGHash< TDat >::GetKeyIdByGSz(), THash< TKey, TDat, THashFunc >::GetKeyV(), TSparseHash< TKey, TDat, GroupSize >::GetKeyV(), TStrHash< TDat, TStringPool, THashFunc >::GetKeyV(), TSparseSet< TKey, GroupSize >::GetKeyV(), TSnap::GetMxBiCon(), TSnap::GetMxScc(), TSnap::GetMxWcc(), THash< TKey, TDat, THashFunc >::GetRndKeyId(), TUrlLx::GetStr(), TStrHash< TDat, TStringPool, THashFunc >::GetStrIdV(), TVec< TVal >::GetSubValV(), TVec< TVal >::Intrs(), TVec< TVal >::IntrsLen(), IsCmt(), TLinAlg::LinComb(), TLAMisc::LoadMatlabTFltVV(), LogSumExp(), MemCpy(), MemSet(), TLinAlg::MultiplyScalar(), TVec< TVal >::NextPerm(), TLinAlg::NormL1(), TLinAlg::NormLinf(), TVec< TVal >::operator<(), THash< TKey, TDat, THashFunc >::operator==(), TVec< TVal >::operator==(), THashSet< TKey, THashFunc >::operator==(), TVec< TVal >::PrevPerm(), TSparseHash< TKey, TDat, GroupSize >::ResizeDelta(), TSparseSet< TKey, GroupSize >::ResizeDelta(), TBigNet< TNodeData, IsDir >::Rewire(), TLAMisc::SaveMatlabTFltIntKdV(), SaveMem(), TVec< TVal >::SearchBin(), THash< TKey, TDat, THashFunc >::Sort(), TVec< TVal >::Sort(), TLAMisc::SumVec(), TUniChDb::TestComposition(), TFullColMatrix::TFullColMatrix(), and TVec< TVal >::Union().
{return BfL;}

Definition at line 779 of file dt.h.
References TStrPool().
{ return PStrPool(new TStrPool(SIn, LoadCompacted)); }

Definition at line 139 of file dt.h.
References TSIn::GetBf(), and TSIn::Len().
Referenced by THttpLx::GetRest(), and THttpResp().


Definition at line 141 of file dt.h.
References TSIn::GetBf(), and TSIn::Len().

| static PMem New | ( | const int & | MxBfL = 0 | ) | [static] |
| static PMem New | ( | const void * | Bf, |
| const int & | BfL | ||
| ) | [static] |
| static PMem New | ( | const PMem & | Mem | ) | [static] |
Definition at line 776 of file dt.h.
References TStrPool().
{ return PStrPool(new TStrPool(_MxBfLen, _GrowBy)); }

Definition at line 777 of file dt.h.
References TStrPool().
{ return new TStrPool(SIn); }

Definition at line 827 of file dt.h.
References GrowBy, and TStrPool64().
{
return PStrPool64(new TStrPool64(MxBfL, GrowBy)); }

| char * operator() | ( | ) | const |
Definition at line 104 of file dt.h.
References Bf.
Referenced by TGStat::TCmpByVal::operator()().
{return Bf;}

| TMem& operator+= | ( | const char & | Ch | ) |
| TStrPool64& operator= | ( | const TStrPool64 & | StrPool | ) |
| char * operator[] | ( | const int & | ChN | ) | const |
| char Pop | ( | ) |
| void Push | ( | const char & | Ch | ) |
Definition at line 128 of file dt.h.
References operator+=().
{operator+=(Ch);}

| void Reserve | ( | const int & | _MxBfL, |
| const bool & | DoClr = true |
||
| ) |
Definition at line 838 of file dt.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::CopyFrom(), TSparseSet< TKey, GroupSize >::CopyFrom(), TSparseHash< TKey, TDat, GroupSize >::FindPos(), TSparseSet< TKey, GroupSize >::FindPos(), TSparseHash< TKey, TDat, GroupSize >::MoveFrom(), TSparseSet< TKey, GroupSize >::MoveFrom(), TSparseHash< TKey, TDat, GroupSize >::ResizeDelta(), and TSparseSet< TKey, GroupSize >::ResizeDelta().
{ return MxBfL; }

| void Resize | ( | const int & | _MxBfL | ) |
Referenced by TVecPool< TVal >::AddEmptyV(), THash< TKey, TDat, THashFunc >::AddKey(), TStrHash< TDat, TStringPool, THashFunc >::AddKey(), THashSet< TKey, THashFunc >::AddKey(), AddStr(), TVecPool< TVal >::AddV(), Gen(), GenZeros(), and Reserve().

Definition at line 93 of file dt.h.
References Bf, TSOut::Save(), and TSOut::SaveBf().

Definition at line 781 of file dt.h.
References TFOut::New(), and Save().
{PSOut SOut=TFOut::New(FNm); Save(*SOut);}

Definition at line 784 of file dt.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::GetMinSize(), and TSparseSet< TKey, GroupSize >::GetMinSize().
{ return MxBfL; }

| TMem | ( | const int & | _MxBfL = 0 | ) |
| TMem | ( | const void * | _Bf, |
| const int & | _BfL | ||
| ) |
| TMem::TMem | ( | const TStr & | Str | ) |
Definition at line 90 of file dt.h.
References Bf, TSIn::Load(), and TSIn::LoadBf().

| void Trunc | ( | const int & | _BfL | ) |
| TStrPool::TStrPool | ( | uint | MxBfLen = 0, |
| uint | _GrowBy = 16*1024*1024 |
||
| ) |
Definition at line 1648 of file dt.cpp.
References AddStr(), Bf, TStr::Fmt(), and IAssertR.
Referenced by Load(), TUniChDb::Load(), and New().
: MxBfL(MxBfLen), BfL(0), GrowBy(_GrowBy), Bf(0) { //IAssert(MxBfL >= 0); IAssert(GrowBy >= 0); if (MxBfL > 0) { Bf = (char *) malloc(MxBfL); IAssertR(Bf, TStr::Fmt("Can not resize buffer to %u bytes. [Program failed to allocate more memory. Solution: Get a bigger machine.]", MxBfL).CStr()); } AddStr(""); // add an empty string at the beginning for fast future access }


| TStrPool::TStrPool | ( | TSIn & | SIn, |
| bool | LoadCompact = true |
||
| ) |
Definition at line 1654 of file dt.cpp.
References Bf, TStr::Fmt(), GrowBy, IAssertR, TSIn::Load(), TSIn::LoadBf(), and TSIn::LoadCs().
: MxBfL(0), BfL(0), GrowBy(0), Bf(0) { SIn.Load(MxBfL); SIn.Load(BfL); SIn.Load(GrowBy); //IAssert(MxBfL >= BfL); IAssert(BfL >= 0); IAssert(GrowBy >= 0); if (LoadCompact) MxBfL = BfL; if (MxBfL > 0) { Bf = (char *) malloc(MxBfL); IAssertR(Bf, TStr::Fmt("Can not resize buffer to %u bytes. [Program failed to allocate more memory. Solution: Get a bigger machine.]", MxBfL).CStr()); } if (BfL > 0) SIn.LoadBf(Bf, BfL); SIn.LoadCs(); }

Definition at line 772 of file dt.h.
References TStr::Fmt(), and IAssertR.
: MxBfL(Pool.MxBfL), BfL(Pool.BfL), GrowBy(Pool.GrowBy) { Bf = (char *) malloc(Pool.MxBfL); IAssertR(Bf, TStr::Fmt("Can not resize buffer to %u bytes. [Program failed to allocate more memory. Solution: Get a bigger machine.]", MxBfL).CStr()); memcpy(Bf, Pool.Bf, Pool.BfL); }

| TStrPool64::TStrPool64 | ( | ::TSize | _MxBfL = 0, |
| ::TSize | _GrowBy = 16*1024*1024 |
||
| ) |
Definition at line 1715 of file dt.cpp.
References AddStr(), Bf, and IAssert.
Referenced by New().
:
MxBfL(_MxBfL), BfL(0), GrowBy(_GrowBy), Bf(NULL) {
if (MxBfL > 0) { Bf = (char*)malloc(MxBfL); IAssert(Bf != NULL); }
AddStr("");
}


| TStrPool64::TStrPool64 | ( | const TStrPool64 & | StrPool | ) |
| TStrPool64::TStrPool64 | ( | TSIn & | SIn, |
| bool | LoadCompact = true |
||
| ) |
Definition at line 1729 of file dt.cpp.
References Bf, TSIn::GetCh(), GrowBy, IAssert, TSIn::Load(), and TSIn::LoadCs().
: MxBfL(0), BfL(0), GrowBy(0), Bf(0) { uint64 _GrowBy, _MxBfL, _BfL; SIn.Load(_GrowBy); SIn.Load(_MxBfL); SIn.Load(_BfL); GrowBy = (::TSize)_GrowBy; MxBfL = (::TSize)_MxBfL; BfL = (::TSize)_BfL; if (LoadCompact) { MxBfL = BfL; } if (MxBfL > 0) { Bf = (char*)malloc(MxBfL); IAssert(Bf != NULL); } for (::TSize BfN = 0; BfN < _BfL; BfN++) { Bf[BfN] = SIn.GetCh(); } SIn.LoadCs(); }

| ~TStrPool | ( | ) |
| ~TStrPool64 | ( | ) |
| ClassTP (TStrPool64, PStrPool64) private char* Bf |
Definition at line 67 of file dt.h.
Referenced by AddBf(), AddStr(), Clr(), Cmp(), TStr::DelSubStr(), TStr::Fmt(), GenZeros(), GetBf(), TStr::GetCStr(), GetCStr(), GetCStrFromOffset(), TDir::GetCurDir(), TDir::GetExeDir(), TInt::GetHexStr(), GetPrimHashCd(), GetSecHashCd(), GetSIn(), TStr::GetStr(), GetStr(), TInt::GetStr(), TUInt::GetStr(), TFlt::GetStr(), TLFlt::GetStr(), GetStrFromOffset(), TStr::GetSubStr(), TSIn::LoadNewBf(), OnLnFmt(), OnNotifyFmt(), OnStatusFmt(), OnTxtFmt(), TCon::operator()(), operator()(), TCon::operator<<(), operator=(), operator[](), Pop(), PutSIn(), TSOut::PutStrFmt(), TSOut::PutStrFmtLn(), Save(), SaveMem(), TStr::SplitOnAllAnyCh(), TStr::SplitOnAllCh(), TStr::SplitOnNonAlNum(), TStr::SplitOnWs(), TBigStrPool(), TMem(), TStrPool(), TStrPool64(), ~TBigStrPool(), ~TMem(), and ~TStrPool().