SNAP Library 2.2, Developer Reference  2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TPackVec< TVal > Class Template Reference

#include <shash.h>

List of all members.

Public Types

typedef TVal * TIter

Public Member Functions

 TPackVec ()
 TPackVec (const TPackVec &Vec)
 TPackVec (const int &_Vals)
 ~TPackVec ()
 TPackVec (TSIn &SIn)
void Load (TSIn &SIn)
void Save (TSOut &SOut) const
const TVal & operator[] (const int &ValN) const
TVal & operator[] (const int &ValN)
TPackVec< TVal > & operator= (const TPackVec< TVal > &Vec)
TVec< TVal > & operator= (const TVec< TVal > &Vec)
void Gen (const int &_Vals)
void Clr ()
bool Empty () const
int Len () const
const TVal & Last () const
TVal & Last ()
TIter BegI () const
TIter EndI () const
TIter GetI (const int &ValN) const
void Add (const TVal &Val)
void AddV (const TPackVec< TVal > &ValV)
void AddV (const TVec< TVal > &ValV)
void AddV (TSIn &FIn)
void Sort (const bool &Asc=true)

Private Member Functions

void ResizeDelta (const int &ValsToAdd=1)

Private Attributes

int Vals
TVal * ValT

Detailed Description

template<class TVal>
class TPackVec< TVal >

Definition at line 1386 of file shash.h.


Member Typedef Documentation

template<class TVal>
typedef TVal* TPackVec< TVal >::TIter

Definition at line 1388 of file shash.h.


Constructor & Destructor Documentation

template<class TVal>
TPackVec< TVal >::TPackVec ( ) [inline]

Definition at line 1394 of file shash.h.

: Vals(0), ValT(NULL) { }
template<class TVal>
TPackVec< TVal >::TPackVec ( const TPackVec< TVal > &  Vec) [inline]

Definition at line 1395 of file shash.h.

