version  0.0.1
Defines the C++ API for MsPASS
Public Member Functions | Public Attributes | List of all members
mspass::seismic::Ensemble< Tdata > Class Template Reference
Inheritance diagram for mspass::seismic::Ensemble< Tdata >:
mspass::utility::Metadata mspass::utility::BasicMetadata

Public Member Functions

 Ensemble ()
 
 Ensemble (const size_t n)
 Reserve space but build empty ensemble. More...
 
 Ensemble (const mspass::utility::Metadata &md, const size_t n)
 
 Ensemble (const Ensemble &parent)
 
Ensembleoperator= (const Ensemble &parent)
 
Tdata & operator[] (const size_t n) const try
 
 catch (...)
 
void update_metadata (const mspass::utility::Metadata &newmd) try
 updates ensemble header (Metadata). More...
 
 catch (...)
 
void sync_metadata ()
 copy ensemble metadata to all members. More...
 
void sync_metadata (std::vector< std::string > exclude)
 copy ensemble metadata to all members except for the ones excluded.
 

Public Attributes

std::vector< Tdata > member
 Container holding data objects. More...
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ Ensemble() [1/4]

template<typename Tdata >
mspass::seismic::Ensemble< Tdata >::Ensemble ( )
inline

Default constructor.

23 {};

◆ Ensemble() [2/4]

template<typename Tdata >
mspass::seismic::Ensemble< Tdata >::Ensemble ( const size_t  n)
inline

Reserve space but build empty ensemble.

Often we know what the size of an ensemble is before we start building it. This constructor reserve space but marks all members dead.

Parameters
-expected number of members.
32 {member.reserve(n);};
std::vector< Tdata > member
Container holding data objects.
Definition: Ensemble.h:21

References mspass::seismic::Ensemble< Tdata >::member.

◆ Ensemble() [3/4]

template<typename Tdata >
mspass::seismic::Ensemble< Tdata >::Ensemble ( const mspass::utility::Metadata md,
const size_t  n 
)
inline

Partial constructor to clone metadata and set aside n slots but no data

35  {
36  member.reserve(n);
37  };
Definition: Metadata.h:76

References mspass::seismic::Ensemble< Tdata >::member.

◆ Ensemble() [4/4]

template<typename Tdata >
mspass::seismic::Ensemble< Tdata >::Ensemble ( const Ensemble< Tdata > &  parent)
inline

Standard copy constructor.

39  : mspass::utility::Metadata(dynamic_cast<const mspass::utility::Metadata&>(parent)),
40  member(parent.member){};

Member Function Documentation

◆ operator=()

template<typename Tdata >
Ensemble& mspass::seismic::Ensemble< Tdata >::operator= ( const Ensemble< Tdata > &  parent)
inline

Standard assignment operator.

43  {
44  if(this!=(&parent))
45  {
46  this->Metadata::operator=(parent);
47  member=parent.member;
48  }
49  return *this;
50  };
Metadata & operator=(const Metadata &mdold)
Definition: Metadata.cc:108

References mspass::seismic::Ensemble< Tdata >::member, and mspass::utility::Metadata::operator=().

◆ sync_metadata()

template<typename Tdata >
void mspass::seismic::Ensemble< Tdata >::sync_metadata ( )
inline

copy ensemble metadata to all members.

An ensemble has global metadata, but each member is required to have a metadata component. This method takes the ensemble metadata and copies it to each of the member objects. The operation will overwrite previous key:value pairs in a member that are also present in the ensemble metadata.

92  {
93  size_t i;
94  for(i=0;i<this->member.size();++i)
95  {
96  mspass::utility::Metadata *mdmember=&(this->member[i]);
97  (*mdmember)+=dynamic_cast<mspass::utility::Metadata&>(*this);
98  }
99  };

◆ update_metadata()

template<typename Tdata >
void mspass::seismic::Ensemble< Tdata >::update_metadata ( const mspass::utility::Metadata newmd)
inline

updates ensemble header (Metadata).

Sometime it is helpful to change a group of header attributes stored in the Metadata component. Rather than do a bunch of puts this uses operator += to update the header. Note this operator uses the property that any existing attributes with the same key as one in the updates set will be replaced with the update.

Parameters
newmdcontains new Metadata to use for updates.
78  {
80  md=dynamic_cast<mspass::utility::Metadata*>(this);
81  (*md) += newmd;
82  }catch(...){throw;};

Member Data Documentation

◆ member

template<typename Tdata >
std::vector<Tdata> mspass::seismic::Ensemble< Tdata >::member

Container holding data objects.

An ensemble is defined as a collection of data objects linked by some property that is normally defined by data sharing a comomon data-value pair. The data are stored here in a vector container. We make this vector public because the assumption is the member objects can be large and copying with a getter would be a serious inefficiently.


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