SNAP Library, Developer Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ut.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TTypeNm< Type >
class  TNullNotify
class  TCallbackNotify
class  TNativeCallbackNotify
class  TStdNotify
class  TStdErrNotify
class  TLogNotify

Defines

#define Try   try {
#define Catch   } catch (PExcept Except){ErrNotify(Except->GetMsgStr());}
#define CatchFull   } catch (PExcept Except){ErrNotify(Except->GetStr());}
#define CatchAll   } catch (...){}

Typedefs

typedef void(__stdcall * TCallbackF )(const TNotifyType &Type, const TStr &MsgStr)
typedef void(__stdcall * TNativeCallbackF )(int Type, const char *MsgStr)
typedef void(* TOnExceptF )(const TStr &MsgStr)

Enumerations

enum  TNotifyType { ntInfo, ntWarn, ntErr, ntStat }

Functions

template<class Type >
TStr GetTypeNm (const Type &Var)
void InfoNotify (const TStr &MsgStr)
void WarnNotify (const TStr &MsgStr)
void ErrNotify (const TStr &MsgStr)
void StatNotify (const TStr &MsgStr)
ClassTP(TNotify, PNotify)
private TNotify
operator= (const TNotify &)
 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 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)
 UndefDefaultCopyAssign (TExcept)
 TExcept (const TStr &_MsgStr)
 TExcept (const TStr &_MsgStr, const TStr &_LocStr)
virtual ~TExcept ()
TStr GetMsgStr () const
TStr GetLocStr () const
TStr GetStr () const
static bool IsOnExceptF ()
static void PutOnExceptF (TOnExceptF _OnExceptF)
static TOnExceptF GetOnExceptF ()
static void Throw (const TStr &MsgStr)
static void Throw (const TStr &MsgStr, const TStr &ArgStr)
static void Throw (const TStr &MsgStr, const TStr &ArgStr1, const TStr &ArgStr2)
static void ThrowFull (const TStr &MsgStr, const TStr &LocStr)

Variables

static const PNotify NullNotify = TNullNotify::New()
static const PNotify StdNotify = TStdNotify::New()
static const PNotify StdErrNotify = TStdErrNotify::New()
ClassTP(TExcept, PExcept)
private TStr 
LocStr
static TOnExceptF OnExceptF = NULL

Define Documentation

#define Catch   } catch (PExcept Except){ErrNotify(Except->GetMsgStr());}

Definition at line 200 of file ut.h.

#define CatchAll   } catch (...){}

Definition at line 202 of file ut.h.

#define CatchFull   } catch (PExcept Except){ErrNotify(Except->GetStr());}

Definition at line 201 of file ut.h.

#define Try   try {

Definition at line 199 of file ut.h.


Typedef Documentation

typedef void(__stdcall * TCallbackF)(const TNotifyType &Type, const TStr &MsgStr)

Definition at line 78 of file ut.h.

typedef void(__stdcall * TNativeCallbackF)(int Type, const char *MsgStr)

Definition at line 101 of file ut.h.

typedef void(* TOnExceptF)(const TStr &MsgStr)

Definition at line 176 of file ut.h.


Enumeration Type Documentation

Enumerator:
ntInfo 
ntWarn 
ntErr 
ntStat 

Definition at line 26 of file ut.h.


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

                                                                   {
  switch (Type){
    case ntInfo: InfoNotify(MsgStr); break;
    case ntWarn: WarnNotify(MsgStr); break;
    case ntErr: ErrNotify(MsgStr); break;
    case ntStat: StatNotify(MsgStr); break;
    default: Fail;
  }
}

Here is the call graph for this function:

void ErrNotify ( const TStr MsgStr) [inline]

Definition at line 23 of file ut.h.

References TStr::CStr(), and ErrNotify().

{ErrNotify(MsgStr.CStr());}

Here is the call graph for this function:

TStr GetLocStr ( ) const

Definition at line 170 of file ut.h.

References LocStr.

Referenced by GetStr().

{return LocStr;}

Here is the caller graph for this function:

