8 #include <dballe/fwd.h> 42 Date(
int ye,
int mo=1,
int da=1);
48 static Date from_julian(
int jday);
51 bool is_missing()
const;
54 int to_julian()
const;
59 void to_stream_iso8601(std::ostream& out)
const;
64 void to_csv_iso8601(
CSVWriter& out)
const;
73 int compare(
const Date& other)
const;
75 bool operator<(
const Date& dt)
const;
76 bool operator>(
const Date& dt)
const;
77 bool operator==(
const Date& dt)
const;
78 bool operator!=(
const Date& dt)
const;
81 static void validate(
int ye,
int mo,
int da);
83 static int days_in_month(
int year,
int month);
85 static int calendar_to_julian(
int year,
int month,
int day);
87 static void julian_to_calendar(
int jday,
unsigned short& year,
unsigned char& month,
unsigned char& day);
90 std::ostream& operator<<(std::ostream& out,
const Date& dt);
102 unsigned char minute;
103 unsigned char second;
114 Time(
int ho,
int mi=0,
int se=0);
119 bool is_missing()
const;
125 void to_stream_iso8601(std::ostream& out)
const;
130 void to_csv_iso8601(
CSVWriter& out)
const;
139 int compare(
const Time& other)
const;
141 bool operator<(
const Time& dt)
const;
142 bool operator>(
const Time& dt)
const;
143 bool operator==(
const Time& dt)
const;
144 bool operator!=(
const Time& dt)
const;
152 static void validate(
int ho,
int mi,
int se);
155 std::ostream& operator<<(std::ostream& out,
const Time& t);
170 unsigned char minute;
171 unsigned char second;
183 Datetime(
int ye,
int mo=1,
int da=1,
int ho=0,
int mi=0,
int se=0);
186 static Datetime from_julian(
int jday,
int ho=0,
int mi=0,
int se=0);
192 static Datetime lower_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
198 static Datetime upper_bound(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
201 void set_lower_bound();
204 void set_upper_bound();
213 bool is_missing()
const;
216 int to_julian()
const;
225 int compare(
const Datetime& other)
const;
227 bool operator==(
const Datetime& o)
const;
228 bool operator!=(
const Datetime& o)
const;
229 bool operator<(
const Datetime& o)
const;
230 bool operator>(
const Datetime& o)
const;
231 bool operator<=(
const Datetime& o)
const;
232 bool operator>=(
const Datetime& o)
const;
237 int print_iso8601(FILE* out,
char sep=
'T',
const char* end=
"\n")
const;
242 int print(FILE* out,
const char* end=
"\n")
const;
251 void to_stream_iso8601(std::ostream& out,
char sep=
'T',
const char* tz=
"")
const;
256 void to_csv_iso8601(
CSVWriter& out,
char sep=
'T',
const char* tz=
"")
const;
263 static Datetime from_iso8601(
const char* str);
273 static void validate(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
279 static void normalise_h24(
int& ye,
int& mo,
int& da,
int& ho,
int& mi,
int& se);
282 std::ostream& operator<<(std::ostream& out,
const Datetime& dt);
301 int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
302 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
305 bool is_missing()
const;
329 void set(
int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
330 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
339 bool contains(
const Datetime& dt)
const;
348 int print(FILE* out,
const char* end=
"\n")
const;
351 std::ostream& operator<<(std::ostream& out,
const DatetimeRange& dtr);
368 int lat = MISSING_INT;
374 int lon = MISSING_INT;
381 Coords(
double lat,
double lon);
384 bool is_missing()
const;
387 void set_lat(
double lat);
390 void set_lon(
double lon);
393 void set_lat(
int lat);
396 void set_lon(
int lon);
399 void set(
int lat,
int lon);
402 void set(
double lat,
double lon);
420 int compare(
const Coords& o)
const;
422 bool operator==(
const Coords& o)
const;
423 bool operator!=(
const Coords& o)
const;
424 bool operator<(
const Coords& o)
const;
425 bool operator>(
const Coords& o)
const;
426 bool operator<=(
const Coords& o)
const;
427 bool operator>=(
const Coords& o)
const;
430 int print(FILE* out,
const char* end=
"\n")
const;
433 std::string to_string(
const char* undef=
"-")
const;
436 static int lat_to_int(
double lat);
439 static int lon_to_int(
double lat);
442 static double lat_from_int(
int lat);
445 static double lon_from_int(
int lon);
448 std::ostream& operator<<(std::ostream&,
const Coords&);
467 static constexpr
int IMIN = -9000000;
469 static constexpr
int IMAX = 9000000;
471 static constexpr
double DMIN = -90.0;
473 static constexpr
double DMAX = 90.0;
487 bool operator==(
const LatRange& lr)
const;
488 bool operator!=(
const LatRange& lr)
const;
491 bool is_missing()
const;
500 void get(
double& min,
double& max)
const;
503 void set(
int min,
int max);
506 void set(
double min,
double max);
509 bool contains(
int lat)
const;
512 bool contains(
double lat)
const;
515 bool contains(
const LatRange& lr)
const;
523 int print(FILE* out,
const char* end=
"\n")
const;
526 std::ostream& operator<<(std::ostream& out,
const LatRange& lr);
551 int imin = MISSING_INT;
553 int imax = MISSING_INT;
562 bool operator==(
const LonRange& lr)
const;
563 bool operator!=(
const LonRange& lr)
const;
566 bool is_missing()
const;
579 void get(
double& min,
double& max)
const;
585 void set(
int min,
int max);
591 void set(
double min,
double max);
600 bool contains(
int lon)
const;
603 bool contains(
double lon)
const;
606 bool contains(
const LonRange& lr)
const;
614 int print(FILE* out,
const char* end=
"\n")
const;
617 std::ostream& operator<<(std::ostream& out,
const LonRange& lr);
632 Level(
int ltype1=MISSING_INT,
int l1=MISSING_INT,
int ltype2=MISSING_INT,
int l2=MISSING_INT)
633 : ltype1(ltype1), l1(l1), ltype2(ltype2), l2(l2) {}
636 bool is_missing()
const;
638 bool operator==(
const Level& o)
const;
639 bool operator!=(
const Level& o)
const;
640 bool operator<(
const Level& o)
const;
641 bool operator>(
const Level& o)
const;
642 bool operator<=(
const Level& o)
const;
643 bool operator>=(
const Level& o)
const;
652 int compare(
const Level& l)
const;
657 std::string describe()
const;
660 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
663 std::string to_string(
const char* undef=
"-")
const;
671 static Level cloud(
int ltype2=MISSING_INT,
int l2=MISSING_INT);
674 int print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
677 std::ostream& operator<<(std::ostream& out,
const Level& l);
692 Trange(
int pind=MISSING_INT,
int p1=MISSING_INT,
int p2=MISSING_INT)
693 : pind(pind), p1(p1), p2(p2) {}
696 bool is_missing()
const;
705 int compare(
const Trange& t)
const;
707 bool operator==(
const Trange& o)
const;
708 bool operator!=(
const Trange& o)
const;
709 bool operator<(
const Trange& o)
const;
710 bool operator>(
const Trange& o)
const;
711 bool operator<=(
const Trange& o)
const;
712 bool operator>=(
const Trange& o)
const;
717 std::string describe()
const;
720 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
723 std::string to_string(
const char* undef=
"-")
const;
734 int print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
737 std::ostream& operator<<(std::ostream& out,
const Trange& l);
747 char* value =
nullptr;
751 Ident(
const char* value);
752 Ident(
const std::string& value);
758 Ident& operator=(
const char* o);
759 Ident& operator=(
const std::string& o);
762 const char*
get()
const {
return value; }
767 int compare(
const Ident& o)
const;
768 int compare(
const char* o)
const;
769 int compare(
const std::string& o)
const;
770 template<
typename T>
bool operator==(
const T& o)
const {
return compare(o) == 0; }
771 template<
typename T>
bool operator!=(
const T& o)
const {
return compare(o) != 0; }
772 template<
typename T>
bool operator<(
const T& o)
const {
return compare(o) < 0; }
773 template<
typename T>
bool operator<=(
const T& o)
const {
return compare(o) <= 0; }
774 template<
typename T>
bool operator>(
const T& o)
const {
return compare(o) > 0; }
775 template<
typename T>
bool operator>=(
const T& o)
const {
return compare(o) >= 0; }
778 bool is_missing()
const;
780 operator const char*()
const {
return value; }
781 operator std::string()
const;
784 std::ostream& operator<<(std::ostream&,
const Ident&);
805 bool is_missing()
const;
807 bool operator==(
const Station& o)
const 811 bool operator!=(
const Station& o)
const 815 bool operator<(
const Station& o)
const 819 bool operator<=(
const Station& o)
const 823 bool operator>(
const Station& o)
const 827 bool operator>=(
const Station& o)
const 838 int print(FILE* out,
const char* end=
"\n")
const;
841 std::string to_string(
const char* undef=
"-")
const;
844 std::ostream& operator<<(std::ostream&,
const Station&);
854 int id = MISSING_INT;
860 bool is_missing()
const;
862 bool operator==(
const DBStation& o)
const 866 bool operator!=(
const DBStation& o)
const 874 bool operator<=(
const DBStation& o)
const 882 bool operator>=(
const DBStation& o)
const 893 int print(FILE* out,
const char* end=
"\n")
const;
896 std::string to_string(
const char* undef=
"-")
const;
899 std::ostream& operator<<(std::ostream&,
const DBStation&);
908 typedef size_t result_type;
909 result_type operator()(argument_type
const& o)
const noexcept;
915 typedef size_t result_type;
916 result_type operator()(argument_type
const& o)
const noexcept;
922 typedef size_t result_type;
923 result_type operator()(argument_type
const& o)
const noexcept;
929 typedef size_t result_type;
930 result_type operator()(argument_type
const& o)
const noexcept;
936 typedef size_t result_type;
937 result_type operator()(argument_type
const& o)
const noexcept;
940 template<>
struct hash<
dballe::DBStation>
943 typedef size_t result_type;
944 result_type operator()(argument_type
const& o)
const noexcept;
int ltype1
Type of the level or the first layer. See Level type values.
Definition: types.h:624
int ltype2
Type of the the second layer. See Level type values.
Definition: types.h:628
Ident ident
Mobile station identifier.
Definition: types.h:799
Station information.
Definition: types.h:790
Calendar date.
Definition: types.h:27
Coords coords
Station coordinates.
Definition: types.h:796
Coordinates.
Definition: types.h:365
int p1
Time range P1 indicator.
Definition: types.h:688
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:683
int pind
Time range type indicator.
Definition: types.h:686
Vertical level or layer.
Definition: types.h:621
A station identifier, that can be any string (including the empty string) or a missing value...
Definition: types.h:744
int l2
L2 value of the second layer. See Level type values.
Definition: types.h:630
Range of datetimes.
Definition: types.h:291
Datetime max
Upper bound of the range.
Definition: types.h:296
std::string report
Report name for this station.
Definition: types.h:793
int id
Database ID of the station.
Definition: types.h:854
Range of latitudes.
Definition: types.h:464
Time of the day.
Definition: types.h:99
Datetime min
Lower bound of the range.
Definition: types.h:294
Date and time.
Definition: types.h:164
Range of longitudes.
Definition: types.h:548
int l1
L1 value of the level or the first layer. See Level type values.
Definition: types.h:626
int p2
Time range P2 indicator.
Definition: types.h:690