SNAP Library 4.0, User Reference  2017-07-27 13:18:06
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
TGLib_OLD::TVecPool< TVal > Class Template Reference

#include <ds.h>

Public Types

typedef TPt< TVecPool< TVal > > PVecPool
 
typedef TVec< TVal > TValV
 

Public Member Functions

 TVecPool (const ::TSize &ExpectVals=0, const ::TSize &_GrowBy=1000000, const bool &_FastCopy=false, const TVal &_EmptyVal=TVal())
 
 TVecPool (const TVecPool &Pool)
 
 TVecPool (TSIn &SIn)
 
 ~TVecPool ()
 
void Save (TSOut &SOut) const
 
TVecPooloperator= (const TVecPool &Pool)
 
::TSize GetVals () const
 
::TSize GetVecs () const
 
bool IsVId (const int &VId) const
 
::TSize Reserved () const
 
void Reserve (const ::TSize &MxVals)
 
const TVal & GetEmptyVal () const
 
void SetEmptyVal (const TVal &_EmptyVal)
 
::TSize GetMemUsed () const
 
int AddV (const TValV &ValV)
 
int AddEmptyV (const int &ValVLen)
 
uint GetVLen (const int &VId) const
 
TVal * GetValVPt (const int &VId) const
 
void GetV (const int &VId, TValV &ValV) const
 
void PutV (const int &VId, const TValV &ValV)
 
void CompactPool (const TVal &DelVal)
 
void ShuffleAll (TRnd &Rnd=TInt::Rnd)
 
void Clr (bool DoDel=true)
 
void PutAll (const TVal &Val)
 

Static Public Member Functions

static PVecPool New (const ::TSize &ExpectVals=0, const ::TSize &GrowBy=1000000, const bool &FastCopy=false)
 
static PVecPool Load (TSIn &SIn)
 
static PVecPool Load (const TStr &FNm)
 

Private Member Functions

void Resize (const ::TSize &_MxVals)
 

Private Attributes

TCRef CRef
 
TBool FastCopy
 
::TSize GrowBy
 
::TSize MxVals
 
::TSize Vals
 
TVal EmptyVal
 
TVal * ValBf
 
TVec< ::TSizeIdToOffV
 

Friends

class TPt< TVecPool< TVal > >
 

Detailed Description

template<class TVal>
class TGLib_OLD::TVecPool< TVal >

Definition at line 1938 of file ds.h.

Member Typedef Documentation

template<class TVal >
typedef TPt<TVecPool<TVal> > TGLib_OLD::TVecPool< TVal >::PVecPool

Definition at line 1940 of file ds.h.

template<class TVal >
typedef TVec<TVal> TGLib_OLD::TVecPool< TVal >::TValV

Definition at line 1941 of file ds.h.

Constructor & Destructor Documentation

template<class TVal >
TVecPool< TVal >::TVecPool ( const ::TSize ExpectVals = 0,
const ::TSize _GrowBy = 1000000,
const bool &  _FastCopy = false,
const TVal &  _EmptyVal = TVal() 
)

Definition at line 2037 of file ds.h.

2037  :
2038  GrowBy(_GrowBy), MxVals(0), Vals(0), EmptyVal(_EmptyVal), ValBf(NULL) {
2039  IdToOffV.Add(0);
2040  Resize(ExpectVals);
2041 }
::TSize Vals
Definition: ds.h:1945
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
::TSize MxVals
Definition: ds.h:1945
void Resize(const ::TSize &_MxVals)
Definition: ds.h:2010
TVal * ValBf
Definition: ds.h:1947
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
template<class TVal >
TVecPool< TVal >::TVecPool ( const TVecPool< TVal > &  Pool)

Definition at line 2044 of file ds.h.

