Global/TimeStamp.h

Go to the documentation of this file.
00001 /*  Last edited: Apr 18 18:06 2002 (ac2) */
00002 
00003 // #######################################################################
00004 
00005 // SSAHA : Sequence Search and Alignment by Hashing Algorithm
00006 // Version 3.2, released 1st March 2004
00007 // Copyright (c) Genome Research 2002
00008 
00009 // SSAHA is free software; you can redistribute it and/or modify 
00010 // it under the terms of version 2 of the GNU General Public Licence
00011 // as published by the Free Software Foundation.
00012  
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public Licence for more details.
00017  
00018 // You should have received a copy of the GNU General Public Licence
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 // or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
00022 
00023 // #######################################################################
00024 
00025 // Module Name  : TimeStamp
00026 // File Name    : TimeStamp.h
00027 // Language     : C++
00028 // Module Author: Anthony J. Cox (ac2@sanger.ac.uk)
00029 
00030 // Include guard:
00031 #ifndef INCLUDED_TimeStamp
00032 #define INCLUDED_TimeStamp
00033 
00034 using namespace std;
00035 // Description:
00036 
00037 
00038 // Includes:
00039 
00040 #include <fstream>
00041 #include <time.h>
00042 
00043 // ### Class Declarations ###
00044 
00045 
00046 // Class Name : Timer
00047 // Description: Maintains timing info during a run, and outputs it on request.
00048 
00049 class Timer
00050 {
00051 
00052   // PUBLIC MEMBER FUNCTIONS
00053   public:
00054 
00055   // Constructors and Destructors
00056 
00057   // Function Name:
00058   // Arguments:
00059   // TYPE  NAME  IN/OUT COMMENT
00060   // Returns: TYPE COMMENT
00061   Timer( void );
00062 
00063   // Function Name:
00064   // Arguments:
00065   // TYPE  NAME  IN/OUT COMMENT
00066   // Returns: TYPE COMMENT
00067   ~Timer(); 
00068   // (NB destructor should be virtual if class is to be derived from)
00069 
00070   // Manipulator Functions
00071 
00072   // Function Name: timeStamp
00073   // Arguments: ostream&
00074   // Returns:   ostream&
00075   // This functions outputs a message string to the specified output
00076   // stream consisting of current date and time and the elapsed time in
00077   // microseconds since the a) the timer was created and b) this
00078   // method was last called. Can be called directly, but intention is that
00079   // it is called by overloaded << operator defined below.
00080   ostream& timeStamp( ostream& os );
00081 
00082   // Accessor Functions
00083   // (NB all accessor functions should be 'const')
00084 
00085   // Function Name:
00086   // Arguments:
00087   // TYPE  NAME  IN/OUT COMMENT
00088   // Returns: TYPE COMMENT
00089   
00090   // PROTECTED MEMBER FUNCTIONS 
00091   // (visible to this class and derived classes only)
00092   protected:
00093 
00094   // PRIVATE MEMBER FUNCTIONS
00095   // (visible to instances of this class only)
00096   
00097   private:
00098   Timer( const Timer&);             // NOT IMPLEMENTED
00099   Timer& operator=(const Timer&);   // NOT IMPLEMENTED
00100 
00101   // PRIVATE MEMBER DATA
00102   private:
00103   int numStamps;
00104   clock_t firstStamp;
00105   clock_t lastStamp;
00106 
00107 }; // Timer
00108 
00109 // ### Function Declarations ###
00110 
00111 // Name:      << operator
00112 // Arguments: ostream&, Timer&  
00113 // Returns: ostream&
00114 // Triggers a time stamp and outputs it via os
00115 ostream& operator<<( ostream& os, Timer& timer );
00116 
00117 // End of include guard:
00118 #endif
00119 
00120 // End of file TimeStamp.h

Generated on Fri Dec 21 13:12:15 2007 for ssaha by  doxygen 1.5.2