OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDuration.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 //*************************************************************************
10 // $Id$
11 #ifndef ossimDuration_HEADER
12 #define ossimDuration_HEADER
13 #include <ossim/base/ossimString.h>
16 #include <iostream>
17 
19 {
20 public:
25  ossimDuration(const ossimString& iso8601Duration = ossimString(""));
26 
27 
31  void clearFields();
32 
37  bool readIso8601Encoding(std::istream& in);
38 
43  bool setByIso8601DurationString(const ossimString& iso8601Duration);
44 
50  void toIso8601DurationString(ossimString& result);
51 
62  ossim_float64 toSeconds()const;
63 
64  void setSign(ossim_int32 value)
65  {
66  theSign = ((value < 0)?-1:1);
67  }
72  {
73  return theSign;
74  }
75  void setYears(ossim_uint64 value)
76  {
77  theYears = value;
78  }
80  {
81  return theYears;
82  }
83  void setMonths(ossim_uint64 value)
84  {
85  theMonths = value;
86  }
88  {
89  return theMonths;
90  }
91  void setWeeks(ossim_uint64 value)
92  {
93  theWeeks = value;
94  }
96  {
97  return theWeeks;
98  }
99  void setDays(ossim_uint64 value)
100  {
101  theDays = value;
102  }
104  {
105  return theDays;
106  }
107  void setHours(ossim_uint64 value)
108  {
109  theHours = value;
110  }
112  {
113  return theHours;
114  }
116  {
117  theMinutes = value;
118  }
120  {
121  return theMinutes;
122  }
124  {
125  theSeconds = value;
126  }
128  {
129  return theSeconds;
130  }
131 
135  void setAll(ossim_int32 signValue,
136  ossim_uint64 yearsValue,
137  ossim_uint64 monthsValue,
138  ossim_uint64 weeksValue,
139  ossim_uint64 daysValue,
140  ossim_uint64 hoursValue,
141  ossim_uint64 minutesValue,
142  ossim_float64 secondsValue)
143  {
144  theSign = ((signValue < 0)?-1:1);
145  theYears = yearsValue;
146  theMonths = monthsValue;
147  theWeeks = weeksValue;
148  theDays = daysValue;
149  theHours = hoursValue;
150  theMinutes = minutesValue;
151  theSeconds = secondsValue;
152  }
153 
154 
155 protected:
156  ossim_int32 theSign; // indicates -1 for negative and anything else is positive
157  ossim_int64 theYears; // number of years
158  ossim_int64 theMonths; // number of months
159  ossim_int64 theWeeks; // number of months
160  ossim_int64 theDays; // number of days
161  ossim_int64 theHours; // number of hours
162  ossim_int64 theMinutes; // number of minutes
163  ossim_float64 theSeconds; // umber of Seconds
164 };
165 
166 #endif
ossim_int64 theHours
ossim_int64 theDays
ossim_int32 sign() const
returns the sign.
Definition: ossimDuration.h:71
ossim_int64 theYears
void setAll(ossim_int32 signValue, ossim_uint64 yearsValue, ossim_uint64 monthsValue, ossim_uint64 weeksValue, ossim_uint64 daysValue, ossim_uint64 hoursValue, ossim_uint64 minutesValue, ossim_float64 secondsValue)
Sets all values in one call.
void setDays(ossim_uint64 value)
Definition: ossimDuration.h:99
void setHours(ossim_uint64 value)
ossim_int64 years() const
Definition: ossimDuration.h:79
ossim_int64 months() const
Definition: ossimDuration.h:87
void setMinutes(ossim_uint64 value)
double ossim_float64
void setWeeks(ossim_uint64 value)
Definition: ossimDuration.h:91
ossim_float64 theSeconds
unsigned long long ossim_uint64
ossim_int64 minutes() const
ossim_int64 weeks() const
Definition: ossimDuration.h:95
void setMonths(ossim_uint64 value)
Definition: ossimDuration.h:83
void setSeconds(ossim_float64 value)
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
void setYears(ossim_uint64 value)
Definition: ossimDuration.h:75
ossim_int64 theMinutes
ossim_int64 days() const
void setSign(ossim_int32 value)
Definition: ossimDuration.h:64
#define OSSIM_DLL
ossim_int64 theMonths
ossim_int32 theSign
long long ossim_int64
ossim_int64 theWeeks
ossim_int64 hours() const
ossim_float64 seconds() const
int ossim_int32