SNAP Library 4.0, Developer 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
TNotify Class Reference

#include <ut.h>

Inheritance diagram for TNotify:
Collaboration diagram for TNotify:

Public Member Functions

 TNotify ()
 
virtual ~TNotify ()
 
virtual void OnNotify (const TNotifyType &, const TStr &)
 
virtual void OnStatus (const TStr &)
 
virtual void OnLn (const TStr &)
 
virtual void OnTxt (const TStr &)
 
void OnNotifyFmt (const TNotifyType &Type, const char *FmtStr,...)
 
void OnStatusFmt (const char *FmtStr,...)
 
void OnLnFmt (const char *FmtStr,...)
 
void OnTxtFmt (const char *FmtStr,...)
 

Static Public Member Functions

static TStr GetTypeStr (const TNotifyType &Type, const bool &Brief=true)
 
static void OnNotify (const PNotify &Notify, const TNotifyType &Type, const TStr &MsgStr)
 
static void OnStatus (const PNotify &Notify, const TStr &MsgStr)
 
static void OnLn (const PNotify &Notify, const TStr &MsgStr)
 
static void OnTxt (const PNotify &Notify, const TStr &MsgStr)
 
static void DfOnNotify (const TNotifyType &Type, const TStr &MsgStr)
 

Static Public Attributes

static const PNotify NullNotify =TNullNotify::New()
 
static const PNotify StdNotify =TStdNotify::New()
 
static const PNotify StdErrNotify =TStdErrNotify::New()
 

Private Member Functions

 TNotify (const TNotify &)
 
TNotifyoperator= (const TNotify &)
 

Private Attributes

TCRef CRef
 

Friends

class TPt< TNotify >
 

Detailed Description

Definition at line 30 of file ut.h.

Constructor & Destructor Documentation

TNotify::TNotify ( const TNotify )
private
TNotify::TNotify ( )
inline

Definition at line 35 of file ut.h.

35 {}
virtual TNotify::~TNotify ( )
inlinevirtual

Definition at line 36 of file ut.h.

36 {}

Member Function Documentation

void TNotify::DfOnNotify ( const TNotifyType Type,
const TStr MsgStr 
)
static

Definition at line 54 of file ut.cpp.

References ErrNotify(), Fail, InfoNotify(), ntErr, ntInfo, ntStat, ntWarn, StatNotify(), and WarnNotify().

54  {
55  switch (Type){
56  case ntInfo: InfoNotify(MsgStr); break;
57  case ntWarn: WarnNotify(MsgStr); break;
58  case ntErr: ErrNotify(MsgStr); break;
59  case ntStat: StatNotify(MsgStr); break;
60  default: Fail;
61  }
62 }
#define Fail
Definition: bd.h:238
Definition: ut.h:28
void ErrNotify(const char *NotifyCStr)
Definition: bd.h:74
void WarnNotify(const char *NotifyCStr)
Definition: bd.h:72
Definition: ut.h:28
Definition: ut.h:28
void InfoNotify(const char *NotifyCStr)
Definition: bd.h:70
Definition: ut.h:28
void StatNotify(const char *NotifyCStr)
Definition: bd.h:76

Here is the call graph for this function:

TStr TNotify::GetTypeStr ( const TNotifyType Type,
const bool &  Brief = true 
)
static

Definition at line 39 of file ut.cpp.

References Fail, ntErr, ntInfo, ntStat, and ntWarn.

Referenced by TStdNotify::OnNotify(), and TStdErrNotify::OnNotify().

40  {
41  static TStr InfoSStr="I"; static TStr InfoLStr="Information";
42  static TStr WarnSStr="W"; static TStr WarnLStr="Warning";
43  static TStr ErrSStr="E"; static TStr ErrLStr="Error";
44  static TStr StatSStr=""; static TStr StatLStr="Status";
45  switch (Type){
46  case ntInfo: if (Brief){return InfoSStr;} else {return InfoLStr;}
47  case ntWarn: if (Brief){return WarnSStr;} else {return WarnLStr;}
48  case ntErr: if (Brief){return ErrSStr;} else {return ErrLStr;}
49  case ntStat: if (Brief){return StatSStr;} else {return StatLStr;}
50  default: Fail; return TStr();
51  }
52 }
#define Fail
Definition: bd.h:238
Definition: ut.h:28
Definition: ut.h:28
Definition: ut.h:28
Definition: dt.h:412
Definition: ut.h:28

Here is the caller graph for this function:

virtual void TNotify::OnLn ( const TStr )
inlinevirtual

Definition at line 40 of file ut.h.

Referenced by OnLn(), and OnLnFmt().

40 {}

Here is the caller graph for this function:

static void TNotify::OnLn ( const PNotify Notify,
const TStr MsgStr 
)
inlinestatic

Definition at line 56 of file ut.h.

References TPt< TRec >::Empty(), and OnLn().

56  {
57  if (!Notify.Empty()){Notify->OnLn(MsgStr);}}
bool Empty() const
Definition: bd.h:501
virtual void OnLn(const TStr &)
Definition: ut.h:40

Here is the call graph for this function:

void TNotify::OnLnFmt ( const char *  FmtStr,
  ... 
)

Definition at line 21 of file ut.cpp.

References OnLn().

21  {
22  char Bf[10*1024];
23  va_list valist;
24  va_start(valist, FmtStr);
25  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
26  va_end(valist);
27  if (RetVal!=-1) { OnLn(TStr(Bf)); }
28 }
virtual void OnLn(const TStr &)
Definition: ut.h:40
Definition: dt.h:412

Here is the call graph for this function:

virtual void TNotify::OnNotify ( const TNotifyType ,
const TStr  
)
inlinevirtual

Reimplemented in TStdErrNotify, TStdNotify, TNativeCallbackNotify, TCallbackNotify, and TNullNotify.

Definition at line 38 of file ut.h.

Referenced by TSs::LoadTxt(), OnNotify(), and OnNotifyFmt().

38 {}

Here is the caller graph for this function:

static void TNotify::OnNotify ( const PNotify Notify,
const TNotifyType Type,
const TStr MsgStr 
)
inlinestatic

Definition at line 51 of file ut.h.

References TPt< TRec >::Empty(), and OnNotify().

52  {
53  if (!Notify.Empty()){Notify->OnNotify(Type, MsgStr);}}
bool Empty() const
Definition: bd.h:501
virtual void OnNotify(const TNotifyType &, const TStr &)
Definition: ut.h:38

Here is the call graph for this function:

void TNotify::OnNotifyFmt ( const TNotifyType Type,
const char *  FmtStr,
  ... 
)

Definition at line 3 of file ut.cpp.

References OnNotify().

3  {
4  char Bf[10*1024];
5  va_list valist;
6  va_start(valist, FmtStr);
7  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
8  va_end(valist);
9  if (RetVal!=-1) { OnNotify(Type, TStr(Bf)); }
10 }
virtual void OnNotify(const TNotifyType &, const TStr &)
Definition: ut.h:38
Definition: dt.h:412

Here is the call graph for this function:

virtual void TNotify::OnStatus ( const TStr )
inlinevirtual
static void TNotify::OnStatus ( const PNotify Notify,
const TStr MsgStr 
)
inlinestatic

Definition at line 54 of file ut.h.

References TPt< TRec >::Empty(), and OnStatus().

54  {
55  if (!Notify.Empty()){Notify->OnStatus(MsgStr);}}
bool Empty() const
Definition: bd.h:501
virtual void OnStatus(const TStr &)
Definition: ut.h:39

Here is the call graph for this function:

void TNotify::OnStatusFmt ( const char *  FmtStr,
  ... 
)

Definition at line 12 of file ut.cpp.

References OnStatus().

12  {
13  char Bf[10*1024];
14  va_list valist;
15  va_start(valist, FmtStr);
16  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
17  va_end(valist);
18  if (RetVal!=-1) { OnStatus(TStr(Bf)); }
19 }
Definition: dt.h:412
virtual void OnStatus(const TStr &)
Definition: ut.h:39

Here is the call graph for this function:

virtual void TNotify::OnTxt ( const TStr )
inlinevirtual

Definition at line 41 of file ut.h.

Referenced by OnTxt(), and OnTxtFmt().

41 {}

Here is the caller graph for this function:

static void TNotify::OnTxt ( const PNotify Notify,
const TStr MsgStr 
)
inlinestatic

Definition at line 58 of file ut.h.

References TPt< TRec >::Empty(), and OnTxt().

58  {
59  if (!Notify.Empty()){Notify->OnTxt(MsgStr);}}
bool Empty() const
Definition: bd.h:501
virtual void OnTxt(const TStr &)
Definition: ut.h:41

Here is the call graph for this function:

void TNotify::OnTxtFmt ( const char *  FmtStr,
  ... 
)

Definition at line 30 of file ut.cpp.

References OnTxt().

30  {
31  char Bf[10*1024];
32  va_list valist;
33  va_start(valist, FmtStr);
34  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
35  va_end(valist);
36  if (RetVal!=-1) { OnTxt(TStr(Bf)); }
37 }
virtual void OnTxt(const TStr &)
Definition: ut.h:41
Definition: dt.h:412

Here is the call graph for this function:

TNotify& TNotify::operator= ( const TNotify )
private

Friends And Related Function Documentation

friend class TPt< TNotify >
friend

Definition at line 30 of file ut.h.

Member Data Documentation

TCRef TNotify::CRef
private

Definition at line 30 of file ut.h.

const PNotify TNotify::NullNotify =TNullNotify::New()
static

Definition at line 62 of file ut.h.

const PNotify TNotify::StdErrNotify =TStdErrNotify::New()
static

Definition at line 64 of file ut.h.

const PNotify TNotify::StdNotify =TStdNotify::New()
static

Definition at line 63 of file ut.h.


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