isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
TimeDelta.h
1 //-*- C++ -*-
2 //-*- coding: utf-8 -*-
3 //
4 // Author: Piyush Agram
5 // Copyright 2017-2018
6 
7 #pragma once
8 
9 #include "forward.h"
10 
17 public:
18 
20  int days;
22  int hours;
24  int minutes;
26  int seconds;
28  double frac;
29 
31  TimeDelta();
32 
34  TimeDelta(double ss);
35 
37  TimeDelta(int hh, int mm, int ss);
38 
40  TimeDelta(int hh, int mm, double ss);
41 
43  TimeDelta(int hh, int mm, int ss, double ff);
44 
46  TimeDelta(int days, int hours, int minutes, int seconds, double frac);
47 
49  TimeDelta(const TimeDelta& ts);
50 
52  void _init(int days, int hours, int minutes, int seconds, double frac);
54  void _normalize();
55 
56  // Comparison operators
57  bool operator<( const TimeDelta &ts) const;
58  bool operator<( double ts) const;
59  bool operator>( const TimeDelta &ts) const;
60  bool operator>( double ts) const;
61  bool operator<=( const TimeDelta &ts) const;
62  bool operator<=( double ts) const;
63  bool operator>=( const TimeDelta &ts) const;
64  bool operator>=( double ts) const;
65  bool operator==( const TimeDelta &ts) const;
66  bool operator==( double ts) const;
67  bool operator!=( const TimeDelta &ts) const;
68  bool operator!=( double ts) const;
69 
70  // Math operators
71  TimeDelta& operator=(const TimeDelta& ts);
72  TimeDelta& operator=(double ss);
73  TimeDelta& operator+=(const TimeDelta& ts);
74  TimeDelta& operator+=(const double& s);
75  TimeDelta& operator-=(const TimeDelta& ts);
76  TimeDelta& operator-=(const double& s);
77 
78  TimeDelta operator+(const TimeDelta& ts) const;
79  TimeDelta operator+(const double& s) const;
80  TimeDelta operator-(const TimeDelta& ts) const;
81  TimeDelta operator-(const double& s) const;
82 
83  TimeDelta operator*(const double& s) const;
84  TimeDelta& operator*=(const double& s);
85 
86  TimeDelta operator/(const double& s) const;
87  TimeDelta& operator/=(const double& s);
88 
90  double getTotalDays() const;
92  double getTotalHours() const;
94  double getTotalMinutes() const;
96  double getTotalSeconds() const;
97 };
98 
99 // Some constants
100 namespace isce3 {
101  namespace core {
102 
103  TimeDelta operator*(double, const TimeDelta &);
104 
105  const int MIN_TO_SEC=60;
106  const int HOUR_TO_SEC=3600;
107  const int HOUR_TO_MIN=60;
108  const int DAY_TO_SEC=86400;
109  const int DAY_TO_MIN=1440;
110  const int DAY_TO_HOUR=24;
111  }
112 }
double getTotalSeconds() const
Return equivalent double precision seconds.
Definition: TimeDelta.cpp:119
int seconds
Integer seconds.
Definition: TimeDelta.h:26
TimeDelta()
Empty constructor.
Definition: TimeDelta.cpp:78
void _init(int days, int hours, int minutes, int seconds, double frac)
Internal function for use with constructors.
Definition: TimeDelta.cpp:67
int hours
Integer hours.
Definition: TimeDelta.h:22
double getTotalMinutes() const
Return equivalent double precision minutes.
Definition: TimeDelta.cpp:139
Data structure to store TimeDelta to double precision seconds.
Definition: TimeDelta.h:16
int days
Integer days.
Definition: TimeDelta.h:20
void _normalize()
Internal function.
Definition: TimeDelta.cpp:17
double getTotalHours() const
Return equivalent double precision hours.
Definition: TimeDelta.cpp:145
double getTotalDays() const
Return equivalent double precision days.
Definition: TimeDelta.cpp:151
double frac
Double precision fractional seconds.
Definition: TimeDelta.h:28
int minutes
Integer minutes.
Definition: TimeDelta.h:24

Generated for ISCE3.0 by doxygen 1.8.5.