version  0.0.1
Defines the C++ API for MsPASS
DataGap.h
1 #ifndef _MSPASS_SEISMIC_DATAGAP_H_
2 #define _MSPASS_SEISMIC_DATAGAP_H_
3 #include <set>
4 #include <list>
5 #include "mspass/algorithms/TimeWindow.h"
6 
7 namespace mspass::seismic{
17 {
18 public:
19  bool operator()(const mspass::algorithms::TimeWindow ti1,
20  const mspass::algorithms::TimeWindow ti2) const
21  {return(ti1.end<ti2.start);};
22 };
23 
24 class DataGap
25 {
26 public:
28  DataGap(){};
30  DataGap(const std::list<mspass::algorithms::TimeWindow>& twlist);
31  DataGap(const DataGap& parent):gaps(parent.gaps){};
32  virtual ~DataGap(){};
39  bool is_gap(const double ttest); //query by time
49  bool has_gap(const mspass::algorithms::TimeWindow twin);
56  bool has_gap(){return(!gaps.empty());};
65  std::list<mspass::algorithms::TimeWindow> get_gaps() const;
75  void clear_gaps(){if(!gaps.empty())gaps.clear();};
77  int number_gaps() const{return gaps.size();};
95  void translate_origin(double time_of_new_origin);
97  DataGap& operator=(const DataGap& parent);
99  DataGap& operator+=(const DataGap& other);
100 protected:
106  std::set<mspass::algorithms::TimeWindow,mspass::algorithms::TimeWindowCmp> gaps;
107 };
108 } // End mspass::seismic namespace
109 #endif //end guard
Function object used for weak comparison to order TimeWindow objects.
Definition: TimeWindow.h:85
Defines a time window.
Definition: TimeWindow.h:14
double start
Definition: TimeWindow.h:19
double end
Definition: TimeWindow.h:23
Definition: DataGap.h:25
DataGap & operator=(const DataGap &parent)
Definition: DataGap.cc:105
void add_gap(const mspass::algorithms::TimeWindow tw)
Definition: DataGap.cc:14
std::set< mspass::algorithms::TimeWindow, mspass::algorithms::TimeWindowCmp > gaps
Holds data gap definitions. We use an STL set object to define data gaps for any time series object d...
Definition: DataGap.h:106
DataGap(const std::list< mspass::algorithms::TimeWindow > &twlist)
DataGap & operator+=(const DataGap &other)
Definition: DataGap.cc:113
void translate_origin(double time_of_new_origin)
Definition: DataGap.cc:91
void clear_gaps()
Clear gaps.
Definition: DataGap.h:75
bool has_gap()
Definition: DataGap.h:56
DataGap()
Definition: DataGap.h:28
int number_gaps() const
Definition: DataGap.h:77
std::list< mspass::algorithms::TimeWindow > get_gaps() const
Definition: DataGap.cc:57
bool is_gap(const double ttest)
Definition: DataGap.cc:36
DataGap subset(const mspass::algorithms::TimeWindow tw) const
Definition: DataGap.cc:64
Define metadata keys.
Definition: BasicSpectrum.h:6