|
MsPASS C++ API
2.4.1.dev4+g92330b7a
Defines the C++ API for MsPASS
|
Metadata-bearing container for a collection of seismic data objects. More...
#include <Ensemble.h>


Public Member Functions | |
| Ensemble () | |
| Ensemble (const size_t n) | |
| Reserve space but build empty ensemble. | |
| Ensemble (const mspass::utility::Metadata &md, const size_t n) | |
| Ensemble (const Ensemble &parent) | |
| Ensemble & | operator= (const Ensemble &parent) |
| Tdata & | operator[] (const size_t n) const |
| Indexing operator. | |
| void | update_metadata (const mspass::utility::Metadata &newmd) |
| updates ensemble header (Metadata). | |
| void | sync_metadata () |
| copy ensemble metadata to all members. | |
| void | sync_metadata (std::vector< std::string > exclude) |
| copy ensemble metadata to all members except for the ones excluded. | |
Public Member Functions inherited from mspass::utility::Metadata | |
| Metadata () | |
| Metadata (std::ifstream &ifs, const std::string form=std::string("pf")) | |
| Metadata (const Metadata &mdold) | |
| virtual | ~Metadata () |
| Metadata & | operator= (const Metadata &mdold) |
| Metadata & | operator+= (const Metadata &rhs) noexcept |
| const Metadata | operator+ (const Metadata &other) const |
| double | get_double (const std::string key) const override |
| int | get_int (const std::string key) const override |
| long | get_long (const std::string key) const |
| std::string | get_string (const std::string key) const override |
| bool | get_bool (const std::string key) const override |
| template<typename T > | |
| T | get (const std::string key) const |
| template<typename T > | |
| T | get (const char *key) const |
| Generic get interface for C char array. | |
| boost::any | get_any (const std::string key) const |
| std::string | type (const std::string key) const |
| template<typename T > | |
| void | put (const std::string key, T val) noexcept |
| template<typename T > | |
| void | put (const char *key, T val) noexcept |
| void | put (const std::string key, const double val) override |
| void | put (const std::string key, const int val) override |
| void | put (const std::string key, const bool val) override |
| void | put (const std::string key, const std::string val) override |
| void | put (const char *key, const char *val) |
| void | put (std::string key, const char *val) |
| void | put_object (const std::string key, const pybind11::object val) |
| void | put_int (const std::string key, const int val) |
| void | put_string (const std::string key, const std::string val) |
| void | put_bool (const std::string key, const bool val) |
| void | put_double (const std::string key, const double val) |
| void | put_long (const std::string key, const long val) |
| void | append_chain (const std::string key, const std::string val, const std::string separator=std::string(":")) |
| std::set< std::string > | modified () const |
| void | clear_modified () |
| Mark all data as unmodified. | |
| std::set< std::string > | keys () const noexcept |
| bool | is_defined (const std::string key) const noexcept |
| void | erase (const std::string key) |
| std::size_t | size () const noexcept |
| std::map< std::string, boost::any >::const_iterator | begin () const noexcept |
| std::map< std::string, boost::any >::const_iterator | end () const noexcept |
| void | change_key (const std::string oldkey, const std::string newkey) |
| Change the keyword to access an attribute. | |
| template<> | |
| double | get (const std::string key) const |
| template<> | |
| int | get (const std::string key) const |
| template<> | |
| long | get (const std::string key) const |
| template<> | |
| bool | get (const std::string key) const |
| template<> | |
| float | get (const std::string key) const |
| template<> | |
| double | get (const string key) const |
| template<> | |
| int | get (const string key) const |
| template<> | |
| long | get (const string key) const |
| template<> | |
| bool | get (const string key) const |
| template<> | |
| float | get (const string key) const |
Public Member Functions inherited from mspass::utility::BasicMetadata | |
| virtual | ~BasicMetadata () |
Public Attributes | |
| std::vector< Tdata > | member |
| Container holding data objects. | |
Additional Inherited Members | |
Protected Attributes inherited from mspass::utility::Metadata | |
| std::map< std::string, boost::any > | md |
| std::set< std::string > | changed_or_set |
Metadata-bearing container for a collection of seismic data objects.
The template is used for scalar and three-component ensembles whose members share common Metadata stored on the ensemble header.
|
inline |
Default constructor.
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.
| n | expected number of members. |
References mspass::seismic::Ensemble< Tdata >::member.
|
inline |
Partial constructor to clone metadata and set aside n slots but no data
References mspass::seismic::Ensemble< Tdata >::member.
|
inline |
Standard copy constructor.
|
inline |
Standard assignment operator.
References mspass::seismic::Ensemble< Tdata >::member, and mspass::utility::Metadata::operator=().
|
inline |
Indexing operator.
This is the indexing operator used to extract an ensemble member with a (simpler) construct like x=e[i] as opposed to x=e.member[i]. The later is possible because we (intionally) make the member Container public, but this operator can be used to write code that follows common guidelines to not make data public. It will be used for the python interface.
| n | is the member to be extracted and returned. |
|
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.
|
inline |
copy ensemble metadata to all members except for the ones excluded.
References mspass::utility::Metadata::erase(), and mspass::utility::Metadata::is_defined().
|
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.
| newmd | contains new Metadata to use for updates. |
References mspass::utility::Metadata::md.
| 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.