Belle II Software  release-08-01-10
Time.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef Time_hh
9 #define Time_hh
10 
11 #include "daq/slc/base/Serializable.h"
12 
13 #include <string>
14 
15 namespace Belle2 {
21  class Time : public Serializable {
22 
23  // constructors & destructors
24  public:
25  explicit Time();
26  Time(const double);
27  Time(const long, const long);
28  ~Time();
29 
30  // member methods
31  private:
32  void adjust();
33 
34  public:
35  void clear();
36  void set();
37  void set(const double);
38  void set(const long, const long);
39  double get() const;
40  long getSecond() const;
41  long getMicroSecond() const;
42  std::string toString() const;
43 
44  // for serialization
45  public:
46  void readObject(Reader&) override;
47  void writeObject(Writer&) const override;
48 
49  // operators
50  public:
51  bool operator == (const Time&) const;
52  Time operator + (const Time&) const;
53  Time operator - (const Time&) const;
54 
55  // member data
56  private:
57  long m_s;
58  long m_us;
59 
60  };
61 
63 }
64 
65 #endif
Abstract base class for different kinds of events.