source: trunk/MagicSoft/include-Classes/MBase/MTime.h@ 499

Last change on this file since 499 was 490, checked in by magicsol, 24 years ago
*** empty log message ***
File size: 1.9 KB
Line 
1#ifndef MTIME_H
2#define MTIME_H
3
4#ifndef MPARCONTAINER_H
5#include "MParContainer.h"
6#endif
7
8class MTime : public MParContainer
9{
10private:
11 UInt_t fTimeStamp[2]; // type of raw event which should be processed by this task
12 UInt_t fDuration; // time of validity
13
14public:
15
16 MTime(const char *name=NULL, const char *title=NULL)
17 {
18 *fName = name ? name : ClassName();
19 *fTitle = title;
20
21 SetTime(0,0);
22 }
23
24 MTime(UInt_t t1, UInt_t t0)
25 {
26 SetTime(t1, t0);
27 }
28
29 MTime(MTime& t)
30 {
31 fTimeStamp[0] = t.fTimeStamp[0];
32 fTimeStamp[1] = t.fTimeStamp[1];
33 fDuration = t.fDuration;
34 }
35
36 void operator=(MTime &t)
37 {
38 fTimeStamp[0] = t.fTimeStamp[0];
39 fTimeStamp[1] = t.fTimeStamp[1];
40 fDuration = t.fDuration;
41 }
42
43 ~MTime() {}
44
45 void Print(Option_t *t=NULL);
46
47 void SetTime(UInt_t t1, UInt_t t0)
48 {
49 fTimeStamp[0] = t1;
50 fTimeStamp[1] = t0;
51 }
52
53 void SetDuration(UInt_t t)
54 {
55 fDuration = t;
56 }
57
58 MTime *GetTime()
59 {
60 return this;
61 }
62
63 UInt_t GetTimeLo()
64 {
65 return fTimeStamp[0];
66 }
67 UInt_t GetTimeHi()
68 {
69 return fTimeStamp[1];
70 }
71
72 UInt_t GetDuration()
73 {
74 return fDuration;
75 }
76
77 ClassDef(MTime, 1) // A general Mars time stamp
78};
79
80inline Bool_t operator<(MTime &t1, MTime &t2)
81{
82 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<t2.GetTimeLo());
83}
84
85inline Bool_t operator>(MTime &t1, MTime &t2)
86{
87 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>t2.GetTimeLo());
88}
89
90inline Bool_t operator<=(MTime &t1, MTime &t2)
91{
92 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<=t2.GetTimeLo());
93}
94
95inline Bool_t operator>=(MTime &t1, MTime &t2)
96{
97 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>=t2.GetTimeLo());
98}
99
100inline Bool_t operator==(MTime &t1, MTime &t2)
101{
102 return (t1.GetTimeLo()==t2.GetTimeLo()) && (t1.GetTimeHi()==t2.GetTimeHi());
103}
104
105#endif
Note: See TracBrowser for help on using the repository browser.