SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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 1873 of file ds.h.

Member Typedef Documentation

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

Definition at line 1875 of file ds.h.

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

Definition at line 1876 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 1972 of file ds.h.

1972  :
1973  GrowBy(_GrowBy), MxVals(0), Vals(0), EmptyVal(_EmptyVal), ValBf(NULL) {
1974  IdToOffV.Add(0);
1975  Resize(ExpectVals);
1976 }
::TSize Vals
Definition: ds.h:1880
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
::TSize MxVals
Definition: ds.h:1880
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1945
TVal * ValBf
Definition: ds.h:1882
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
template<class TVal >
TVecPool< TVal >::TVecPool ( const TVecPool< TVal > &  Pool)

Definition at line 1979 of file ds.h.

1979  :
1980  FastCopy(Pool.FastCopy), GrowBy(Pool.GrowBy),
1981  MxVals(Pool.MxVals), Vals(Pool.Vals), EmptyVal(Pool.EmptyVal), IdToOffV(Pool.IdToOffV) {
1982  try { ValBf = new TVal [MxVals]; }
1983  catch (std::exception Ex) { FailR(TStr::Fmt("TVecPool::TVecPool: %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
1984  IAssert(ValBf != NULL);
1985  if (FastCopy) {
1986  memcpy(ValBf, Pool.ValBf, MxVals*sizeof(TVal)); }
1987  else {
1988  for (TSize ValN = 0; ValN < MxVals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
1989 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1880
TVal * ValBf
Definition: ds.h:1616
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
TSize GrowBy
Definition: ds.h:1614
TVal EmptyVal
Definition: ds.h:1615
::TSize MxVals
Definition: ds.h:1880
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:1613
TVal * ValBf
Definition: ds.h:1882
TVec< uint64, int > IdToOffV
Definition: ds.h:1617
TBool FastCopy
Definition: ds.h:1879
TSize Vals
Definition: ds.h:1614
TSize MxVals
Definition: ds.h:1614
template<class TVal >
TVecPool< TVal >::TVecPool ( TSIn SIn)

Definition at line 1992 of file ds.h.

1992  :
1993  FastCopy(SIn) {
1994  uint64 _GrowBy, _MxVals, _Vals;
1995  SIn.Load(_GrowBy); SIn.Load(_MxVals); SIn.Load(_Vals);
1996  IAssert(_GrowBy<TSizeMx && _MxVals<TSizeMx && _Vals<TSizeMx);
1997  GrowBy=TSize(_GrowBy); MxVals=TSize(_Vals); Vals=TSize(_Vals); //note MxVals==Vals
1998  EmptyVal = TVal(SIn);
1999  if (MxVals==0) { ValBf = NULL; } else { ValBf = new TVal [MxVals]; }
2000  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN] = TVal(SIn); }
2001  { TInt MxVals(SIn), Vals(SIn);
2002  IdToOffV.Gen(Vals);
2003  for (int ValN = 0; ValN < Vals; ValN++) {
2004  uint64 Offset; SIn.Load(Offset); IAssert(Offset < TSizeMx);
2005  IdToOffV[ValN]=TSize(Offset);
2006  } }
2007 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1880
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
::TSize MxVals
Definition: ds.h:1880
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:1044
TVal * ValBf
Definition: ds.h:1882
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:495
TBool FastCopy
Definition: ds.h:1879
template<class TVal >
TGLib_OLD::TVecPool< TVal >::~TVecPool ( )
inline

Definition at line 1890 of file ds.h.

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

Member Function Documentation

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

Definition at line 2054 of file ds.h.

2054  {
2055  if (ValVLen==0){return 0;}
2056  if (MxVals < Vals+ValVLen){Resize(Vals+MAX(TSize(ValVLen), GrowBy)); }
2057  Vals+=ValVLen; IdToOffV.Add(Vals);
2058  return IdToOffV.Len()-1;
2059 }
::TSize Vals
Definition: ds.h:1880
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
::TSize MxVals
Definition: ds.h:1880
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1945
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:574
#define MAX(a, b)
Definition: bd.h:350
template<class TVal >
int TVecPool< TVal >::AddV ( const TValV ValV)

Definition at line 2043 of file ds.h.

2043  {
2044  const ::TSize ValVLen = ValV.Len();
2045  if (ValVLen == 0) { return 0; }
2046  if (MxVals < Vals+ValVLen) { Resize(Vals+MAX(ValVLen, GrowBy)); }
2047  if (FastCopy) { memcpy(ValBf+Vals, ValV.BegI(), sizeof(TVal)*ValV.Len()); }
2048  else { for (uint ValN=0; ValN < ValVLen; ValN++) { ValBf[Vals+ValN]=ValV[ValN]; } }
2049  Vals+=ValVLen; IdToOffV.Add(Vals);
2050  return IdToOffV.Len()-1;
2051 }
::TSize Vals
Definition: ds.h:1880
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
::TSize MxVals
Definition: ds.h:1880
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1945
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1882
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
#define MAX(a, b)
Definition: bd.h:350
TBool FastCopy
Definition: ds.h:1879
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Clr ( bool  DoDel = true)
inline

Definition at line 1933 of file ds.h.

1933  {
1934  IdToOffV.Clr(DoDel); MxVals=0; Vals=0;
1935  if (DoDel && ValBf!=NULL) { delete [] ValBf; ValBf=NULL;}
1936  if (! DoDel) { PutAll(EmptyVal); }
1937  }
::TSize Vals
Definition: ds.h:1880
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
void PutAll(const TVal &Val)
Definition: ds.h:1938
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
::TSize MxVals
Definition: ds.h:1880
TVal * ValBf
Definition: ds.h:1882
template<class TVal >
void TVecPool< TVal >::CompactPool ( const TVal &  DelVal)

Definition at line 2064 of file ds.h.

2064  {
2065  ::TSize TotalDel=0, NDel=0;
2066  // printf("Compacting %d vectors\n", IdToOffV.Len());
2067  for (int vid = 1; vid < IdToOffV.Len(); vid++) {
2068  // if (vid % 10000000 == 0) { printf(" %dm", vid/1000000); fflush(stdout); }
2069  const uint Len = GetVLen(vid);
2070  TVal* ValV = GetValVPt(vid);
2071  if (TotalDel > 0) { IdToOffV[vid-1] -= TotalDel; } // update end of vector
2072  if (Len == 0) { continue; }
2073  NDel = 0;
2074  for (TVal* v = ValV; v < ValV+Len-NDel; v++) {
2075  if (*v == DelVal) {
2076  TVal* Beg = v;
2077  while (*v == DelVal && v < ValV+Len) { v++; NDel++; }
2078  memcpy(Beg, v, sizeof(TVal)*int(Len - ::TSize(v - ValV)));
2079  v -= NDel;
2080  }
2081  }
2082  memcpy(ValV-TotalDel, ValV, sizeof(TVal)*Len); // move data
2083  TotalDel += NDel;
2084  }
2085  IdToOffV.Last() -= TotalDel;
2086  for (::TSize i = Vals-TotalDel; i < Vals; i++) { ValBf[i] = EmptyVal; }
2087  Vals -= TotalDel;
2088  // printf(" deleted %llu elements from the pool\n", TotalDel);
2089 }
::TSize Vals
Definition: ds.h:1880
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
uint GetVLen(const int &VId) const
Definition: ds.h:1911
size_t TSize
Definition: bd.h:58
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:551
TVal * ValBf
Definition: ds.h:1882
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1914
template<class TVal >
const TVal& TGLib_OLD::TVecPool< TVal >::GetEmptyVal ( ) const
inline

Definition at line 1904 of file ds.h.

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

Definition at line 1906 of file ds.h.

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

Definition at line 1917 of file ds.h.

1917  {
1918  if (GetVLen(VId)==0){ValV.Clr();}
1919  else { ValV.GenExt(GetValVPt(VId), GetVLen(VId)); } }
uint GetVLen(const int &VId) const
Definition: ds.h:1911
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1914
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVals ( ) const
inline

Definition at line 1899 of file ds.h.

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

Definition at line 1914 of file ds.h.

1914  {
1915  if (GetVLen(VId)==0){return (TVal*)&EmptyVal;}
1916  else {return ValBf+IdToOffV[VId-1];}}
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
uint GetVLen(const int &VId) const
Definition: ds.h:1911
TVal * ValBf
Definition: ds.h:1882
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVecs ( ) const
inline

Definition at line 1900 of file ds.h.

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

Definition at line 1911 of file ds.h.

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

Definition at line 1901 of file ds.h.

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

Definition at line 1893 of file ds.h.

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

Definition at line 1894 of file ds.h.

1894 { TFIn FIn(FNm); return Load(FIn); }
Definition: fl.h:275
static PVecPool Load(TSIn &SIn)
Definition: ds.h:1893
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 1891 of file ds.h.

1891  {
1892  return new TVecPool(ExpectVals, GrowBy, FastCopy); }
::TSize GrowBy
Definition: ds.h:1880
TVecPool(const ::TSize &ExpectVals=0, const ::TSize &_GrowBy=1000000, const bool &_FastCopy=false, const TVal &_EmptyVal=TVal())
Definition: ds.h:1972
TBool FastCopy
Definition: ds.h:1879
template<class TVal >
TVecPool< TVal > & TVecPool< TVal >::operator= ( const TVecPool< TVal > &  Pool)

Definition at line 2023 of file ds.h.

2023  {
2024  if (this!=&Pool) {
2025  FastCopy = Pool.FastCopy;
2026  GrowBy = Pool.GrowBy;
2027  MxVals = Pool.MxVals;
2028  Vals = Pool.Vals;
2029  EmptyVal = Pool.EmptyVal;
2030  IdToOffV=Pool.IdToOffV;
2031  try { ValBf = new TVal [MxVals]; }
2032  catch (std::exception Ex) { FailR(TStr::Fmt("TVec::operator= : %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
2033  IAssert(ValBf != NULL);
2034  if (FastCopy) {
2035  memcpy(ValBf, Pool.ValBf, Vals*sizeof(TVal)); }
2036  else {
2037  for (uint64 ValN = 0; ValN < Vals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
2038  }
2039  return *this;
2040 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1880
TVal * ValBf
Definition: ds.h:1616
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
TSize GrowBy
Definition: ds.h:1614
TVal EmptyVal
Definition: ds.h:1615
::TSize MxVals
Definition: ds.h:1880
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:1613
TVal * ValBf
Definition: ds.h:1882
TVec< uint64, int > IdToOffV
Definition: ds.h:1617
TBool FastCopy
Definition: ds.h:1879
TSize Vals
Definition: ds.h:1614
TSize MxVals
Definition: ds.h:1614
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::PutAll ( const TVal &  Val)
inline

Definition at line 1938 of file ds.h.

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

Definition at line 1920 of file ds.h.

1920  {
1921  IAssert(IsVId(VId) && GetVLen(VId) == ValV.Len());
1922  if (FastCopy) {
1923  memcpy(GetValVPt(VId), ValV.BegI(), sizeof(TVal)*ValV.Len()); }
1924  else { TVal* ValPt = GetValVPt(VId);
1925  for (uint ValN=0; ValN < uint(ValV.Len()); ValN++, ValPt++) { *ValPt=ValV[ValN]; }
1926  }
1927  }
#define IAssert(Cond)
Definition: bd.h:262
unsigned int uint
Definition: bd.h:11
bool IsVId(const int &VId) const
Definition: ds.h:1901
uint GetVLen(const int &VId) const
Definition: ds.h:1911
TBool FastCopy
Definition: ds.h:1879
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1914
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Reserve ( const ::TSize MxVals)
inline

Definition at line 1903 of file ds.h.

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

Definition at line 1902 of file ds.h.

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

Definition at line 1945 of file ds.h.

1945  {
1946  if (_MxVals <= MxVals){ return; } else { MxVals = _MxVals; }
1947  if (ValBf == NULL) {
1948  try { ValBf = new TVal [MxVals]; }
1949  catch (std::exception Ex) {
1950  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()); }
1951  IAssert(ValBf != NULL);
1952  if (EmptyVal != TVal()) { PutAll(EmptyVal); }
1953  } else {
1954  // printf("*** Resize vector pool: %llu -> %llu\n", uint64(Vals), uint64(MxVals));
1955  TVal* NewValBf = NULL;
1956  try { NewValBf = new TVal [MxVals]; }
1957  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()); }
1958  IAssert(NewValBf != NULL);
1959  if (FastCopy) {
1960  memcpy(NewValBf, ValBf, Vals*sizeof(TVal)); }
1961  else {
1962  for (TSize ValN = 0; ValN < Vals; ValN++){ NewValBf[ValN] = ValBf[ValN]; } }
1963  if (EmptyVal != TVal()) { // init empty values
1964  for (TSize ValN = Vals; ValN < MxVals; ValN++) { NewValBf[ValN] = EmptyVal; }
1965  }
1966  delete [] ValBf;
1967  ValBf = NewValBf;
1968  }
1969 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1880
void PutAll(const TVal &Val)
Definition: ds.h:1938
::TSize MxVals
Definition: ds.h:1880
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:1882
TBool FastCopy
Definition: ds.h:1879
template<class TVal >
void TVecPool< TVal >::Save ( TSOut SOut) const

Definition at line 2010 of file ds.h.

2010  {
2011  SOut.Save(FastCopy);
2012  uint64 _GrowBy=GrowBy, _MxVals=MxVals, _Vals=Vals;
2013  SOut.Save(_GrowBy); SOut.Save(_MxVals); SOut.Save(_Vals);
2014  SOut.Save(EmptyVal);
2015  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN].Save(SOut); }
2016  { SOut.Save(IdToOffV.Len()); SOut.Save(IdToOffV.Len());
2017  for (int ValN = 0; ValN < IdToOffV.Len(); ValN++) {
2018  const uint64 Offset=IdToOffV[ValN]; SOut.Save(Offset);
2019  } }
2020 }
::TSize Vals
Definition: ds.h:1880
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< ::TSize > IdToOffV
Definition: ds.h:1883
::TSize GrowBy
Definition: ds.h:1880
::TSize MxVals
Definition: ds.h:1880
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:1882
TBool FastCopy
Definition: ds.h:1879
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::SetEmptyVal ( const TVal &  _EmptyVal)
inline

Definition at line 1905 of file ds.h.

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

Definition at line 2093 of file ds.h.

2093  {
2094  for (::TSize n = Vals-1; n > 0; n--) {
2095  const ::TSize k = ::TSize(((uint64(Rnd.GetUniDevInt())<<32) | uint64(Rnd.GetUniDevInt())) % (n+1));
2096  const TVal Tmp = ValBf[n];
2097  ValBf[n] = ValBf[k];
2098  ValBf[k] = Tmp;
2099  }
2100 }
::TSize Vals
Definition: ds.h:1880
unsigned long long uint64
Definition: bd.h:38
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1882
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 1941 of file ds.h.

Member Data Documentation

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

Definition at line 1878 of file ds.h.

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

Definition at line 1881 of file ds.h.

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

Definition at line 1879 of file ds.h.

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

Definition at line 1880 of file ds.h.

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

Definition at line 1883 of file ds.h.

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

Definition at line 1880 of file ds.h.

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

Definition at line 1882 of file ds.h.

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

Definition at line 1880 of file ds.h.


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