SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
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
TQQueue< TVal > Class Template Reference

#include <ds.h>

Collaboration diagram for TQQueue< TVal >:

Public Member Functions

 TQQueue (const int &_MxLast=64, const int &_MxLen=-1)
 
 TQQueue (const TQQueue &Queue)
 
 TQQueue (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
TQQueueoperator= (const TQQueue &Queue)
 
const TVal & operator[] (const int &ValN) const
 
void Clr (const bool &DoDel=true)
 
void Gen (const int &_MxLast=64, const int &_MxLen=-1)
 
void GetSubValV (const int &_BValN, const int &_EValN, TVec< TVal > &SubValV) const
 
bool Empty () const
 
int Len () const
 
const TVal & Top () const
 
void Pop ()
 
void Push (const TVal &Val)
 
void Shuffle (TRnd &Rnd)
 

Private Attributes

TInt MxLast
 
TInt MxLen
 
TInt First
 
TInt Last
 
TVec< TVal > ValV
 

Detailed Description

template<class TVal>
class TQQueue< TVal >

Definition at line 3487 of file ds.h.

Constructor & Destructor Documentation

template<class TVal>
TQQueue< TVal >::TQQueue ( const int &  _MxLast = 64,
const int &  _MxLen = -1 
)
inline

Definition at line 3493 of file ds.h.

3493  :
3494  MxLast(_MxLast), MxLen(_MxLen), First(0), Last(0), ValV(){
3495  Assert(int(MxLast)>0); Assert((MxLen==-1)||(int(MxLen)>0));}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
TInt MxLen
Definition: ds.h:3489
#define Assert(Cond)
Definition: bd.h:251
TInt MxLast
Definition: ds.h:3489
template<class TVal>
TQQueue< TVal >::TQQueue ( const TQQueue< TVal > &  Queue)
inline

Definition at line 3496 of file ds.h.

3496  :
3497  MxLast(Queue.MxLast), MxLen(Queue.MxLen),
3498  First(Queue.First), Last(Queue.Last), ValV(Queue.ValV){}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
TInt MxLen
Definition: ds.h:3489
TInt MxLast
Definition: ds.h:3489
template<class TVal>
TQQueue< TVal >::TQQueue ( TSIn SIn)
inlineexplicit

Definition at line 3499 of file ds.h.

3499  :
3500  MxLast(SIn), MxLen(SIn), First(SIn), Last(SIn), ValV(SIn){}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
TInt MxLen
Definition: ds.h:3489
TInt MxLast
Definition: ds.h:3489

Member Function Documentation

template<class TVal>
void TQQueue< TVal >::Clr ( const bool &  DoDel = true)
inline

Definition at line 3512 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), and TQQueue< TInt >::Shuffle().

3512 {ValV.Clr(DoDel); First=Last=0;}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953

Here is the caller graph for this function:

template<class TVal>
bool TQQueue< TVal >::Empty ( ) const
inline

Definition at line 3523 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), TSnap::GlobalRelabel(), TSnap::IntFlowBiDBFS(), TSnap::TPRManager::PopActive(), and TQQueue< TInt >::Shuffle().

3523 {return First==Last;}
TInt Last
Definition: ds.h:3490
TInt First
Definition: ds.h:3490

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Gen ( const int &  _MxLast = 64,
const int &  _MxLen = -1 
)
inline

Definition at line 3513 of file ds.h.

3513  {
3514  MxLast=_MxLast; MxLen=_MxLen; First=0; Last=0; ValV.Clr();}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953
TInt MxLen
Definition: ds.h:3489
TInt MxLast
Definition: ds.h:3489
template<class TVal>
void TQQueue< TVal >::GetSubValV ( const int &  _BValN,
const int &  _EValN,
TVec< TVal > &  SubValV 
) const
inline

Definition at line 3515 of file ds.h.

3515  {
3516  int BValN=TInt::GetMx(0, _BValN);
3517  int EValN=TInt::GetMn(Len()-1, _EValN);
3518  SubValV.Gen(EValN-BValN+1);
3519  for (int ValN=BValN; ValN<=EValN; ValN++){
3520  SubValV[ValN-BValN]=ValV[Last+ValN];}
3521  }
TInt Last
Definition: ds.h:3490
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1089
TVec< TVal > ValV
Definition: ds.h:3491
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1087
int Len() const
Definition: ds.h:3524
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:486
template<class TVal>
int TQQueue< TVal >::Len ( ) const
inline

Definition at line 3524 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TQQueue< TInt >::GetSubValV(), TQQueue< TInt >::operator[](), TQQueue< TInt >::Push(), and TQQueue< TInt >::Shuffle().

