version  0.0.1
Defines the C++ API for MsPASS
CoreTimeSeries.h
1 #ifndef _MSPASS_CORETIMESERIES_H_
2 #define _MSPASS_CORETIMESERIES_H_
3 #include <vector>
4 #include "mspass/seismic/BasicTimeSeries.h"
5 #include "mspass/utility/Metadata.h"
6 
7 namespace mspass::seismic{
18 {
19 public:
28  std::vector<double>s;
43  CoreTimeSeries(const size_t nsin);
44  virtual ~CoreTimeSeries(){};
54  CoreTimeSeries(const BasicTimeSeries& bts,const Metadata& md);
59  /* These overload virtual methods in BasicTimeSeries. */
72  void set_dt(const double sample_interval);
94  void set_npts(const size_t npts);
101  void sync_npts();
118  void set_t0(const double t0in);
119 /* Depricated in 2020 API change - no longer needed with new BasicTimeSeries.
120 Returns the end time (time associated with last data sample)
121 of this data object.
122 
123 */
124 /*
125  double endtime()const noexcept
126  {
127  return(mt0+mdt*static_cast<double>(s.size()-1));
128  };
129 */
133  CoreTimeSeries& operator=(const CoreTimeSeries& parent);
158  const CoreTimeSeries operator+(const CoreTimeSeries& other) const;
159 
161  CoreTimeSeries& operator*=(const double);
186  const CoreTimeSeries operator-(const CoreTimeSeries& other) const;
198  double operator[](size_t const sample) const;
199 };
200 } // End mspass::seismic namespace
201 #endif //end guard
Base class for time series objects.
Definition: BasicTimeSeries.h:35
size_t npts() const
Definition: BasicTimeSeries.h:183
Scalar time series data object.
Definition: CoreTimeSeries.h:18
CoreTimeSeries()
Definition: CoreTimeSeries.cc:15
CoreTimeSeries & operator=(const CoreTimeSeries &parent)
Definition: CoreTimeSeries.cc:66
const CoreTimeSeries operator+(const CoreTimeSeries &other) const
Definition: CoreTimeSeries.cc:168
const CoreTimeSeries operator-(const CoreTimeSeries &other) const
Definition: CoreTimeSeries.cc:174
double operator[](size_t const sample) const
Definition: CoreTimeSeries.cc:271
void set_dt(const double sample_interval)
Set the sample interval.
Definition: CoreTimeSeries.cc:185
CoreTimeSeries & operator*=(const double)
Definition: CoreTimeSeries.cc:180
CoreTimeSeries & operator+=(const CoreTimeSeries &d)
Summation operator.
Definition: CoreTimeSeries.cc:78
std::vector< double > s
Definition: CoreTimeSeries.h:28
void sync_npts()
Sync the number of samples attribute with actual data size.
Definition: CoreTimeSeries.cc:248
void set_npts(const size_t npts)
Set the number of samples attribute for data.
Definition: CoreTimeSeries.cc:222
void set_t0(const double t0in)
Set the data start time.
Definition: CoreTimeSeries.cc:203
CoreTimeSeries & operator-=(const CoreTimeSeries &d)
Subtraction operator.
Definition: CoreTimeSeries.cc:125
Definition: Metadata.h:76
Define metadata keys.
Definition: BasicSpectrum.h:6