TStr GetMsgStr ( ) const

Definition at line 169 of file ut.h.

References MsgStr.

{return MsgStr;}
static TOnExceptF GetOnExceptF ( ) [static]

Definition at line 180 of file ut.h.

References OnExceptF.

{return OnExceptF;}
TStr GetStr ( ) const

Definition at line 171 of file ut.h.

References TPt< TRec >::Empty(), GetLocStr(), GetMsgStr(), and LocStr.

                      {
    if (LocStr.Empty()){return GetMsgStr();}
    else {return GetLocStr()+": "+GetMsgStr();}}

Here is the call graph for this function:

template<class Type >
TStr GetTypeNm ( const Type &  Var)

Definition at line 14 of file ut.h.

References TTypeNm< Type >::GetNrTypeNm().

Referenced by TVec< TVal >::GetXOutOfBoundsErrMsg(), and TVec< TVal >::Resize().

                               {
  TStr TypeNm=TStr(typeid(Var).name());
  return TTypeNm<Type>::GetNrTypeNm(TypeNm);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static TStr GetTypeStr ( const TNotifyType Type,
const bool &  Brief = true 
) [static]
void InfoNotify ( const TStr MsgStr) [inline]

Definition at line 21 of file ut.h.

References TStr::CStr(), and InfoNotify().

{InfoNotify(MsgStr.CStr());}

Here is the call graph for this function:

static bool IsOnExceptF ( ) [static]

Definition at line 178 of file ut.h.

References OnExceptF.

Referenced by Throw(), and ThrowFull().

{return OnExceptF!=NULL;}

Here is the caller graph for this function:

virtual void OnLn ( const TStr ) [virtual]

Definition at line 38 of file ut.h.

Referenced by OnLnFmt().

{}

Here is the caller graph for this function:

static void OnLn ( const PNotify &  Notify,
const TStr MsgStr 
) [static]

Definition at line 54 of file ut.h.

                                                             {
    if (!Notify.Empty()){Notify->OnLn(MsgStr);}}
void TNotify::OnLnFmt ( const char *  FmtStr,
  ... 
)

Definition at line 21 of file ut.cpp.

References Bf, and OnLn().

                                             {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  if (RetVal!=-1) { OnLn(TStr(Bf)); }
}

Here is the call graph for this function:

virtual void OnNotify ( const TNotifyType ,
const TStr  
) [virtual]

Definition at line 36 of file ut.h.

Referenced by OnNotifyFmt().

{}

Here is the caller graph for this function:

static void OnNotify ( const PNotify &  Notify,
const TNotifyType Type,
const TStr MsgStr 
) [static]

Definition at line 49 of file ut.h.

                                               {
    if (!Notify.Empty()){Notify->OnNotify(Type, MsgStr);}}
void TNotify::OnNotifyFmt ( const TNotifyType Type,
const char *  FmtStr,
  ... 
)

Definition at line 3 of file ut.cpp.

References Bf, and OnNotify().

                                                                          {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  if (RetVal!=-1) { OnNotify(Type, TStr(Bf)); }
}

Here is the call graph for this function:

virtual void OnStatus ( const TStr ) [virtual]

Definition at line 37 of file ut.h.

Referenced by TEnv::GetIfArgPrefixBool(), TEnv::GetIfArgPrefixFlt(), TEnv::GetIfArgPrefixInt(), TEnv::GetIfArgPrefixStr(), TEnv::GetIfArgPrefixStrV(), and OnStatusFmt().

{}

Here is the caller graph for this function:

static void OnStatus ( const PNotify &  Notify,
const TStr MsgStr 
) [static]

Definition at line 52 of file ut.h.

                                                                 {
    if (!Notify.Empty()){Notify->OnStatus(MsgStr);}}
void TNotify::OnStatusFmt ( const char *  FmtStr,
  ... 
)

Definition at line 12 of file ut.cpp.

References Bf, and OnStatus().

                                                 {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  if (RetVal!=-1) { OnStatus(TStr(Bf)); }
}

Here is the call graph for this function:

virtual void OnTxt ( const TStr ) [virtual]

Definition at line 39 of file ut.h.

Referenced by OnTxtFmt().

{}

Here is the caller graph for this function:

static void OnTxt ( const PNotify &  Notify,
const TStr MsgStr 
) [static]

Definition at line 56 of file ut.h.

                                                              {
    if (!Notify.Empty()){Notify->OnTxt(MsgStr);}}
void TNotify::OnTxtFmt ( const char *  FmtStr,
  ... 
)

Definition at line 30 of file ut.cpp.

References Bf, and OnTxt().

                                              {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  if (RetVal!=-1) { OnTxt(TStr(Bf)); }
}

Here is the call graph for this function:

ClassTP (TNotify, PNotify) private TNotify& operator= ( const TNotify )
static void PutOnExceptF ( TOnExceptF  _OnExceptF) [static]

Definition at line 179 of file ut.h.

References OnExceptF.

{OnExceptF=_OnExceptF;}
void StatNotify ( const TStr MsgStr) [inline]

Definition at line 24 of file ut.h.

References TStr::CStr(), and StatNotify().

{StatNotify(MsgStr.CStr());}

Here is the call graph for this function:

TExcept ( const TStr _MsgStr)

Definition at line 165 of file ut.h.

Referenced by TILx::GetSym(), Throw(), and ThrowFull().

: MsgStr(_MsgStr), LocStr(){}

Here is the caller graph for this function:

TExcept ( const TStr _MsgStr,
const TStr _LocStr 
)

Definition at line 166 of file ut.h.

: MsgStr(_MsgStr), LocStr(_LocStr){}
static void Throw ( const TStr MsgStr) [static]
static void Throw ( const TStr MsgStr,
const TStr ArgStr 
) [static]

Definition at line 186 of file ut.h.

References IsOnExceptF(), and TExcept().

                                                           {
    TStr FullMsgStr=MsgStr+" ("+ArgStr+")";
    if (IsOnExceptF()){(*OnExceptF)(FullMsgStr);}
    else {throw PExcept(new TExcept(FullMsgStr));}}

Here is the call graph for this function:

static void Throw ( const TStr MsgStr,
const TStr ArgStr1,
const TStr ArgStr2 
) [static]

Definition at line 190 of file ut.h.

References IsOnExceptF(), and TExcept().

                                                                                 {
    TStr FullMsgStr=MsgStr+" ("+ArgStr1+", "+ArgStr2+")";
    if (IsOnExceptF()){(*OnExceptF)(FullMsgStr);}
    else {throw PExcept(new TExcept(FullMsgStr));}}

Here is the call graph for this function:

static void ThrowFull ( const TStr MsgStr,
const TStr LocStr 
) [static]

Definition at line 194 of file ut.h.

References IsOnExceptF(), MsgStr, and TExcept().

Referenced by AssertBlobBsStateStr().

                                                               {
    if (IsOnExceptF()){(*OnExceptF)(MsgStr);}
    else {throw PExcept(new TExcept(MsgStr, LocStr));}}

Here is the call graph for this function:

Here is the caller graph for this function:

TNotify ( )

Definition at line 33 of file ut.h.

{}
void WarnNotify ( const TStr MsgStr) [inline]

Definition at line 22 of file ut.h.

References TStr::CStr(), and WarnNotify().

{WarnNotify(MsgStr.CStr());}

Here is the call graph for this function:

virtual ~TExcept ( ) [virtual]

Definition at line 167 of file ut.h.

{}
virtual ~TNotify ( ) [virtual]

Definition at line 34 of file ut.h.

{}

Variable Documentation

Definition at line 159 of file ut.h.

Referenced by GetLocStr(), and GetStr().

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

Definition at line 60 of file ut.h.

Definition at line 177 of file ut.h.

Referenced by GetOnExceptF(), IsOnExceptF(), and PutOnExceptF().

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

Definition at line 62 of file ut.h.

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

Definition at line 61 of file ut.h.