SNAP Library 4.0, User Reference  2017-07-27 13:18:06
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
TGStat::TCmpByVal Class Reference

#include <gstat.h>

Public Member Functions

 TCmpByVal (TGStatVal SortBy, bool Asc)
bool operator() (const TGStat &GS1, const TGStat &GS2) const
bool operator() (const PGStat &GS1, const PGStat &GS2) const

Private Attributes

TGStatVal ValCmp
bool SortAsc

Detailed Description

Definition at line 42 of file gstat.h.

Constructor & Destructor Documentation

TGStat::TCmpByVal::TCmpByVal ( TGStatVal  SortBy,
bool  Asc 

Definition at line 47 of file gstat.h.

47 : ValCmp(SortBy), SortAsc(Asc) { }
bool SortAsc
Definition: gstat.h:45
TGStatVal ValCmp
Definition: gstat.h:44

Member Function Documentation

bool TGStat::TCmpByVal::operator() ( const TGStat GS1,
const TGStat GS2 
) const

Definition at line 7 of file gstat.cpp.

7  {
8  IAssertR(GS1.HasVal(ValCmp) && GS2.HasVal(ValCmp), TStr::Fmt("CmpVal: %d (%s)",
9  int(ValCmp), TGStat::GetValStr(ValCmp).CStr()).CStr());
10  bool Res;
11  if (ValCmp == gsvTime) { Res = GS1.Time < GS2.Time; }
12  else { Res = GS1.GetVal(ValCmp) < GS2.GetVal(ValCmp); }
13  if (SortAsc) { return Res; }
14  else { return ! Res; }
15 }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static TStr GetValStr(const TGStatVal &Val)
Definition: gstat.cpp:307
TSecTm Time
Definition: gstat.h:55
Definition: gstat.h:16
bool HasVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:75
bool SortAsc
Definition: gstat.h:45
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
char * CStr()
Definition: dt.h:476
TGStatVal ValCmp
Definition: gstat.h:44
bool TGStat::TCmpByVal::operator() ( const PGStat GS1,
const PGStat GS2 
) const

Definition at line 17 of file gstat.cpp.

17  {
18  return operator()(*GS1, *GS2);
19 }
bool operator()(const TGStat &GS1, const TGStat &GS2) const
Definition: gstat.cpp:7

Member Data Documentation

bool TGStat::TCmpByVal::SortAsc

Definition at line 45 of file gstat.h.

TGStatVal TGStat::TCmpByVal::ValCmp

Definition at line 44 of file gstat.h.

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