Ejemplo n.º 1
0
TBigStrPool::TBigStrPool(TSIn& SIn, bool LoadCompact) : MxBfL(0), BfL(0), GrowBy(0), Bf(0) {
  uint64 Tmp;
  SIn.Load(Tmp); IAssert(Tmp <= uint64(TSizeMx)); MxBfL=TSize(Tmp);
  SIn.Load(Tmp); IAssert(Tmp <= uint64(TSizeMx)); BfL=TSize(Tmp);
  SIn.Load(GrowBy);
  IAssert(MxBfL >= BfL);  IAssert(BfL >= 0);  IAssert(GrowBy >= 0);
  if (LoadCompact) MxBfL = BfL;
  if (MxBfL > 0) { Bf = (char *) malloc(MxBfL); IAssert(Bf); }
  if (BfL > 0) { SIn.LoadBf(Bf, BfL); }
  SIn.LoadCs();
  int NStr=0;  SIn.Load(NStr);
  IdOffV.Gen(NStr, 0);
  for (int i = 0; i < NStr; i++) {
    SIn.Load(Tmp);
    IAssert(Tmp <= uint64(TSizeMx));
    IdOffV.Add(TSize(Tmp));
  }
}
Ejemplo n.º 2
0
TStrFeatureSpace::TStrFeatureSpace(TSIn& In) {
	TInt Size(In);
	Space.Gen(Size,0);
	for (TStrFSSize i = 0; i < Size; i++) {
		int StrLen;
		In.Load(StrLen);
		char *Bf = new char[StrLen + 1];
		In.GetBf(Bf, StrLen);
		Bf[StrLen] = '\0';
		//printf("%d: [%s]\n", StrLen, Bf);
		int KeyId = ISpace.AddDat(Bf, i);
		Space.Add(ISpace.GetKeyOfs(KeyId));
		delete[] Bf;
	}
}