| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# ITime.h

Go to the documentation of this file.

    00001 #ifndef        __GAUDI_INTERFACES_ITIME_H__
    00002 #define        __GAUDI_INTERFACES_ITIME_H__
    00003
    00004 #include <iostream>
    00005 #include "GaudiKernel/Kernel.h"
    00006 #include "GaudiKernel/MsgStream.h"
    00007
    00008 //
    00009 //   Class ITime:  a crude interface to any time-stamps
    00010 //                 provide minimal interface for stamp
    00011 //                 manipulation with "time" object.
    00012 //
    00013 //                 One should distinguish the notion of
    00014 //                 time-stamp and time-difference.
    00015 //                 e.g. unit of "month" is good for
    00016 //                 "time-stamp" and it is unacceptable for
    00017 //                 "time-difference, since the month can
    00018 //                 consists of 30 or 31 day. The same argument
    00019 //                 is applied to "year"
    00020 //                 Another difference is from teh notion of "0"-year
    00021 //
    00022 //                 This interface is common for "time-stamp"
    00023 //                 and "time-difference"
    00024 //
    00025
    00026
    00027 class ITime
    00028 {
    00029 public:
    00030   //
    00031   // internal representation
    00032   // (probably in ns units - according to CLHEP/Units/SystemOfUnits.h
    00033   // if it is so 1 year == (approx) (10**9) * (3*10**7) = 3*10^16 "units"
    00034   //
    00035   // representation in given units
    00036   typedef longlong       AbsoluteTime;
    00037   typedef double         DimensionedTime;
    00038
    00039
    00040
    00041  public:
    00042
    00043   //
    00044   // accessor to internal representation
    00045   virtual       AbsoluteTime      absoluteTime  () const = 0;
    00046
    00047   // accessor to representation in seconds
    00048   virtual       DimensionedTime   seconds       () const = 0;
    00049
    00050   // accessor to representation in minutes
    00051   virtual       DimensionedTime   minutes       () const = 0;
    00052
    00053   // accessor to representation in hours
    00054   virtual       DimensionedTime   hours         () const = 0;
    00055
    00056   // accessor to representation in days
    00057   virtual       DimensionedTime   days          () const = 0;
    00058
    00059
    00060   // comparison operators
    00061   virtual       bool              operator==( const ITime& ) const = 0;
    00062   virtual       bool              operator!=( const ITime& ) const = 0;
    00063   virtual       bool              operator<=( const ITime& ) const = 0;
    00064   virtual       bool              operator>=( const ITime& ) const = 0;
    00065   virtual       bool              operator< ( const ITime& ) const = 0;
    00066   virtual       bool              operator> ( const ITime& ) const = 0;
    00067
    00068   // adding
    00069   virtual       ITime&            operator+=( const ITime& ) = 0 ;
    00070
    00071   // substraction
    00072   virtual       ITime&            operator-=( const ITime& ) = 0 ;
    00073
    00074   virtual std::ostream&  printOut( std::ostream& ) const = 0;
    00075
    00076   // destructor
    00077   virtual ~ITime(){};
    00078
    00079 };
    00080
    00081 //
    00082 //
    00083 //
    00084
    00085 inline std::ostream& operator<<(std::ostream& os , const ITime& time ) {
    00086   return  time.printOut(os);
    00087 }
    00088
    00089 inline MsgStream& operator<<(MsgStream& ms , const ITime& time ) {
    00090   if ( ms.isActive() ) time.printOut(ms.stream());
    00091   return ms;
    00092 }
    00093
    00094 //
    00095 //
    00096 //
    00097
    00098 #endif   //    __GAUDI_INTERFACES_ITIME_H__