bes  Updated for version 3.20.6
DODS_Decimal_Year.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of ff_handler a FreeForm API handler for the OPeNDAP
5 // DAP2 data server.
6 
7 // Copyright (c) 2005 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This is free software; you can redistribute it and/or modify it under the
11 // terms of the GNU Lesser General Public License as published by the Free
12 // Software Foundation; either version 2.1 of the License, or (at your
13 // option) any later version.
14 //
15 // This software is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 
27 // (c) COPYRIGHT URI/MIT 1998
28 // Please read the full copyright statement in the file COPYRIGHT.
29 //
30 // Authors:
31 // jhrg,jimg James Gallagher (jgallagher@gso.uri.edu)
32 
33 #ifndef _dods_decimal_year_h
34 #define _dods_decimal_year_h
35 
36 
37 #include "DODS_Date.h"
38 #include "DODS_Time.h"
39 
48  private:
49  DODS_Date _date;
50  DODS_Time _time;
51 
52  public:
57 
62 
68 
73  DODS_Decimal_Year(string date_time);
74 
79  DODS_Decimal_Year(BaseType *date_time);
80 
90  DODS_Decimal_Year(int y, int m, int d, int hh = 0, int mm = 0, double ss = 0.0,
91  bool gmt = false);
92 
101  DODS_Decimal_Year(int y, int yd, int hh = 0, int mm = 0, double ss = 0.0,
102  bool gmt = false);
104 
110  void set(DODS_Date d);
111 
116  void set(DODS_Date d, DODS_Time t);
117 
122  void set(string date_time);
123 
128  void set(BaseType *date_time);
129 
139  void set(int y, int m, int d, int hh = 0, int mm = 0,
140  double ss = 0.0, bool gmt = false);
141 
150  void set(int y, int yd, int hh = 0, int mm = 0, double ss = 0.0,
151  bool gmt = false);
153 
157  int days_in_year() const;
158 
160  int year() const;
161 
163  double fraction() const;
164 
166  bool gmt() const;
167 
176  string get(date_format format = ymd, bool gmt = true) const;
177 
180  double julian_day() const;
181 
191  time_t unix_time() const;
193 
196  friend int operator==(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
198 
200  friend int operator!=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
201 
203  friend int operator<(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
204 
206  friend int operator>(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
207 
209  friend int operator<=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
210 
212  friend int operator>=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2);
214 
216  double get_epsilon() const;
217 
222  void set_epsilon(double eps);
223 
227  bool OK() const;
228 
229 };
230 
231 // $Log: DODS_Decimal_Year.h,v $
232 // Revision 1.2 2000/10/11 19:37:55 jimg
233 // Moved the CVS log entries to the end of files.
234 // Changed the definition of the read method to match the dap library.
235 // Added exception handling.
236 // Added exceptions to the read methods.
237 //
238 // Revision 1.1 1999/05/25 13:50:49 dan
239 // Modified for dap-3.0.0a changes.
240 //
241 // Revision 1.1 1999/01/08 22:08:18 jimg
242 // Fixed doc++ comments.
243 //
244 
245 #endif // _DODS_Decimal_Year_h
DODS_Time
Definition: DODS_Time.h:63
DODS_Decimal_Year::year
int year() const
DODS_Decimal_Year::gmt
bool gmt() const
DODS_Decimal_Year::DODS_Decimal_Year
DODS_Decimal_Year()
DODS_Decimal_Year::set_epsilon
void set_epsilon(double eps)
DODS_Decimal_Year::fraction
double fraction() const
DODS_Decimal_Year::operator<
friend int operator<(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Less-than.
DODS_Decimal_Year::operator<=
friend int operator<=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Less-than or Equal-to.
DODS_Date
Definition: DODS_Date.h:108
DODS_Decimal_Year::julian_day
double julian_day() const
DODS_Decimal_Year::operator>=
friend int operator>=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Greater-than or Equal-to.
DODS_Decimal_Year::operator==
friend int operator==(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Equality.
DODS_Decimal_Year::operator!=
friend int operator!=(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Inequality.
DODS_Decimal_Year::unix_time
time_t unix_time() const
DODS_Decimal_Year::OK
bool OK() const
DODS_Decimal_Year::set
void set(DODS_Date d)
DODS_Decimal_Year
Definition: DODS_Decimal_Year.h:47
DODS_Decimal_Year::days_in_year
int days_in_year() const
DODS_Decimal_Year::operator>
friend int operator>(DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
Greater-than.
DODS_Decimal_Year::get_epsilon
double get_epsilon() const
DODS_Decimal_Year::get
string get(date_format format=ymd, bool gmt=true) const