Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBlog.cxx

Go to the documentation of this file.
00001 
00006 /*----------------------------------------------------------------------------*/
00007 /* C Tool Box: Designed and implemented by:                                   */
00008 /*    Walter F.J. Mueller   Gesellschaft fuer Schwerionenforschung (GSI)      */
00009 /*                          Planckstrasse 1, D-64291 Darmstadt, Germany       */
00010 /*                  Email:  W.F.J.Mueller@gsi.de                              */
00011 /*                  WWW:    http://www-kp3.gsi.de/www/kp3/people/mueller.html */
00012 /*----------------------------------------------------------------------------*/
00013 
00014 #include <time.h>
00015 
00016 #include "CTB.hxx"
00017 #include "CTBprintf.hxx"
00018 #include "CTBlog.hxx"
00019 
00025 //------------------------------------------+-----------------------------------
00027 
00028 void CTBlogHead::ToStream(ostream& os) const
00029 {
00030   time_t      i_time  = time(0);            // current time
00031   struct tm*  ps_time = localtime(&i_time); // get y/m/d:h:m:s
00032   char *      c_mtable[12] = {"Jan","Feb","Mar","Apr","May","Jun",
00033                               "Jul","Aug","Sep","Oct","Nov","Dec"};
00034   
00035 
00036   if (ps_time->tm_year != mi_lastyear ||
00037       ps_time->tm_mon  != mi_lastmon  ||
00038       ps_time->tm_mday != mi_lastmday) {
00039     mi_lastyear = ps_time->tm_year;
00040     mi_lastmon  = ps_time->tm_mon;
00041     mi_lastmday = ps_time->tm_mday;
00042     os << " -+- " << CTBprintf(ps_time->tm_mday,"d0",2) << "-"
00043        << c_mtable[ps_time->tm_mon] << "-"
00044        << CTBprintf(ps_time->tm_year+1900,"d",4) << " -+- \n";
00045   }
00046 
00047   os << " --- " << CTBprintf(ps_time->tm_hour,"d0",2) << ":"
00048      << CTBprintf(ps_time->tm_min,"d0",2) << ":"
00049      << CTBprintf(ps_time->tm_sec,"d0",2) << " --- ";
00050 
00051   return;
00052 }
00053 
00054 //------------------------------------------+-----------------------------------
00055 CTBint32 CTBlogHead::mi_lastyear = 0;
00056 CTBint32 CTBlogHead::mi_lastmon  = 0;
00057 CTBint32 CTBlogHead::mi_lastmday = 0;
00058 
00059 //------------------------------------------+-----------------------------------
00065 //------------------------------------------+-----------------------------------
00067 
00068 void CTBlogTail::ToStream(ostream& os) const
00069 {
00070   os << endl;
00071   return;
00072 }
00073 
00074 //------------------------------------------+-----------------------------------
00080 //------------------------------------------+-----------------------------------
00082 
00083 void CTBlogLine::ToStream(ostream& os) const
00084 {
00085   os << CTBlogHead();
00086   if (mc_message) os << mc_message;
00087   os<< CTBlogTail();
00088   return;
00089 }
00090 
00091 
00092 #if (defined(CTB__OutLine) || defined(CTBlog__OutLine))
00093 #define inline
00094 #include "CTBlog.icc"
00095 #undef  inline
00096 #endif

Generated at Fri Oct 24 18:11:28 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001