2044  :
2045  FastCopy(Pool.FastCopy), GrowBy(Pool.GrowBy),
2046  MxVals(Pool.MxVals), Vals(Pool.Vals), EmptyVal(Pool.EmptyVal), IdToOffV(Pool.IdToOffV) {
2047  try { ValBf = new TVal [MxVals]; }
2048  catch (std::exception Ex) { FailR(TStr::Fmt("TVecPool::TVecPool: %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
2049  IAssert(ValBf != NULL);
2050  if (FastCopy) {
2051  memcpy(ValBf, Pool.ValBf, MxVals*sizeof(TVal)); }
2052  else {
2053  for (TSize ValN = 0; ValN < MxVals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
2054 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1945
TVal * ValBf
Definition: ds.h:1681
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
TSize GrowBy
Definition: ds.h:1679
TVal EmptyVal
Definition: ds.h:1680
::TSize MxVals
Definition: ds.h:1945
size_t TSize
Definition: bd.h:58
#define FailR(Reason)
Definition: bd.h:240
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TBool FastCopy
Definition: ds.h:1678
TVal * ValBf
Definition: ds.h:1947
TVec< uint64, int > IdToOffV
Definition: ds.h:1682
TBool FastCopy
Definition: ds.h:1944
TSize Vals
Definition: ds.h:1679
TSize MxVals
Definition: ds.h:1679
template<class TVal >
TVecPool< TVal >::TVecPool ( TSIn SIn)

Definition at line 2057 of file ds.h.

2057  :
2058  FastCopy(SIn) {
2059  uint64 _GrowBy, _MxVals, _Vals;
2060  SIn.Load(_GrowBy); SIn.Load(_MxVals); SIn.Load(_Vals);
2061  IAssert(_GrowBy<TSizeMx && _MxVals<TSizeMx && _Vals<TSizeMx);
2062  GrowBy=TSize(_GrowBy); MxVals=TSize(_Vals); Vals=TSize(_Vals); //note MxVals==Vals
2063  EmptyVal = TVal(SIn);
2064  if (MxVals==0) { ValBf = NULL; } else { ValBf = new TVal [MxVals]; }
2065  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN] = TVal(SIn); }
2066  { TInt MxVals(SIn), Vals(SIn);
2067  IdToOffV.Gen(Vals);
2068  for (int ValN = 0; ValN < Vals; ValN++) {
2069  uint64 Offset; SIn.Load(Offset); IAssert(Offset < TSizeMx);
2070  IdToOffV[ValN]=TSize(Offset);
2071  } }
2072 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1945
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
::TSize MxVals
Definition: ds.h:1945
unsigned long long uint64
Definition: bd.h:38
void Load(bool &Bool)
Definition: fl.h:84
#define TSizeMx
Definition: bd.h:59
size_t TSize
Definition: bd.h:58
Definition: dt.h:1134
TVal * ValBf
Definition: ds.h:1947
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TBool FastCopy
Definition: ds.h:1944
template<class TVal >
TGLib_OLD::TVecPool< TVal >::~TVecPool ( )
inline

Definition at line 1955 of file ds.h.

1955 { if (ValBf != NULL) { delete [] ValBf; } ValBf=NULL; }
TVal * ValBf
Definition: ds.h:1947

Member Function Documentation

template<class TVal >
int TVecPool< TVal >::AddEmptyV ( const int &  ValVLen)

Definition at line 2119 of file ds.h.

2119  {
2120  if (ValVLen==0){return 0;}
2121  if (MxVals < Vals+ValVLen){Resize(Vals+MAX(TSize(ValVLen), GrowBy)); }
2122  Vals+=ValVLen; IdToOffV.Add(Vals);
2123  return IdToOffV.Len()-1;
2124 }
::TSize Vals
Definition: ds.h:1945
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
::TSize MxVals
Definition: ds.h:1945
void Resize(const ::TSize &_MxVals)
Definition: ds.h:2010
size_t TSize
Definition: bd.h:58
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
#define MAX(a, b)
Definition: bd.h:350
template<class TVal >
int TVecPool< TVal >::AddV ( const TValV ValV)

Definition at line 2108 of file ds.h.

2108  {
2109  const ::TSize ValVLen = ValV.Len();
2110  if (ValVLen == 0) { return 0; }
2111  if (MxVals < Vals+ValVLen) { Resize(Vals+MAX(ValVLen, GrowBy)); }
2112  if (FastCopy) { memcpy(ValBf+Vals, ValV.BegI(), sizeof(TVal)*ValV.Len()); }
2113  else { for (uint ValN=0; ValN < ValVLen; ValN++) { ValBf[Vals+ValN]=ValV[ValN]; } }
2114  Vals+=ValVLen; IdToOffV.Add(Vals);
2115  return IdToOffV.Len()-1;
2116 }
::TSize Vals
Definition: ds.h:1945
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
::TSize MxVals
Definition: ds.h:1945
void Resize(const ::TSize &_MxVals)
Definition: ds.h:2010
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1947
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
#define MAX(a, b)
Definition: bd.h:350
TBool FastCopy
Definition: ds.h:1944
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Clr ( bool  DoDel = true)
inline

Definition at line 1998 of file ds.h.

1998  {
1999  IdToOffV.Clr(DoDel); MxVals=0; Vals=0;
2000  if (DoDel && ValBf!=NULL) { delete [] ValBf; ValBf=NULL;}
2001  if (! DoDel) { PutAll(EmptyVal); }
2002  }
::TSize Vals
Definition: ds.h:1945
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
void PutAll(const TVal &Val)
Definition: ds.h:2003
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
::TSize MxVals
Definition: ds.h:1945
TVal * ValBf
Definition: ds.h:1947
template<class TVal >
void TVecPool< TVal >::CompactPool ( const TVal &  DelVal)

Definition at line 2129 of file ds.h.

2129  {
2130  ::TSize TotalDel=0, NDel=0;
2131  // printf("Compacting %d vectors\n", IdToOffV.Len());
2132  for (int vid = 1; vid < IdToOffV.Len(); vid++) {
2133  // if (vid % 10000000 == 0) { printf(" %dm", vid/1000000); fflush(stdout); }
2134  const uint Len = GetVLen(vid);
2135  TVal* ValV = GetValVPt(vid);
2136  if (TotalDel > 0) { IdToOffV[vid-1] -= TotalDel; } // update end of vector
2137  if (Len == 0) { continue; }
2138  NDel = 0;
2139  for (TVal* v = ValV; v < ValV+Len-NDel; v++) {
2140  if (*v == DelVal) {
2141  TVal* Beg = v;
2142  while (*v == DelVal && v < ValV+Len) { v++; NDel++; }
2143  memcpy(Beg, v, sizeof(TVal)*int(Len - ::TSize(v - ValV)));
2144  v -= NDel;
2145  }
2146  }
2147  memcpy(ValV-TotalDel, ValV, sizeof(TVal)*Len); // move data
2148  TotalDel += NDel;
2149  }
2150  IdToOffV.Last() -= TotalDel;
2151  for (::TSize i = Vals-TotalDel; i < Vals; i++) { ValBf[i] = EmptyVal; }
2152  Vals -= TotalDel;
2153  // printf(" deleted %llu elements from the pool\n", TotalDel);
2154 }
::TSize Vals
Definition: ds.h:1945
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
uint GetVLen(const int &VId) const
Definition: ds.h:1976
size_t TSize
Definition: bd.h:58
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579
TVal * ValBf
Definition: ds.h:1947
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1979
template<class TVal >
const TVal& TGLib_OLD::TVecPool< TVal >::GetEmptyVal ( ) const
inline

Definition at line 1969 of file ds.h.

1969 { return EmptyVal; }
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetMemUsed ( ) const
inline

Definition at line 1971 of file ds.h.

1971  {
1972  return sizeof(TCRef)+sizeof(TBool)+3*sizeof(TSize)+sizeof(TVal*)+MxVals*sizeof(TVal);}
Definition: bd.h:440
::TSize MxVals
Definition: ds.h:1945
size_t TSize
Definition: bd.h:58
Definition: dt.h:971
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::GetV ( const int &  VId,
TValV ValV 
) const
inline

Definition at line 1982 of file ds.h.

1982  {
1983  if (GetVLen(VId)==0){ValV.Clr();}
1984  else { ValV.GenExt(GetValVPt(VId), GetVLen(VId)); } }
uint GetVLen(const int &VId) const
Definition: ds.h:1976
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1979
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVals ( ) const
inline

Definition at line 1964 of file ds.h.

1964 { return Vals; }
::TSize Vals
Definition: ds.h:1945
template<class TVal >
TVal* TGLib_OLD::TVecPool< TVal >::GetValVPt ( const int &  VId) const
inline

Definition at line 1979 of file ds.h.

1979  {
1980  if (GetVLen(VId)==0){return (TVal*)&EmptyVal;}
1981  else {return ValBf+IdToOffV[VId-1];}}
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
uint GetVLen(const int &VId) const
Definition: ds.h:1976
TVal * ValBf
Definition: ds.h:1947
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVecs ( ) const
inline

Definition at line 1965 of file ds.h.

1965 { return IdToOffV.Len(); }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
template<class TVal >
uint TGLib_OLD::TVecPool< TVal >::GetVLen ( const int &  VId) const
inline

Definition at line 1976 of file ds.h.

1976  {
1977  if (VId==0){return 0;}
1978  else {return uint(IdToOffV[VId]-IdToOffV[VId-1]);}}
unsigned int uint
Definition: bd.h:11
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
template<class TVal >
bool TGLib_OLD::TVecPool< TVal >::IsVId ( const int &  VId) const
inline

Definition at line 1966 of file ds.h.

1966 { return (0 <= VId) && (VId < IdToOffV.Len()); }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
template<class TVal >
static PVecPool TGLib_OLD::TVecPool< TVal >::Load ( TSIn SIn)
inlinestatic

Definition at line 1958 of file ds.h.

1958 { return new TVecPool(SIn); }
TVecPool(const ::TSize &ExpectVals=0, const ::TSize &_GrowBy=1000000, const bool &_FastCopy=false, const TVal &_EmptyVal=TVal())
Definition: ds.h:2037
template<class TVal >
static PVecPool TGLib_OLD::TVecPool< TVal >::Load ( const TStr FNm)
inlinestatic

Definition at line 1959 of file ds.h.

1959 { TFIn FIn(FNm); return Load(FIn); }
Definition: fl.h:275
static PVecPool Load(TSIn &SIn)
Definition: ds.h:1958
template<class TVal >
static PVecPool TGLib_OLD::TVecPool< TVal >::New ( const ::TSize ExpectVals = 0,
const ::TSize GrowBy = 1000000,
const bool &  FastCopy = false 
)
inlinestatic

Definition at line 1956 of file ds.h.

1956  {
1957  return new TVecPool(ExpectVals, GrowBy, FastCopy); }
::TSize GrowBy
Definition: ds.h:1945
TVecPool(const ::TSize &ExpectVals=0, const ::TSize &_GrowBy=1000000, const bool &_FastCopy=false, const TVal &_EmptyVal=TVal())
Definition: ds.h:2037
TBool FastCopy
Definition: ds.h:1944
template<class TVal >
TVecPool< TVal > & TVecPool< TVal >::operator= ( const TVecPool< TVal > &  Pool)

Definition at line 2088 of file ds.h.

2088  {
2089  if (this!=&Pool) {
2090  FastCopy = Pool.FastCopy;
2091  GrowBy = Pool.GrowBy;
2092  MxVals = Pool.MxVals;
2093  Vals = Pool.Vals;
2094  EmptyVal = Pool.EmptyVal;
2095  IdToOffV=Pool.IdToOffV;
2096  try { ValBf = new TVal [MxVals]; }
2097  catch (std::exception Ex) { FailR(TStr::Fmt("TVec::operator= : %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
2098  IAssert(ValBf != NULL);
2099  if (FastCopy) {
2100  memcpy(ValBf, Pool.ValBf, Vals*sizeof(TVal)); }
2101  else {
2102  for (uint64 ValN = 0; ValN < Vals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
2103  }
2104  return *this;
2105 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1945
TVal * ValBf
Definition: ds.h:1681
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
TSize GrowBy
Definition: ds.h:1679
TVal EmptyVal
Definition: ds.h:1680
::TSize MxVals
Definition: ds.h:1945
unsigned long long uint64
Definition: bd.h:38
#define FailR(Reason)
Definition: bd.h:240
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TBool FastCopy
Definition: ds.h:1678
TVal * ValBf
Definition: ds.h:1947
TVec< uint64, int > IdToOffV
Definition: ds.h:1682
TBool FastCopy
Definition: ds.h:1944
TSize Vals
Definition: ds.h:1679
TSize MxVals
Definition: ds.h:1679
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::PutAll ( const TVal &  Val)
inline

Definition at line 2003 of file ds.h.

2003  {
2004  for (TSize ValN = 0; ValN < MxVals; ValN++) { ValBf[ValN]=Val; } }
::TSize MxVals
Definition: ds.h:1945
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1947
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::PutV ( const int &  VId,
const TValV ValV 
)
inline

Definition at line 1985 of file ds.h.

1985  {
1986  IAssert(IsVId(VId) && GetVLen(VId) == ValV.Len());
1987  if (FastCopy) {
1988  memcpy(GetValVPt(VId), ValV.BegI(), sizeof(TVal)*ValV.Len()); }
1989  else { TVal* ValPt = GetValVPt(VId);
1990  for (uint ValN=0; ValN < uint(ValV.Len()); ValN++, ValPt++) { *ValPt=ValV[ValN]; }
1991  }
1992  }
#define IAssert(Cond)
Definition: bd.h:262
unsigned int uint
Definition: bd.h:11
bool IsVId(const int &VId) const
Definition: ds.h:1966
uint GetVLen(const int &VId) const
Definition: ds.h:1976
TBool FastCopy
Definition: ds.h:1944
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1979
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Reserve ( const ::TSize MxVals)
inline

Definition at line 1968 of file ds.h.

1968 { Resize(MxVals); }
::TSize MxVals
Definition: ds.h:1945
void Resize(const ::TSize &_MxVals)
Definition: ds.h:2010
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::Reserved ( ) const
inline

Definition at line 1967 of file ds.h.

1967 { return MxVals; }
::TSize MxVals
Definition: ds.h:1945
template<class TVal >
void TVecPool< TVal >::Resize ( const ::TSize _MxVals)
private

Definition at line 2010 of file ds.h.

2010  {
2011  if (_MxVals <= MxVals){ return; } else { MxVals = _MxVals; }
2012  if (ValBf == NULL) {
2013  try { ValBf = new TVal [MxVals]; }
2014  catch (std::exception Ex) {
2015  FailR(TStr::Fmt("TVecPool::Resize 1: %s, MxVals: %d. [Program failed to allocate more memory. Solution: Get a bigger machine and a 64-bit compiler.]", Ex.what(), _MxVals).CStr()); }
2016  IAssert(ValBf != NULL);
2017  if (EmptyVal != TVal()) { PutAll(EmptyVal); }
2018  } else {
2019  // printf("*** Resize vector pool: %llu -> %llu\n", uint64(Vals), uint64(MxVals));
2020  TVal* NewValBf = NULL;
2021  try { NewValBf = new TVal [MxVals]; }
2022  catch (std::exception Ex) { FailR(TStr::Fmt("TVecPool::Resize 2: %s, MxVals: %d. [Program failed to allocate more memory. Solution: Get a bigger machine and a 64-bit compiler.]", Ex.what(), _MxVals).CStr()); }
2023  IAssert(NewValBf != NULL);
2024  if (FastCopy) {
2025  memcpy(NewValBf, ValBf, Vals*sizeof(TVal)); }
2026  else {
2027  for (TSize ValN = 0; ValN < Vals; ValN++){ NewValBf[ValN] = ValBf[ValN]; } }
2028  if (EmptyVal != TVal()) { // init empty values
2029  for (TSize ValN = Vals; ValN < MxVals; ValN++) { NewValBf[ValN] = EmptyVal; }
2030  }
2031  delete [] ValBf;
2032  ValBf = NewValBf;
2033  }
2034 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1945
void PutAll(const TVal &Val)
Definition: ds.h:2003
::TSize MxVals
Definition: ds.h:1945
size_t TSize
Definition: bd.h:58
#define FailR(Reason)
Definition: bd.h:240
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TVal * ValBf
Definition: ds.h:1947
TBool FastCopy
Definition: ds.h:1944
template<class TVal >
void TVecPool< TVal >::Save ( TSOut SOut) const

Definition at line 2075 of file ds.h.

2075  {
2076  SOut.Save(FastCopy);
2077  uint64 _GrowBy=GrowBy, _MxVals=MxVals, _Vals=Vals;
2078  SOut.Save(_GrowBy); SOut.Save(_MxVals); SOut.Save(_Vals);
2079  SOut.Save(EmptyVal);
2080  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN].Save(SOut); }
2081  { SOut.Save(IdToOffV.Len()); SOut.Save(IdToOffV.Len());
2082  for (int ValN = 0; ValN < IdToOffV.Len(); ValN++) {
2083  const uint64 Offset=IdToOffV[ValN]; SOut.Save(Offset);
2084  } }
2085 }
::TSize Vals
Definition: ds.h:1945
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TVec< ::TSize > IdToOffV
Definition: ds.h:1948
::TSize GrowBy
Definition: ds.h:1945
::TSize MxVals
Definition: ds.h:1945
unsigned long long uint64
Definition: bd.h:38
size_t TSize
Definition: bd.h:58
void Save(const bool &Bool)
Definition: fl.h:173
TVal * ValBf
Definition: ds.h:1947
TBool FastCopy
Definition: ds.h:1944
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::SetEmptyVal ( const TVal &  _EmptyVal)
inline

Definition at line 1970 of file ds.h.

1970 { EmptyVal = _EmptyVal; }
template<class TVal >
void TVecPool< TVal >::ShuffleAll ( TRnd Rnd = TInt::Rnd)

Definition at line 2158 of file ds.h.

2158  {
2159  for (::TSize n = Vals-1; n > 0; n--) {
2160  const ::TSize k = ::TSize(((uint64(Rnd.GetUniDevInt())<<32) | uint64(Rnd.GetUniDevInt())) % (n+1));
2161  const TVal Tmp = ValBf[n];
2162  ValBf[n] = ValBf[k];
2163  ValBf[k] = Tmp;
2164  }
2165 }
::TSize Vals
Definition: ds.h:1945
unsigned long long uint64
Definition: bd.h:38
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1947
int GetUniDevInt(const int &Range=0)
Definition: dt.cpp:39

Friends And Related Function Documentation

template<class TVal >
friend class TPt< TVecPool< TVal > >
friend

Definition at line 2006 of file ds.h.

Member Data Documentation

template<class TVal >
TCRef TGLib_OLD::TVecPool< TVal >::CRef
private

Definition at line 1943 of file ds.h.

template<class TVal >
TVal TGLib_OLD::TVecPool< TVal >::EmptyVal
private

Definition at line 1946 of file ds.h.

template<class TVal >
TBool TGLib_OLD::TVecPool< TVal >::FastCopy
private

Definition at line 1944 of file ds.h.

template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GrowBy
private

Definition at line 1945 of file ds.h.

template<class TVal >
TVec< ::TSize> TGLib_OLD::TVecPool< TVal >::IdToOffV
private

Definition at line 1948 of file ds.h.

template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::MxVals
private

Definition at line 1945 of file ds.h.

template<class TVal >
TVal* TGLib_OLD::TVecPool< TVal >::ValBf
private

Definition at line 1947 of file ds.h.

template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::Vals
private

Definition at line 1945 of file ds.h.


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