SNAP Library 2.4, User Reference  2015-05-11 19:40:56
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 1825 of file ds.h.

Member Typedef Documentation

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

Definition at line 1827 of file ds.h.

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

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

1924  :
1925  GrowBy(_GrowBy), MxVals(0), Vals(0), EmptyVal(_EmptyVal), ValBf(NULL) {
1926  IdToOffV.Add(0);
1927  Resize(ExpectVals);
1928 }
::TSize Vals
Definition: ds.h:1832
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
::TSize MxVals
Definition: ds.h:1832
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1897
TVal * ValBf
Definition: ds.h:1834
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
template<class TVal >
TVecPool< TVal >::TVecPool ( const TVecPool< TVal > &  Pool)

Definition at line 1931 of file ds.h.

1931  :
1932  FastCopy(Pool.FastCopy), GrowBy(Pool.GrowBy),
1933  MxVals(Pool.MxVals), Vals(Pool.Vals), EmptyVal(Pool.EmptyVal), IdToOffV(Pool.IdToOffV) {
1934  try { ValBf = new TVal [MxVals]; }
1935  catch (std::exception Ex) { FailR(TStr::Fmt("TVecPool::TVecPool: %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
1936  IAssert(ValBf != NULL);
1937  if (FastCopy) {
1938  memcpy(ValBf, Pool.ValBf, MxVals*sizeof(TVal)); }
1939  else {
1940  for (TSize ValN = 0; ValN < MxVals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
1941 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1832
TVal * ValBf
Definition: ds.h:1568
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
TSize GrowBy
Definition: ds.h:1566
TVal EmptyVal
Definition: ds.h:1567
::TSize MxVals
Definition: ds.h:1832
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:1565
TVal * ValBf
Definition: ds.h:1834
TVec< uint64, int > IdToOffV
Definition: ds.h:1569
TBool FastCopy
Definition: ds.h:1831
TSize Vals
Definition: ds.h:1566
TSize MxVals
Definition: ds.h:1566
template<class TVal >
TVecPool< TVal >::TVecPool ( TSIn SIn)

Definition at line 1944 of file ds.h.

1944  :
1945  FastCopy(SIn) {
1946  uint64 _GrowBy, _MxVals, _Vals;
1947  SIn.Load(_GrowBy); SIn.Load(_MxVals); SIn.Load(_Vals);
1948  IAssert(_GrowBy<TSizeMx && _MxVals<TSizeMx && _Vals<TSizeMx);
1949  GrowBy=TSize(_GrowBy); MxVals=TSize(_Vals); Vals=TSize(_Vals); //note MxVals==Vals
1950  EmptyVal = TVal(SIn);
1951  if (MxVals==0) { ValBf = NULL; } else { ValBf = new TVal [MxVals]; }
1952  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN] = TVal(SIn); }
1953  { TInt MxVals(SIn), Vals(SIn);
1954  IdToOffV.Gen(Vals);
1955  for (int ValN = 0; ValN < Vals; ValN++) {
1956  uint64 Offset; SIn.Load(Offset); IAssert(Offset < TSizeMx);
1957  IdToOffV[ValN]=TSize(Offset);
1958  } }
1959 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1832
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
::TSize MxVals
Definition: ds.h:1832
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:1042
TVal * ValBf
Definition: ds.h:1834
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:486
TBool FastCopy
Definition: ds.h:1831
template<class TVal >
TGLib_OLD::TVecPool< TVal >::~TVecPool ( )
inline

Definition at line 1842 of file ds.h.

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

Member Function Documentation

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

Definition at line 2006 of file ds.h.

2006  {
2007  if (ValVLen==0){return 0;}
2008  if (MxVals < Vals+ValVLen){Resize(Vals+max(TSize(ValVLen), GrowBy)); }
2009  Vals+=ValVLen; IdToOffV.Add(Vals);
2010  return IdToOffV.Len()-1;
2011 }
::TSize Vals
Definition: ds.h:1832
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
::TSize MxVals
Definition: ds.h:1832
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1897
size_t TSize
Definition: bd.h:58
#define max(a, b)
Definition: bd.h:350
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
template<class TVal >
int TVecPool< TVal >::AddV ( const TValV ValV)

Definition at line 1995 of file ds.h.

1995  {
1996  const ::TSize ValVLen = ValV.Len();
1997  if (ValVLen == 0) { return 0; }
1998  if (MxVals < Vals+ValVLen) { Resize(Vals+max(ValVLen, GrowBy)); }
1999  if (FastCopy) { memcpy(ValBf+Vals, ValV.BegI(), sizeof(TVal)*ValV.Len()); }
2000  else { for (uint ValN=0; ValN < ValVLen; ValN++) { ValBf[Vals+ValN]=ValV[ValN]; } }
2001  Vals+=ValVLen; IdToOffV.Add(Vals);
2002  return IdToOffV.Len()-1;
2003 }
::TSize Vals
Definition: ds.h:1832
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
::TSize MxVals
Definition: ds.h:1832
void Resize(const ::TSize &_MxVals)
Definition: ds.h:1897
size_t TSize
Definition: bd.h:58
#define max(a, b)
Definition: bd.h:350
TVal * ValBf
Definition: ds.h:1834
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
TBool FastCopy
Definition: ds.h:1831
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Clr ( bool  DoDel = true)
inline

Definition at line 1885 of file ds.h.

1885  {
1886  IdToOffV.Clr(DoDel); MxVals=0; Vals=0;
1887  if (DoDel && ValBf!=NULL) { delete [] ValBf; ValBf=NULL;}
1888  if (! DoDel) { PutAll(EmptyVal); }
1889  }
::TSize Vals
Definition: ds.h:1832
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
void PutAll(const TVal &Val)
Definition: ds.h:1890
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953
::TSize MxVals
Definition: ds.h:1832
TVal * ValBf
Definition: ds.h:1834
template<class TVal >
void TVecPool< TVal >::CompactPool ( const TVal &  DelVal)

Definition at line 2016 of file ds.h.

2016  {
2017  ::TSize TotalDel=0, NDel=0;
2018  // printf("Compacting %d vectors\n", IdToOffV.Len());
2019  for (int vid = 1; vid < IdToOffV.Len(); vid++) {
2020  // if (vid % 10000000 == 0) { printf(" %dm", vid/1000000); fflush(stdout); }
2021  const uint Len = GetVLen(vid);
2022  TVal* ValV = GetValVPt(vid);
2023  if (TotalDel > 0) { IdToOffV[vid-1] -= TotalDel; } // update end of vector
2024  if (Len == 0) { continue; }
2025  NDel = 0;
2026  for (TVal* v = ValV; v < ValV+Len-NDel; v++) {
2027  if (*v == DelVal) {
2028  TVal* Beg = v;
2029  while (*v == DelVal && v < ValV+Len) { v++; NDel++; }
2030  memcpy(Beg, v, sizeof(TVal)*int(Len - ::TSize(v - ValV)));
2031  v -= NDel;
2032  }
2033  }
2034  memcpy(ValV-TotalDel, ValV, sizeof(TVal)*Len); // move data
2035  TotalDel += NDel;
2036  }
2037  IdToOffV.Last() -= TotalDel;
2038  for (::TSize i = Vals-TotalDel; i < Vals; i++) { ValBf[i] = EmptyVal; }
2039  Vals -= TotalDel;
2040  // printf(" deleted %llu elements from the pool\n", TotalDel);
2041 }
::TSize Vals
Definition: ds.h:1832
unsigned int uint
Definition: bd.h:11
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
uint GetVLen(const int &VId) const
Definition: ds.h:1863
size_t TSize
Definition: bd.h:58
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:539
TVal * ValBf
Definition: ds.h:1834
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1866
template<class TVal >
const TVal& TGLib_OLD::TVecPool< TVal >::GetEmptyVal ( ) const
inline

Definition at line 1856 of file ds.h.

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

Definition at line 1858 of file ds.h.

1858  {
1859  return sizeof(TCRef)+sizeof(TBool)+3*sizeof(TSize)+sizeof(TVal*)+MxVals*sizeof(TVal);}
Definition: bd.h:440
::TSize MxVals
Definition: ds.h:1832
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 1869 of file ds.h.

1869  {
1870  if (GetVLen(VId)==0){ValV.Clr();}
1871  else { ValV.GenExt(GetValVPt(VId), GetVLen(VId)); } }
uint GetVLen(const int &VId) const
Definition: ds.h:1863
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1866
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVals ( ) const
inline

Definition at line 1851 of file ds.h.

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

Definition at line 1866 of file ds.h.

1866  {
1867  if (GetVLen(VId)==0){return (TVal*)&EmptyVal;}
1868  else {return ValBf+IdToOffV[VId-1];}}
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
uint GetVLen(const int &VId) const
Definition: ds.h:1863
TVal * ValBf
Definition: ds.h:1834
template<class TVal >
::TSize TGLib_OLD::TVecPool< TVal >::GetVecs ( ) const
inline

Definition at line 1852 of file ds.h.

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

Definition at line 1863 of file ds.h.

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

Definition at line 1853 of file ds.h.

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

Definition at line 1845 of file ds.h.

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

Definition at line 1846 of file ds.h.

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

1843  {
1844  return new TVecPool(ExpectVals, GrowBy, FastCopy); }
::TSize GrowBy
Definition: ds.h:1832
TVecPool(const ::TSize &ExpectVals=0, const ::TSize &_GrowBy=1000000, const bool &_FastCopy=false, const TVal &_EmptyVal=TVal())
Definition: ds.h:1924
TBool FastCopy
Definition: ds.h:1831
template<class TVal >
TVecPool< TVal > & TVecPool< TVal >::operator= ( const TVecPool< TVal > &  Pool)

Definition at line 1975 of file ds.h.

1975  {
1976  if (this!=&Pool) {
1977  FastCopy = Pool.FastCopy;
1978  GrowBy = Pool.GrowBy;
1979  MxVals = Pool.MxVals;
1980  Vals = Pool.Vals;
1981  EmptyVal = Pool.EmptyVal;
1982  IdToOffV=Pool.IdToOffV;
1983  try { ValBf = new TVal [MxVals]; }
1984  catch (std::exception Ex) { FailR(TStr::Fmt("TVec::operator= : %s, MxVals: %d", Ex.what(), MxVals).CStr()); }
1985  IAssert(ValBf != NULL);
1986  if (FastCopy) {
1987  memcpy(ValBf, Pool.ValBf, Vals*sizeof(TVal)); }
1988  else {
1989  for (uint64 ValN = 0; ValN < Vals; ValN++){ ValBf[ValN] = Pool.ValBf[ValN]; } }
1990  }
1991  return *this;
1992 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1832
TVal * ValBf
Definition: ds.h:1568
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
TSize GrowBy
Definition: ds.h:1566
TVal EmptyVal
Definition: ds.h:1567
::TSize MxVals
Definition: ds.h:1832
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:1565
TVal * ValBf
Definition: ds.h:1834
TVec< uint64, int > IdToOffV
Definition: ds.h:1569
TBool FastCopy
Definition: ds.h:1831
TSize Vals
Definition: ds.h:1566
TSize MxVals
Definition: ds.h:1566
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::PutAll ( const TVal &  Val)
inline

Definition at line 1890 of file ds.h.

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

Definition at line 1872 of file ds.h.

1872  {
1873  IAssert(IsVId(VId) && GetVLen(VId) == ValV.Len());
1874  if (FastCopy) {
1875  memcpy(GetValVPt(VId), ValV.BegI(), sizeof(TVal)*ValV.Len()); }
1876  else { TVal* ValPt = GetValVPt(VId);
1877  for (uint ValN=0; ValN < uint(ValV.Len()); ValN++, ValPt++) { *ValPt=ValV[ValN]; }
1878  }
1879  }
#define IAssert(Cond)
Definition: bd.h:262
unsigned int uint
Definition: bd.h:11
bool IsVId(const int &VId) const
Definition: ds.h:1853
uint GetVLen(const int &VId) const
Definition: ds.h:1863
TBool FastCopy
Definition: ds.h:1831
TVal * GetValVPt(const int &VId) const
Definition: ds.h:1866
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::Reserve ( const ::TSize MxVals)
inline

Definition at line 1855 of file ds.h.

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

Definition at line 1854 of file ds.h.

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

Definition at line 1897 of file ds.h.

1897  {
1898  if (_MxVals <= MxVals){ return; } else { MxVals = _MxVals; }
1899  if (ValBf == NULL) {
1900  try { ValBf = new TVal [MxVals]; }
1901  catch (std::exception Ex) {
1902  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()); }
1903  IAssert(ValBf != NULL);
1904  if (EmptyVal != TVal()) { PutAll(EmptyVal); }
1905  } else {
1906  // printf("*** Resize vector pool: %llu -> %llu\n", uint64(Vals), uint64(MxVals));
1907  TVal* NewValBf = NULL;
1908  try { NewValBf = new TVal [MxVals]; }
1909  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()); }
1910  IAssert(NewValBf != NULL);
1911  if (FastCopy) {
1912  memcpy(NewValBf, ValBf, Vals*sizeof(TVal)); }
1913  else {
1914  for (TSize ValN = 0; ValN < Vals; ValN++){ NewValBf[ValN] = ValBf[ValN]; } }
1915  if (EmptyVal != TVal()) { // init empty values
1916  for (TSize ValN = Vals; ValN < MxVals; ValN++) { NewValBf[ValN] = EmptyVal; }
1917  }
1918  delete [] ValBf;
1919  ValBf = NewValBf;
1920  }
1921 }
#define IAssert(Cond)
Definition: bd.h:262
::TSize Vals
Definition: ds.h:1832
void PutAll(const TVal &Val)
Definition: ds.h:1890
::TSize MxVals
Definition: ds.h:1832
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:1834
TBool FastCopy
Definition: ds.h:1831
template<class TVal >
void TVecPool< TVal >::Save ( TSOut SOut) const

Definition at line 1962 of file ds.h.

1962  {
1963  SOut.Save(FastCopy);
1964  uint64 _GrowBy=GrowBy, _MxVals=MxVals, _Vals=Vals;
1965  SOut.Save(_GrowBy); SOut.Save(_MxVals); SOut.Save(_Vals);
1966  SOut.Save(EmptyVal);
1967  for (TSize ValN = 0; ValN < Vals; ValN++) { ValBf[ValN].Save(SOut); }
1968  { SOut.Save(IdToOffV.Len()); SOut.Save(IdToOffV.Len());
1969  for (int ValN = 0; ValN < IdToOffV.Len(); ValN++) {
1970  const uint64 Offset=IdToOffV[ValN]; SOut.Save(Offset);
1971  } }
1972 }
::TSize Vals
Definition: ds.h:1832
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< ::TSize > IdToOffV
Definition: ds.h:1835
::TSize GrowBy
Definition: ds.h:1832
::TSize MxVals
Definition: ds.h:1832
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:1834
TBool FastCopy
Definition: ds.h:1831
template<class TVal >
void TGLib_OLD::TVecPool< TVal >::SetEmptyVal ( const TVal &  _EmptyVal)
inline

Definition at line 1857 of file ds.h.

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

Definition at line 2045 of file ds.h.

2045  {
2046  for (::TSize n = Vals-1; n > 0; n--) {
2047  const ::TSize k = ::TSize(((uint64(Rnd.GetUniDevInt())<<32) | uint64(Rnd.GetUniDevInt())) % (n+1));
2048  const TVal Tmp = ValBf[n];
2049  ValBf[n] = ValBf[k];
2050  ValBf[k] = Tmp;
2051  }
2052 }
::TSize Vals
Definition: ds.h:1832
unsigned long long uint64
Definition: bd.h:38
size_t TSize
Definition: bd.h:58
TVal * ValBf
Definition: ds.h:1834
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 1893 of file ds.h.

Member Data Documentation

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

Definition at line 1830 of file ds.h.

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

Definition at line 1833 of file ds.h.

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

Definition at line 1831 of file ds.h.

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

Definition at line 1832 of file ds.h.

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

Definition at line 1835 of file ds.h.

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

Definition at line 1832 of file ds.h.

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

Definition at line 1834 of file ds.h.

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

Definition at line 1832 of file ds.h.


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