SNAP Library , Developer Reference  2013-01-07 14:03:36
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
TFPathNotify Class Reference

#include <xfl.h>

Inheritance diagram for TFPathNotify:
Collaboration diagram for TFPathNotify:

List of all members.

Public Member Functions

 TFPathNotify (const TStr &_LogFPath, const TStr &_PrefixFNm, const bool &_FlushP)
void OnStatus (const TStr &MsgStr)

Static Public Member Functions

static PNotify New (const TStr &LogFPath, const TStr &PrefixFNm, const bool &FlushP)

Private Member Functions

void UpdateSOut (const TTm &NowTm)
 UndefDefaultCopyAssign (TFPathNotify)

Private Attributes

TStr LogFPath
TStr PrefixFNm
TTm LastTm
PSOut LogSOut
TBool FlushP

Detailed Description

Definition at line 83 of file xfl.h.


Constructor & Destructor Documentation

TFPathNotify::TFPathNotify ( const TStr _LogFPath,
const TStr _PrefixFNm,
const bool &  _FlushP 
)

Definition at line 262 of file xfl.cpp.

References TTm::GetCurUniTm(), LastTm, and UpdateSOut().

Referenced by New().

                                    : LogFPath(_LogFPath), PrefixFNm(_PrefixFNm),
                        FlushP(_FlushP) { 

        LastTm = TTm::GetCurUniTm();
        UpdateSOut(LastTm);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

static PNotify TFPathNotify::New ( const TStr LogFPath,
const TStr PrefixFNm,
const bool &  FlushP 
) [inline, static]

Definition at line 97 of file xfl.h.

References TFPathNotify().

Referenced by UpdateSOut().

                                                                                            {
                return PNotify(new TFPathNotify(LogFPath, PrefixFNm, FlushP));}

Here is the call graph for this function:

Here is the caller graph for this function:

void TFPathNotify::OnStatus ( const TStr MsgStr) [virtual]

Reimplemented from TNotify.

Definition at line 270 of file xfl.cpp.

References TSOut::Flush(), FlushP, TTm::GetCurUniTm(), TTm::GetHour(), LastTm, LogSOut, TSOut::PutStrLn(), and UpdateSOut().

                                              {
        // check if new hour so we switch to new log file
        TTm NowTm = TTm::GetCurUniTm();
        if (NowTm.GetHour() != LastTm.GetHour()) { 
                LastTm = NowTm; UpdateSOut(LastTm);
        }
        // write log line
        LogSOut->PutStrLn(MsgStr); 
        // we flush for each line when in debug mode
        if (FlushP) { LogSOut->Flush(); }
}

Here is the call graph for this function:

void TFPathNotify::UpdateSOut ( const TTm NowTm) [private]

Definition at line 255 of file xfl.cpp.

References TPt< TRec >::Clr(), TStr::CStr(), TPt< TRec >::Empty(), TSOut::Flush(), TStr::Fmt(), TTm::GetDay(), TTm::GetHour(), TTm::GetMonth(), TTm::GetYear(), LogFPath, LogSOut, New(), and PrefixFNm.

Referenced by OnStatus(), and TFPathNotify().

                                           {
        if (!LogSOut.Empty()) { LogSOut->Flush(); LogSOut.Clr(); }
        TStr FNm = TStr::Fmt("%s-Y%04d-M%02d-D%02d-H%02d.log", PrefixFNm.CStr(),
                Tm.GetYear(), Tm.GetMonth(), Tm.GetDay(), Tm.GetHour());
        LogSOut = TFOut::New(LogFPath + FNm, true);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 89 of file xfl.h.

Referenced by OnStatus().

Definition at line 87 of file xfl.h.

Referenced by OnStatus(), and TFPathNotify().

Definition at line 85 of file xfl.h.

Referenced by UpdateSOut().

Definition at line 88 of file xfl.h.

Referenced by OnStatus(), and UpdateSOut().

Definition at line 86 of file xfl.h.

Referenced by UpdateSOut().


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