3524 {return First-Last;}
TInt Last
Definition: ds.h:3490
TInt First
Definition: ds.h:3490

Here is the caller graph for this function:

template<class TVal>
TQQueue& TQQueue< TVal >::operator= ( const TQQueue< TVal > &  Queue)
inline

Definition at line 3505 of file ds.h.

3505  {
3506  if (this!=&Queue){MxLast=Queue.MxLast; MxLen=Queue.MxLen;
3507  First=Queue.First; Last=Queue.Last; ValV=Queue.ValV;}
3508  return *this;}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
TInt MxLen
Definition: ds.h:3489
TInt MxLast
Definition: ds.h:3489
template<class TVal>
const TVal& TQQueue< TVal >::operator[] ( const int &  ValN) const
inline

Definition at line 3509 of file ds.h.

3509  {Assert((0<=ValN)&&(ValN<Len()));
3510  return ValV[Last+ValN];}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
#define Assert(Cond)
Definition: bd.h:251
int Len() const
Definition: ds.h:3524
template<class TVal>
void TQQueue< TVal >::Pop ( )
inline

Definition at line 3527 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), TSnap::GlobalRelabel(), TSnap::IntFlowBiDBFS(), TSnap::TPRManager::PopActive(), TQQueue< TInt >::Push(), and TQQueue< TInt >::Shuffle().

3527  {
3528  IAssert(First!=Last); Last++;
3529  if (First==Last){ValV.Clr(); First=Last=0;}}
#define IAssert(Cond)
Definition: bd.h:262
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Push ( const TVal &  Val)
inline

Definition at line 3530 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), TSnap::GlobalRelabel(), TSnap::IntFlowBiDBFS(), TSnap::TPRManager::PushActive(), and TQQueue< TInt >::Shuffle().

3530  {
3531  if (Last>MxLast){ValV.Del(0, Last-1); First-=Last; Last=0;}
3532  if ((MxLen!=-1)&&(MxLen==Len())){Pop();}
3533  First++; ValV.Add(Val);}
TInt Last
Definition: ds.h:3490
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
Definition: ds.h:1094
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
void Pop()
Definition: ds.h:3527
TInt MxLen
Definition: ds.h:3489
int Len() const
Definition: ds.h:3524
TInt MxLast
Definition: ds.h:3489
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559

Here is the caller graph for this function:

template<class TVal>
void TQQueue< TVal >::Save ( TSOut SOut) const
inline

Definition at line 3501 of file ds.h.

3501  {
3502  MxLast.Save(SOut); MxLen.Save(SOut);
3503  First.Save(SOut); Last.Save(SOut); ValV.Save(SOut);}
TInt Last
Definition: ds.h:3490
void Save(TSOut &SOut) const
Definition: dt.h:1057
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
void Save(TSOut &SOut) const
Definition: ds.h:885
TInt MxLen
Definition: ds.h:3489
TInt MxLast
Definition: ds.h:3489
template<class TVal>
void TQQueue< TVal >::Shuffle ( TRnd Rnd)
inline

Definition at line 3535 of file ds.h.

3535  {
3536  TVec<TVal> ValV(Len(), 0); while (!Empty()){ValV.Add(Top()); Pop();}
3537  ValV.Shuffle(Rnd); Clr();
3538  for (int ValN=0; ValN<ValV.Len(); ValN++){Push(ValV[ValN]);}}
bool Empty() const
Definition: ds.h:3523
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< TVal > ValV
Definition: ds.h:3491
void Pop()
Definition: ds.h:3527
int Len() const
Definition: ds.h:3524
const TVal & Top() const
Definition: ds.h:3525
void Shuffle(TRnd &Rnd)
Randomly shuffles the elements of the vector.
Definition: ds.h:1235
void Push(const TVal &Val)
Definition: ds.h:3530
void Clr(const bool &DoDel=true)
Definition: ds.h:3512
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
template<class TVal>
const TVal& TQQueue< TVal >::Top ( ) const
inline

Definition at line 3525 of file ds.h.

Referenced by TLocClust::ApproxPageRank(), TSnap::GetBetweennessCentr(), TSnap::GlobalRelabel(), TSnap::IntFlowBiDBFS(), TSnap::TPRManager::PopActive(), and TQQueue< TInt >::Shuffle().

3525  {
3526  Assert(First!=Last); return ValV[Last];}
TInt Last
Definition: ds.h:3490
TVec< TVal > ValV
Definition: ds.h:3491
TInt First
Definition: ds.h:3490
#define Assert(Cond)
Definition: bd.h:251

Here is the caller graph for this function:

Member Data Documentation

template<class TVal>
TInt TQQueue< TVal >::MxLast
private
template<class TVal>
TInt TQQueue< TVal >::MxLen
private

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