References TPackVec< TVal >::Gen(), TPackVec< TVal >::Len(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                                : Vals(0), ValT(NULL) {
    Gen(Vec.Len());
    memcpy(ValT, Vec.ValT, sizeof(TVal)*Vals);
  }

Here is the call graph for this function:

template<class TVal>
TPackVec< TVal >::TPackVec ( const int &  _Vals) [inline, explicit]

Definition at line 1399 of file shash.h.

References TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                                      : Vals(_Vals) {
    if (Vals==0) { ValT=NULL; } else { ValT = (TVal *) realloc(ValT, sizeof(TVal)*Vals); } }
template<class TVal>
TPackVec< TVal >::~TPackVec ( ) [inline]

Definition at line 1401 of file shash.h.

References TPackVec< TVal >::ValT.

{ if (ValT != NULL) { free(ValT); } }
template<class TVal>
TPackVec< TVal >::TPackVec ( TSIn SIn) [inline, explicit]

Definition at line 1402 of file shash.h.

References TPackVec< TVal >::Load().

: Vals(0), ValT(NULL) { Load(SIn); }

Here is the call graph for this function:


Member Function Documentation

template<class TVal>
void TPackVec< TVal >::Add ( const TVal &  Val) [inline]

Definition at line 1427 of file shash.h.

References TPackVec< TVal >::ResizeDelta(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

{ ResizeDelta(1); ValT[Vals-1]=Val; }

Here is the call graph for this function:

template<class TVal>
void TPackVec< TVal >::AddV ( const TPackVec< TVal > &  ValV) [inline]

Definition at line 1428 of file shash.h.

References TPackVec< TVal >::BegI(), TPackVec< TVal >::Len(), TPackVec< TVal >::ResizeDelta(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                                        { ResizeDelta(ValV.Len());
    memcpy(ValT+Vals-ValV.Len(), ValV.BegI(), sizeof(TVal)*ValV.Len()); }

Here is the call graph for this function:

template<class TVal>
void TPackVec< TVal >::AddV ( const TVec< TVal > &  ValV) [inline]

Definition at line 1430 of file shash.h.

References TVec< TVal, TSizeTy >::BegI(), TVec< TVal, TSizeTy >::Len(), TPackVec< TVal >::ResizeDelta(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                                    { ResizeDelta(ValV.Len());
    memcpy(ValT+Vals-ValV.Len(), ValV.BegI(), sizeof(TVal)*ValV.Len()); }

Here is the call graph for this function:

template<class TVal>
void TPackVec< TVal >::AddV ( TSIn FIn) [inline]

Definition at line 1432 of file shash.h.

References TSIn::Load(), TSIn::LoadBf(), TPackVec< TVal >::ResizeDelta(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                       { int NVals;  FIn.Load(NVals);
    ResizeDelta(NVals);  FIn.LoadBf(ValT+Vals-NVals, sizeof(TVal)*NVals); }

Here is the call graph for this function:

template<class TVal>
TIter TPackVec< TVal >::BegI ( ) const [inline]

Definition at line 1423 of file shash.h.

References TPackVec< TVal >::ValT.

Referenced by TPackVec< TVal >::AddV(), and TPackVec< TVal >::Sort().

{return ValT; }

Here is the caller graph for this function:

template<class TVal>
void TPackVec< TVal >::Clr ( ) [inline]

Definition at line 1416 of file shash.h.

References TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

{ if (ValT != NULL) { free(ValT); ValT=NULL; } Vals = 0; }
template<class TVal>
bool TPackVec< TVal >::Empty ( ) const [inline]

Definition at line 1418 of file shash.h.

References TPackVec< TVal >::Vals.

{return Vals==0; }
template<class TVal>
TIter TPackVec< TVal >::EndI ( ) const [inline]

Definition at line 1424 of file shash.h.

References TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

Referenced by TPackVec< TVal >::Sort().

{return ValT+Vals; }

Here is the caller graph for this function:

template<class TVal>
void TPackVec< TVal >::Gen ( const int &  _Vals) [inline]

Definition at line 1413 of file shash.h.

References TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

Referenced by TPackVec< TVal >::operator=(), and TPackVec< TVal >::TPackVec().

                             {
    if (ValT != NULL) { free(ValT); } Vals = _Vals;
    if (Vals==0) { ValT=NULL; } else { ValT = (TVal *) realloc(ValT, sizeof(TVal)*Vals); } }

Here is the caller graph for this function:

template<class TVal>
TIter TPackVec< TVal >::GetI ( const int &  ValN) const [inline]

Definition at line 1425 of file shash.h.

References TPackVec< TVal >::ValT.

{ return ValT+ValN; }
template<class TVal>
const TVal& TPackVec< TVal >::Last ( ) const [inline]

Definition at line 1420 of file shash.h.

References TPackVec< TVal >::Len(), and TPackVec< TVal >::ValT.

{ return ValT[Len()-1]; }

Here is the call graph for this function:

template<class TVal>
TVal& TPackVec< TVal >::Last ( ) [inline]

Definition at line 1421 of file shash.h.

References TPackVec< TVal >::Len(), and TPackVec< TVal >::ValT.

{ return ValT[Len()-1]; }

Here is the call graph for this function:

template<class TVal>
int TPackVec< TVal >::Len ( ) const [inline]

Definition at line 1419 of file shash.h.

References TPackVec< TVal >::Vals.

Referenced by TPackVec< TVal >::AddV(), TPackVec< TVal >::Last(), TPackVec< TVal >::operator=(), and TPackVec< TVal >::TPackVec().

{return Vals; }

Here is the caller graph for this function:

template<class TVal >
void TPackVec< TVal >::Load ( TSIn SIn)

Definition at line 1450 of file shash.h.

References TSIn::Load(), and TSIn::LoadBf().

Referenced by TPackVec< TVal >::TPackVec().

                                   {
  SIn.Load(Vals);
  if (Vals==0) {
    if (ValT != NULL) { free(ValT); }
    ValT = NULL; }
  else {
    ValT = (TVal *) realloc(ValT, sizeof(TVal)*Vals);
  }
  SIn.LoadBf(ValT, sizeof(TVal)*Vals);
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal>
TPackVec<TVal>& TPackVec< TVal >::operator= ( const TPackVec< TVal > &  Vec) [inline]

Definition at line 1408 of file shash.h.

References TPackVec< TVal >::Gen(), TPackVec< TVal >::Len(), TPackVec< TVal >::Vals, and TPackVec< TVal >::ValT.

                                                         { Gen(Vec.Len());
    memcpy(ValT, Vec.ValT, sizeof(TVal)*Vals); return *this; }

Here is the call graph for this function:

template<class TVal>
TVec<TVal>& TPackVec< TVal >::operator= ( const TVec< TVal > &  Vec) [inline]

Definition at line 1410 of file shash.h.

References TPackVec< TVal >::Gen(), TVec< TVal, TSizeTy >::Len(), TPackVec< TVal >::Vals, TVec< TVal, TSizeTy >::ValT, and TPackVec< TVal >::ValT.

                                                 { Gen(Vec.Len());
    memcpy(ValT, Vec.ValT, sizeof(TVal)*Vals); return *this; }

Here is the call graph for this function:

template<class TVal>
const TVal& TPackVec< TVal >::operator[] ( const int &  ValN) const [inline]

Definition at line 1406 of file shash.h.

References TPackVec< TVal >::ValT.

{ return ValT[ValN]; }
template<class TVal>
TVal& TPackVec< TVal >::operator[] ( const int &  ValN) [inline]

Definition at line 1407 of file shash.h.

References TPackVec< TVal >::ValT.

{ return ValT[ValN]; }
template<class TVal >
void TPackVec< TVal >::ResizeDelta ( const int &  ValsToAdd = 1) [private]

Definition at line 1442 of file shash.h.

References EAssert.

Referenced by TPackVec< TVal >::Add(), and TPackVec< TVal >::AddV().

                                                     {
  if (ValsToAdd == 0) return;
  Vals += ValsToAdd;
  ValT = (TVal *) realloc(ValT, sizeof(TVal)*Vals);
  EAssert(ValT != NULL);
}

Here is the caller graph for this function:

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

Definition at line 1462 of file shash.h.

References TSOut::Save(), and TSOut::SaveBf().

                                           {
  SOut.Save(Vals);
  if (Vals != 0) {
    SOut.SaveBf(ValT, sizeof(TVal)*Vals); }
}

Here is the call graph for this function:

template<class TVal>
void TPackVec< TVal >::Sort ( const bool &  Asc = true) [inline]

Definition at line 1435 of file shash.h.

References TPackVec< TVal >::BegI(), and TPackVec< TVal >::EndI().

                                  {
    if (Asc) { TVec<TVal>::QSortCmp(BegI(), EndI(), TLss<TVal>()); }
    else { TVec<TVal>::QSortCmp(BegI(), EndI(), TGtr<TVal>()); }
  }

Here is the call graph for this function:


Member Data Documentation


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