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;
259 std::string to_string(
char sep=
'T',
const char* tz=
"")
const;
266 static Datetime from_iso8601(
const char* str);
276 static void validate(
int ye,
int mo,
int da,
int ho,
int mi,
int se);
282 static void normalise_h24(
int& ye,
int& mo,
int& da,
int& ho,
int& mi,
int& se);
285 std::ostream& operator<<(std::ostream& out,
const Datetime& dt);
304 int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
305 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
308 bool is_missing()
const;
332 void set(
int yemin,
int momin,
int damin,
int homin,
int mimin,
int semin,
333 int yemax,
int momax,
int damax,
int homax,
int mimax,
int semax);
342 bool contains(
const Datetime& dt)
const;
351 int print(FILE* out,
const char* end=
"\n")
const;
354 std::ostream& operator<<(std::ostream& out,
const DatetimeRange& dtr);
371 int lat = MISSING_INT;
377 int lon = MISSING_INT;
384 Coords(
double lat,
double lon);
387 bool is_missing()
const;
390 void set_lat(
double lat);
393 void set_lon(
double lon);
396 void set_lat(
int lat);
399 void set_lon(
int lon);
402 void set(
int lat,
int lon);
405 void set(
double lat,
double lon);
423 int compare(
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;
428 bool operator>(
const Coords& o)
const;
429 bool operator<=(
const Coords& o)
const;
430 bool operator>=(
const Coords& o)
const;
433 int print(FILE* out,
const char* end=
"\n")
const;
436 std::string to_string(
const char* undef=
"-")
const;
439 static int lat_to_int(
double lat);
442 static int lon_to_int(
double lat);
445 static double lat_from_int(
int lat);
448 static double lon_from_int(
int lon);
451 std::ostream& operator<<(std::ostream&,
const Coords&);
470 static constexpr
int IMIN = -9000000;
472 static constexpr
int IMAX = 9000000;
474 static constexpr
double DMIN = -90.0;
476 static constexpr
double DMAX = 90.0;
490 bool operator==(
const LatRange& lr)
const;
491 bool operator!=(
const LatRange& lr)
const;
494 bool is_missing()
const;
503 void get(
double& min,
double& max)
const;
506 void set(
int min,
int max);
509 void set(
double min,
double max);
512 bool contains(
int lat)
const;
515 bool contains(
double lat)
const;
518 bool contains(
const LatRange& lr)
const;
526 int print(FILE* out,
const char* end=
"\n")
const;
529 std::ostream& operator<<(std::ostream& out,
const LatRange& lr);
554 int imin = MISSING_INT;
556 int imax = MISSING_INT;
565 bool operator==(
const LonRange& lr)
const;
566 bool operator!=(
const LonRange& lr)
const;
569 bool is_missing()
const;
582 void get(
double& min,
double& max)
const;
588 void set(
int min,
int max);
594 void set(
double min,
double max);
603 bool contains(
int lon)
const;
606 bool contains(
double lon)
const;
609 bool contains(
const LonRange& lr)
const;
617 int print(FILE* out,
const char* end=
"\n")
const;
620 std::ostream& operator<<(std::ostream& out,
const LonRange& lr);
635 Level(
int ltype1=MISSING_INT,
int l1=MISSING_INT,
int ltype2=MISSING_INT,
int l2=MISSING_INT)
636 : ltype1(ltype1), l1(l1), ltype2(ltype2), l2(l2) {}
639 bool is_missing()
const;
641 bool operator==(
const Level& o)
const;
642 bool operator!=(
const Level& o)
const;
643 bool operator<(
const Level& o)
const;
644 bool operator>(
const Level& o)
const;
645 bool operator<=(
const Level& o)
const;
646 bool operator>=(
const Level& o)
const;
655 int compare(
const Level& l)
const;
660 std::string describe()
const;
663 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
666 std::string to_string(
const char* undef=
"-")
const;
674 static Level cloud(
int ltype2=MISSING_INT,
int l2=MISSING_INT);
677 int print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
680 std::ostream& operator<<(std::ostream& out,
const Level& l);
695 Trange(
int pind=MISSING_INT,
int p1=MISSING_INT,
int p2=MISSING_INT)
696 : pind(pind), p1(p1), p2(p2) {}
699 bool is_missing()
const;
708 int compare(
const Trange& t)
const;
710 bool operator==(
const Trange& o)
const;
711 bool operator!=(
const Trange& o)
const;
712 bool operator<(
const Trange& o)
const;
713 bool operator>(
const Trange& o)
const;
714 bool operator<=(
const Trange& o)
const;
715 bool operator>=(
const Trange& o)
const;
720 std::string describe()
const;
723 void to_stream(std::ostream& out,
const char* undef=
"-")
const;
726 std::string to_string(
const char* undef=
"-")
const;
737 int print(FILE* out,
const char* undef=
"-",
const char* end=
"\n")
const;
740 std::ostream& operator<<(std::ostream& out,
const Trange& l);
750 char* value =
nullptr;
754 Ident(
const char* value);
755 Ident(
const std::string& value);
761 Ident& operator=(
const char* o);
762 Ident& operator=(
const std::string& o);
765 const char*
get()
const {
return value; }
770 int compare(
const Ident& o)
const;
771 int compare(
const char* o)
const;
772 int compare(
const std::string& o)
const;
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; }
776 template<
typename T>
bool operator<=(
const T& o)
const {
return compare(o) <= 0; }
777 template<
typename T>
bool operator>(
const T& o)
const {
return compare(o) > 0; }
778 template<
typename T>
bool operator>=(
const T& o)
const {
return compare(o) >= 0; }
781 bool is_missing()
const;
783 operator const char*()
const {
return value; }
784 operator std::string()
const;
787 std::ostream& operator<<(std::ostream&,
const Ident&);
808 bool is_missing()
const;
810 bool operator==(
const Station& o)
const 814 bool operator!=(
const Station& o)
const 818 bool operator<(
const Station& o)
const 822 bool operator<=(
const Station& o)
const 826 bool operator>(
const Station& o)
const 830 bool operator>=(
const Station& o)
const 841 int print(FILE* out,
const char* end=
"\n")
const;
844 std::string to_string(
const char* undef=
"-")
const;
847 std::ostream& operator<<(std::ostream&,
const Station&);
857 int id = MISSING_INT;
863 bool is_missing()
const;
865 bool operator==(
const DBStation& o)
const 869 bool operator!=(
const DBStation& o)
const 877 bool operator<=(
const DBStation& o)
const 885 bool operator>=(
const DBStation& o)
const 896 int print(FILE* out,
const char* end=
"\n")
const;
899 std::string to_string(
const char* undef=
"-")
const;
902 std::ostream& operator<<(std::ostream&,
const DBStation&);
911 typedef size_t result_type;
912 result_type operator()(argument_type
const& o)
const noexcept;
918 typedef size_t result_type;
919 result_type operator()(argument_type
const& o)
const noexcept;
925 typedef size_t result_type;
926 result_type operator()(argument_type
const& o)
const noexcept;
932 typedef size_t result_type;
933 result_type operator()(argument_type
const& o)
const noexcept;
939 typedef size_t result_type;
940 result_type operator()(argument_type
const& o)
const noexcept;
943 template<>
struct hash<
dballe::DBStation>
946 typedef size_t result_type;
947 result_type operator()(argument_type
const& o)
const noexcept;
int ltype1
Type of the level or the first layer.
Definition: types.h:627
int ltype2
Type of the the second layer.
Definition: types.h:631
Ident ident
Mobile station identifier.
Definition: types.h:802
Station information.
Definition: types.h:793
Calendar date.
Definition: types.h:27
Coords coords
Station coordinates.
Definition: types.h:799
Coordinates.
Definition: types.h:368
int p1
Time range P1 indicator.
Definition: types.h:691
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:686
int pind
Time range type indicator.
Definition: types.h:689
Vertical level or layer.
Definition: types.h:624
A station identifier, that can be any string (including the empty string) or a missing value...
Definition: types.h:747
int l2
L2 value of the second layer.
Definition: types.h:633
Range of datetimes.
Definition: types.h:294
Datetime max
Upper bound of the range.
Definition: types.h:299
std::string report
Report name for this station.
Definition: types.h:796
int id
Database ID of the station.
Definition: types.h:857
Range of latitudes.
Definition: types.h:467
Time of the day.
Definition: types.h:99
Datetime min
Lower bound of the range.
Definition: types.h:297
Date and time.
Definition: types.h:164
Range of longitudes.
Definition: types.h:551
int l1
L1 value of the level or the first layer.
Definition: types.h:629
int p2
Time range P2 indicator.
Definition: types.h:693