IOVTimeStamp.h
Go to the documentation of this file.
1 /**
2  * \file IOVTimeStamp.h
3  *
4  * \ingroup IOVData
5  *
6  * \brief Class def header for a class IOVTimeStamp
7  *
8  * @author eberly@fnal.gov
9  */
10 
11 /** \addtogroup IOVData
12 
13  @{*/
14 #ifndef IOVDATA_IOVTIMESTAMP_H
15 #define IOVDATA_IOVTIMESTAMP_H
16 
17 #include <string>
18 
19 namespace lariov {
20  /**
21  \class IOVTimeStamp
22  */
23 
24  class IOVTimeStamp {
25 
26  public:
27 
28  ///Constructor
29  IOVTimeStamp(unsigned long stamp, unsigned int substamp = 0) :
30  fStamp(stamp), fSubStamp(substamp) {
31  this->CalcDBStamp();
32  }
33 
34  ///Default destructor
35  virtual ~IOVTimeStamp(){}
36 
37  unsigned long Stamp() const { return fStamp; }
38  unsigned long SubStamp() const { return fSubStamp; }
39  const std::string& DBStamp() const { return fDBStamp; }
40 
41  void SetStamp(unsigned long stamp, unsigned int substamp = 0) {fStamp = stamp; fSubStamp = substamp; this->CalcDBStamp();}
42 
43 
44  /**
45  This function combines the stamp and substamp into a unique string to be used
46  as a database timestamp.
47  */
48  void CalcDBStamp();
49 
50  static IOVTimeStamp GetFromString(const std::string& ts);
51  static IOVTimeStamp MinTimeStamp();
52  static IOVTimeStamp MaxTimeStamp();
53 
54 
55  ///comparison operators
56  bool operator<(const IOVTimeStamp& ts) const;
57  bool operator<=(const IOVTimeStamp& ts) const;
58  bool operator>=(const IOVTimeStamp& ts) const;
59  bool operator>(const IOVTimeStamp& ts) const;
60 
61  bool operator==(const IOVTimeStamp& ts) const;
62  bool operator!=(const IOVTimeStamp& ts) const;
63 
64  ///assignment operator
65  IOVTimeStamp& operator=( const IOVTimeStamp& ts);
66 
67 
68  protected:
69 
70  unsigned long fStamp;
71  unsigned int fSubStamp;
72 
74  };
75 }
76 #endif
77 
78 
static IOVTimeStamp MinTimeStamp()
bool operator==(const IOVTimeStamp &ts) const
implementation of equality operator
void SetStamp(unsigned long stamp, unsigned int substamp=0)
Definition: IOVTimeStamp.h:41
IOVTimeStamp(unsigned long stamp, unsigned int substamp=0)
Constructor.
Definition: IOVTimeStamp.h:29
std::string string
Definition: nybbler.cc:12
virtual ~IOVTimeStamp()
Default destructor.
Definition: IOVTimeStamp.h:35
bool operator>=(const IOVTimeStamp &ts) const
bool operator<(const IOVTimeStamp &ts) const
comparison operators
const std::string & DBStamp() const
Definition: IOVTimeStamp.h:39
bool operator<=(const IOVTimeStamp &ts) const
unsigned long SubStamp() const
Definition: IOVTimeStamp.h:38
bool operator>(const IOVTimeStamp &ts) const
bool operator!=(const IOVTimeStamp &ts) const
remaining comparison operators implemented in terms of == and <
unsigned int fSubStamp
Definition: IOVTimeStamp.h:71
Filters for channels, events, etc.
unsigned long fStamp
Definition: IOVTimeStamp.h:70
unsigned long Stamp() const
Definition: IOVTimeStamp.h:37
IOVTimeStamp & operator=(const IOVTimeStamp &ts)
assignment operator
static IOVTimeStamp GetFromString(const std::string &ts)
static IOVTimeStamp MaxTimeStamp()
std::string fDBStamp
Definition: IOVTimeStamp.h:73