1 #ifndef _MSPASS_ENSEMBLE_H_
2 #define _MSPASS_ENSEMBLE_H_
4 #include "mspass/seismic/TimeSeries.h"
5 #include "mspass/seismic/Seismogram.h"
6 #include "mspass/utility/memory_constants.h"
62 Tdata& operator[](
const size_t n)
const
64 return(this->member[n]);
94 for(i=0;i<this->member.size();++i)
105 for (
size_t i = 0; i < exclude.size(); i++)
108 sync_md.
erase(exclude[i]);
111 for (
size_t i = 0; i < this->member.size(); ++i)
114 (*mdmember) += sync_md;
149 ensemble_is_live=
false;
165 ensemble_is_live=
false;
178 ensemble_is_live=
false;
195 ensemble_is_live=parent.ensemble_is_live;
201 ensemble_is_live=
true;
204 void kill(){ensemble_is_live=
false;};
206 bool live()
const {
return ensemble_is_live;};
208 bool dead()
const {
return !ensemble_is_live;};
227 ensemble_is_live=
true;
240 this->member.reserve(parent.
member.size());
241 this->member=parent.
member;
243 ensemble_is_live=parent.ensemble_is_live;
247 size_t memory_use()
const
250 memuse =
sizeof(*this);
251 for(
auto p=this->member.begin();p!=this->member.end();++p)
253 memuse += p->memory_use();
258 memuse += mspass::utility::memory_constants::MD_AVERAGE_SIZE*this->md.size();
259 memuse += mspass::utility::memory_constants::KEY_AVERAGE_SIZE*this->changed_or_set.size();
261 memuse += mspass::utility::memory_constants::ELOG_AVERAGE_SIZE*this->elog.size();
266 bool ensemble_is_live;
271 for(
auto dptr=this->member.begin();dptr!=this->member.end();++dptr)
273 if(dptr->live())
return true;
Definition: Ensemble.h:10
Ensemble()
Definition: Ensemble.h:23
void sync_metadata(std::vector< std::string > exclude)
copy ensemble metadata to all members except for the ones excluded.
Definition: Ensemble.h:102
std::vector< Tdata > member
Container holding data objects.
Definition: Ensemble.h:21
void update_metadata(const mspass::utility::Metadata &newmd) try
updates ensemble header (Metadata).
Definition: Ensemble.h:77
void sync_metadata()
copy ensemble metadata to all members.
Definition: Ensemble.h:91
Ensemble & operator=(const Ensemble &parent)
Definition: Ensemble.h:42
Ensemble(const size_t n)
Reserve space but build empty ensemble.
Definition: Ensemble.h:32
Ensemble(const mspass::utility::Metadata &md, const size_t n)
Definition: Ensemble.h:34
Ensemble(const Ensemble &parent)
Definition: Ensemble.h:39
Template class that extends Ensemble to include an error log and live tests.
Definition: Ensemble.h:141
LoggingEnsemble(const Ensemble< T > &parent)
Definition: Ensemble.h:198
LoggingEnsemble(const mspass::utility::Metadata &md, const mspass::utility::ErrorLogger &elogin, const size_t ndata)
Definition: Ensemble.h:186
LoggingEnsemble(const mspass::utility::Metadata &md, const size_t n)
Definition: Ensemble.h:173
LoggingEnsemble()
Definition: Ensemble.h:147
void kill()
Definition: Ensemble.h:204
bool set_live()
Definition: Ensemble.h:224
bool validate()
Definition: Ensemble.h:269
mspass::utility::ErrorLogger elog
Definition: Ensemble.h:144
LoggingEnsemble(const size_t n)
Definition: Ensemble.h:163
bool live() const
Definition: Ensemble.h:206
LoggingEnsemble(const LoggingEnsemble< T > &parent)
Definition: Ensemble.h:192
LoggingEnsemble< T > & operator=(const LoggingEnsemble< T > &parent)
Definition: Ensemble.h:235
bool dead() const
Definition: Ensemble.h:208
Container to hold error logs for a data object.
Definition: ErrorLogger.h:61
Define metadata keys.
Definition: BasicSpectrum.h:6
Ensemble< TimeSeries > TimeSeriesEnsemble
Definition: Ensemble.h:279
Ensemble< Seismogram > ThreeComponentEnsemble
Definition: Ensemble.h:281