libdballe 9.6
Public Member Functions | Public Attributes | List of all members
dballe::DatetimeRange Struct Reference

Range of datetimes. More...

#include <types.h>

Public Member Functions

 DatetimeRange (const Datetime &min, const Datetime &max)
 
 DatetimeRange (int yemin, int momin, int damin, int homin, int mimin, int semin, int yemax, int momax, int damax, int homax, int mimax, int semax)
 
bool is_missing () const
 Check if this range is open on both sides.
 
bool operator== (const DatetimeRange &o) const
 
bool operator!= (const DatetimeRange &o) const
 
bool operator< (const DatetimeRange &o) const
 
bool operator<= (const DatetimeRange &o) const
 
bool operator> (const DatetimeRange &o) const
 
bool operator>= (const DatetimeRange &o) const
 
void set (const Datetime &min, const Datetime &max)
 Set the extremes.
 
void set (int yemin, int momin, int damin, int homin, int mimin, int semin, int yemax, int momax, int damax, int homax, int mimax, int semax)
 Set the extremes from broken down components.
 
void merge (const DatetimeRange &range)
 Merge range into this one, resulting in the smallest range that contains both.
 
bool contains (const Datetime &dt) const
 Check if a Datetime is inside this range.
 
bool contains (const DatetimeRange &dtr) const
 Check if a range is inside this range (extremes included)
 
bool is_disjoint (const DatetimeRange &dtr) const
 Check if the two ranges are completely disjoint.
 
int print (FILE *out, const char *end="\n") const
 Print to an output stream in ISO8601 combined format.
 

Public Attributes

Datetime min
 Lower bound of the range.
 
Datetime max
 Upper bound of the range.
 

Detailed Description

Range of datetimes.

The range includes the extremes. A missing extreme in the range means an open ended range.

Member Function Documentation

◆ set()

void dballe::DatetimeRange::set ( int  yemin,
int  momin,
int  damin,
int  homin,
int  mimin,
int  semin,
int  yemax,
int  momax,
int  damax,
int  homax,
int  mimax,
int  semax 
)

Set the extremes from broken down components.

If yemin or yemax are MISSING_INT, they are taken as an open ended range boundary.

If any other *min values are MISSING_INT, they are filled with the lowest possible valid value they can have.

If any other *max values are MISSING_INT, they are filled with the highest possible valid value they can have.


The documentation for this struct was generated from the following file: