SNAP Library 2.4, Developer 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
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 2496 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 2502 of file ds.h.

2502  :
2503  MxLast(_MxLast), MxLen(_MxLen), First(0), Last(0), ValV(){
2504  Assert(int(MxLast)>0); Assert((MxLen==-1)||(int(MxLen)>0));}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
TInt MxLen
Definition: ds.h:2498
#define Assert(Cond)
Definition: bd.h:251
TInt MxLast
Definition: ds.h:2498
template<class TVal>
TQQueue< TVal >::TQQueue ( const TQQueue< TVal > &  Queue)
inline

Definition at line 2505 of file ds.h.

2505  :
2506  MxLast(Queue.MxLast), MxLen(Queue.MxLen),
2507  First(Queue.First), Last(Queue.Last), ValV(Queue.ValV){}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
TInt MxLen
Definition: ds.h:2498
TInt MxLast
Definition: ds.h:2498
template<class TVal>
TQQueue< TVal >::TQQueue ( TSIn SIn)
inlineexplicit

Definition at line 2508 of file ds.h.

2508  :
2509  MxLast(SIn), MxLen(SIn), First(SIn), Last(SIn), ValV(SIn){}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
TInt MxLen
Definition: ds.h:2498
TInt MxLast
Definition: ds.h:2498

Member Function Documentation

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

Definition at line 2521 of file ds.h.

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

2521 {ValV.Clr(DoDel); First=Last=0;}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
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 2532 of file ds.h.

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

2532 {return First==Last;}
TInt Last
Definition: ds.h:2499
TInt First
Definition: ds.h:2499

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 2522 of file ds.h.

2522  {
2523  MxLast=_MxLast; MxLen=_MxLen; First=0; Last=0; ValV.Clr();}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
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:2498
TInt MxLast
Definition: ds.h:2498
template<class TVal>
void TQQueue< TVal >::GetSubValV ( const int &  _BValN,
const int &  _EValN,
TVec< TVal > &  SubValV 
) const
inline

Definition at line 2524 of file ds.h.

2524  {
2525  int BValN=TInt::GetMx(0, _BValN);
2526  int EValN=TInt::GetMn(Len()-1, _EValN);
2527  SubValV.Gen(EValN-BValN+1);
2528  for (int ValN=BValN; ValN<=EValN; ValN++){
2529  SubValV[ValN-BValN]=ValV[Last+ValN];}
2530  }
TInt Last
Definition: ds.h:2499
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1090
TVec< TVal > ValV
Definition: ds.h:2500
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1088
int Len() const
Definition: ds.h:2533
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 2533 of file ds.h.

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

2533 {return First-Last;}
TInt Last
Definition: ds.h:2499
TInt First
Definition: ds.h:2499

Here is the caller graph for this function:

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

Definition at line 2514 of file ds.h.

2514  {
2515  if (this!=&Queue){MxLast=Queue.MxLast; MxLen=Queue.MxLen;
2516  First=Queue.First; Last=Queue.Last; ValV=Queue.ValV;}
2517  return *this;}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
TInt MxLen
Definition: ds.h:2498
TInt MxLast
Definition: ds.h:2498
template<class TVal>
const TVal& TQQueue< TVal >::operator[] ( const int &  ValN) const
inline

Definition at line 2518 of file ds.h.

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

Definition at line 2536 of file ds.h.

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

2536  {
2537  IAssert(First!=Last); Last++;
2538  if (First==Last){ValV.Clr(); First=Last=0;}}
#define IAssert(Cond)
Definition: bd.h:262
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
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 2539 of file ds.h.

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

2539  {
2540  if (Last>MxLast){ValV.Del(0, Last-1); First-=Last; Last=0;}
2541  if ((MxLen!=-1)&&(MxLen==Len())){Pop();}
2542  First++; ValV.Add(Val);}
TInt Last
Definition: ds.h:2499
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
Definition: ds.h:1094
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
void Pop()
Definition: ds.h:2536
TInt MxLen
Definition: ds.h:2498
int Len() const
Definition: ds.h:2533
TInt MxLast
Definition: ds.h:2498
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 2510 of file ds.h.

2510  {
2511  MxLast.Save(SOut); MxLen.Save(SOut);
2512  First.Save(SOut); Last.Save(SOut); ValV.Save(SOut);}
TInt Last
Definition: ds.h:2499
void Save(TSOut &SOut) const
Definition: dt.h:1058
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
void Save(TSOut &SOut) const
Definition: ds.h:885
TInt MxLen
Definition: ds.h:2498
TInt MxLast
Definition: ds.h:2498
template<class TVal>
void TQQueue< TVal >::Shuffle ( TRnd Rnd)
inline

Definition at line 2544 of file ds.h.

2544  {
2545  TVec<TVal> ValV(Len(), 0); while (!Empty()){ValV.Add(Top()); Pop();}
2546  ValV.Shuffle(Rnd); Clr();
2547  for (int ValN=0; ValN<ValV.Len(); ValN++){Push(ValV[ValN]);}}
bool Empty() const
Definition: ds.h:2532
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TVec< TVal > ValV
Definition: ds.h:2500
void Pop()
Definition: ds.h:2536
int Len() const
Definition: ds.h:2533
const TVal & Top() const
Definition: ds.h:2534
void Shuffle(TRnd &Rnd)
Randomly shuffles the elements of the vector.
Definition: ds.h:1235
void Push(const TVal &Val)
Definition: ds.h:2539
void Clr(const bool &DoDel=true)
Definition: ds.h:2521
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 2534 of file ds.h.

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

2534  {
2535  Assert(First!=Last); return ValV[Last];}
TInt Last
Definition: ds.h:2499
TVec< TVal > ValV
Definition: ds.h:2500
TInt First
Definition: ds.h:2499
#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: