SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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>

Inherited by TCallbackNotify, TFPathNotify, TLogNotify, TNativeCallbackNotify, TNullNotify, TStdErrNotify, and TStdNotify.

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.

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
TStr TNotify::GetTypeStr ( const TNotifyType Type,
const bool &  Brief = true 
)
static

Definition at line 39 of file ut.cpp.

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
virtual void TNotify::OnLn ( const TStr )
inlinevirtual

Definition at line 40 of file ut.h.

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

Definition at line 56 of file ut.h.

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

Definition at line 21 of file ut.cpp.

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
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.

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

Definition at line 51 of file ut.h.

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
void TNotify::OnNotifyFmt ( const TNotifyType Type,
const char *  FmtStr,
  ... 
)

Definition at line 3 of file ut.cpp.

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
virtual void TNotify::OnStatus ( const TStr )
inlinevirtual

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

Definition at line 39 of file ut.h.

39 {}
static void TNotify::OnStatus ( const PNotify Notify,
const TStr MsgStr 
)
inlinestatic

Definition at line 54 of file ut.h.

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

Definition at line 12 of file ut.cpp.

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
virtual void TNotify::OnTxt ( const TStr )
inlinevirtual

Definition at line 41 of file ut.h.

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

Definition at line 58 of file ut.h.

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

Definition at line 30 of file ut.cpp.

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
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: