[installation] Init with inital config for global
This commit is contained in:
194
include/seiscomp/datamodel/access.h
Normal file
194
include/seiscomp/datamodel/access.h
Normal file
@ -0,0 +1,194 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ACCESS_H
|
||||
#define SEISCOMP_DATAMODEL_ACCESS_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Access);
|
||||
|
||||
class Routing;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AccessIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AccessIndex();
|
||||
AccessIndex(const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& streamCode,
|
||||
const std::string& user,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
AccessIndex(const AccessIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const AccessIndex&) const;
|
||||
bool operator!=(const AccessIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string networkCode;
|
||||
std::string stationCode;
|
||||
std::string locationCode;
|
||||
std::string streamCode;
|
||||
std::string user;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes an ArcLink access rule
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Access : public Object {
|
||||
DECLARE_SC_CLASS(Access)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Access();
|
||||
|
||||
//! Copy constructor
|
||||
Access(const Access& other);
|
||||
|
||||
//! Destructor
|
||||
~Access() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Access& operator=(const Access& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Access& other) const;
|
||||
bool operator!=(const Access& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Access& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Network code
|
||||
void setNetworkCode(const std::string& networkCode);
|
||||
const std::string& networkCode() const;
|
||||
|
||||
//! Station code (empty for any station)
|
||||
void setStationCode(const std::string& stationCode);
|
||||
const std::string& stationCode() const;
|
||||
|
||||
//! Location code (empty for any location)
|
||||
void setLocationCode(const std::string& locationCode);
|
||||
const std::string& locationCode() const;
|
||||
|
||||
//! Stream (Channel) code (empty for any stream)
|
||||
void setStreamCode(const std::string& streamCode);
|
||||
const std::string& streamCode() const;
|
||||
|
||||
//! Username (e-mail) or part of it (must match the end)
|
||||
void setUser(const std::string& user);
|
||||
const std::string& user() const;
|
||||
|
||||
//! Start of validity
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of validity
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const AccessIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Access* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Routing* routing() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
AccessIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
313
include/seiscomp/datamodel/amplitude.h
Normal file
313
include/seiscomp/datamodel/amplitude.h
Normal file
@ -0,0 +1,313 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AMPLITUDE_H
|
||||
#define SEISCOMP_DATAMODEL_AMPLITUDE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/timewindow.h>
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <seiscomp/datamodel/timequantity.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Amplitude);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class represents a quantification of the waveform
|
||||
* \brief anomaly, usually
|
||||
* \brief a single amplitude measurement or a measurement of the
|
||||
* \brief visible signal
|
||||
* \brief duration for duration magnitudes.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Amplitude : public PublicObject {
|
||||
DECLARE_SC_CLASS(Amplitude)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Amplitude();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Amplitude(const Amplitude& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Amplitude(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Amplitude() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Amplitude* Create();
|
||||
static Amplitude* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Amplitude* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Amplitude& operator=(const Amplitude& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Amplitude& other) const;
|
||||
bool operator!=(const Amplitude& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Amplitude& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! String that describes the type of amplitude using the
|
||||
//! nomenclature
|
||||
//! from Storchak et al. (2003). Possible values include
|
||||
//! unspecified
|
||||
//! amplitude reading (A), amplitude reading for local
|
||||
//! magnitude (ML),
|
||||
//! amplitude reading for body wave magnitude (MB), amplitude
|
||||
//! reading
|
||||
//! for surface wave magnitude (MS), and time of visible end of
|
||||
//! record
|
||||
//! for duration magnitude (MD). It has a maximum length of 16
|
||||
//! characters.
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
//! Measured amplitude value for the given waveformID. Note
|
||||
//! that this
|
||||
//! attribute can describe different physical quantities,
|
||||
//! depending on
|
||||
//! the type of the amplitude. These can be, e.g.,
|
||||
//! displacement, velocity,
|
||||
//! or a period. If the only amplitude information is a period,
|
||||
//! it has
|
||||
//! to specified here, not in the period attribute. The latter
|
||||
//! can be used
|
||||
//! if the amplitude measurement contains information on, e.g.,
|
||||
//! displacement and an additional period. Since the physical
|
||||
//! quantity
|
||||
//! described by this attribute is not fixed, the unit of
|
||||
//! measurement
|
||||
//! cannot be defined in advance. However, the quantity has to
|
||||
//! be
|
||||
//! specified in SI base units. The enumeration given in
|
||||
//! attribute unit
|
||||
//! provides the most likely units that could be needed here.
|
||||
//! For clarity, using the optional unit attribute is highly
|
||||
//! encouraged.
|
||||
void setAmplitude(const OPT(RealQuantity)& amplitude);
|
||||
RealQuantity& amplitude();
|
||||
const RealQuantity& amplitude() const;
|
||||
|
||||
//! Description of the time window used for amplitude
|
||||
//! measurement.
|
||||
//! Recommended for duration magnitudes.
|
||||
void setTimeWindow(const OPT(TimeWindow)& timeWindow);
|
||||
TimeWindow& timeWindow();
|
||||
const TimeWindow& timeWindow() const;
|
||||
|
||||
//! Dominant period in the timeWindow in case of amplitude
|
||||
//! measurements.
|
||||
//! Not used for duration magnitude. The unit is seconds.
|
||||
void setPeriod(const OPT(RealQuantity)& period);
|
||||
RealQuantity& period();
|
||||
const RealQuantity& period() const;
|
||||
|
||||
//! Signal-to-noise ratio of the spectrogram at the location
|
||||
//! the amplitude was measured.
|
||||
void setSnr(const OPT(double)& snr);
|
||||
double snr() const;
|
||||
|
||||
//! This attribute provides the most likely measurement units
|
||||
//! for the
|
||||
//! physical quantity described in the amplitude attribute.
|
||||
//! Possible values are specified as combinations of SI base
|
||||
//! units.
|
||||
void setUnit(const std::string& unit);
|
||||
const std::string& unit() const;
|
||||
|
||||
//! Refers to the publicID of an associated Pick object.
|
||||
void setPickID(const std::string& pickID);
|
||||
const std::string& pickID() const;
|
||||
|
||||
//! Identifies the waveform stream on which the amplitude was
|
||||
//! measured.
|
||||
void setWaveformID(const OPT(WaveformStreamID)& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
//! Identifies the filter or filter setup used for filtering
|
||||
//! the waveform stream referenced by waveformID.
|
||||
void setFilterID(const std::string& filterID);
|
||||
const std::string& filterID() const;
|
||||
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Scaling time for amplitude measurement.
|
||||
void setScalingTime(const OPT(TimeQuantity)& scalingTime);
|
||||
TimeQuantity& scalingTime();
|
||||
const TimeQuantity& scalingTime() const;
|
||||
|
||||
//! Type of magnitude the amplitude measurement is used for.
|
||||
//! For valid
|
||||
//! values see class Magnitude. String value with a maximum
|
||||
//! length of
|
||||
//! 16 characters.
|
||||
void setMagnitudeHint(const std::string& magnitudeHint);
|
||||
const std::string& magnitudeHint() const;
|
||||
|
||||
//! Evaluation mode of Amplitude.
|
||||
void setEvaluationMode(const OPT(EvaluationMode)& evaluationMode);
|
||||
EvaluationMode evaluationMode() const;
|
||||
|
||||
//! CreationInfo for the Amplitude object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _type;
|
||||
OPT(RealQuantity) _amplitude;
|
||||
OPT(TimeWindow) _timeWindow;
|
||||
OPT(RealQuantity) _period;
|
||||
OPT(double) _snr;
|
||||
std::string _unit;
|
||||
std::string _pickID;
|
||||
OPT(WaveformStreamID) _waveformID;
|
||||
std::string _filterID;
|
||||
std::string _methodID;
|
||||
OPT(TimeQuantity) _scalingTime;
|
||||
std::string _magnitudeHint;
|
||||
OPT(EvaluationMode) _evaluationMode;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Amplitude);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
155
include/seiscomp/datamodel/amplitudereference.h
Normal file
155
include/seiscomp/datamodel/amplitudereference.h
Normal file
@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AMPLITUDEREFERENCE_H
|
||||
#define SEISCOMP_DATAMODEL_AMPLITUDEREFERENCE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(AmplitudeReference);
|
||||
|
||||
class Reading;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AmplitudeReferenceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AmplitudeReferenceIndex();
|
||||
AmplitudeReferenceIndex(const std::string& amplitudeID);
|
||||
|
||||
//! Copy constructor
|
||||
AmplitudeReferenceIndex(const AmplitudeReferenceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const AmplitudeReferenceIndex&) const;
|
||||
bool operator!=(const AmplitudeReferenceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string amplitudeID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AmplitudeReference : public Object {
|
||||
DECLARE_SC_CLASS(AmplitudeReference)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AmplitudeReference();
|
||||
|
||||
//! Copy constructor
|
||||
AmplitudeReference(const AmplitudeReference& other);
|
||||
|
||||
//! Custom constructor
|
||||
AmplitudeReference(const std::string& amplitudeID);
|
||||
|
||||
//! Destructor
|
||||
~AmplitudeReference() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
AmplitudeReference& operator=(const AmplitudeReference& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const AmplitudeReference& other) const;
|
||||
bool operator!=(const AmplitudeReference& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const AmplitudeReference& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setAmplitudeID(const std::string& amplitudeID);
|
||||
const std::string& amplitudeID() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const AmplitudeReferenceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const AmplitudeReference* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Reading* reading() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
AmplitudeReferenceIndex _index;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
160
include/seiscomp/datamodel/arclinklog.h
Normal file
160
include/seiscomp/datamodel/arclinklog.h
Normal file
@ -0,0 +1,160 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKLOG_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKLOG_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/arclinkrequest.h>
|
||||
#include <seiscomp/datamodel/arclinkuser.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkLog);
|
||||
DEFINE_SMARTPOINTER(ArclinkRequest);
|
||||
DEFINE_SMARTPOINTER(ArclinkUser);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkLog : public PublicObject {
|
||||
DECLARE_SC_CLASS(ArclinkLog)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkLog();
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkLog(const ArclinkLog& other);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkLog() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ArclinkLog& operator=(const ArclinkLog& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkLog& other) const;
|
||||
bool operator!=(const ArclinkLog& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkLog& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(ArclinkRequest* obj);
|
||||
bool add(ArclinkUser* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(ArclinkRequest* obj);
|
||||
bool remove(ArclinkUser* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeArclinkRequest(size_t i);
|
||||
bool removeArclinkRequest(const ArclinkRequestIndex& i);
|
||||
bool removeArclinkUser(size_t i);
|
||||
bool removeArclinkUser(const ArclinkUserIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t arclinkRequestCount() const;
|
||||
size_t arclinkUserCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
ArclinkRequest* arclinkRequest(size_t i) const;
|
||||
ArclinkRequest* arclinkRequest(const ArclinkRequestIndex& i) const;
|
||||
|
||||
ArclinkUser* arclinkUser(size_t i) const;
|
||||
ArclinkUser* arclinkUser(const ArclinkUserIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
ArclinkRequest* findArclinkRequest(const std::string& publicID) const;
|
||||
ArclinkUser* findArclinkUser(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<ArclinkRequestPtr> _arclinkRequests;
|
||||
std::vector<ArclinkUserPtr> _arclinkUsers;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ArclinkLog);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
32
include/seiscomp/datamodel/arclinklog_package.h
Normal file
32
include/seiscomp/datamodel/arclinklog_package.h
Normal file
@ -0,0 +1,32 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKLOG_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKLOG_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/arclinkuser.h>
|
||||
#include <seiscomp/datamodel/arclinkstatusline.h>
|
||||
#include <seiscomp/datamodel/arclinkrequestline.h>
|
||||
#include <seiscomp/datamodel/arclinkrequest.h>
|
||||
#include <seiscomp/datamodel/arclinklog.h>
|
||||
|
||||
|
||||
#endif
|
||||
284
include/seiscomp/datamodel/arclinkrequest.h
Normal file
284
include/seiscomp/datamodel/arclinkrequest.h
Normal file
@ -0,0 +1,284 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKREQUEST_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKREQUEST_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/arclinkrequestsummary.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/arclinkstatusline.h>
|
||||
#include <seiscomp/datamodel/arclinkrequestline.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkRequest);
|
||||
DEFINE_SMARTPOINTER(ArclinkStatusLine);
|
||||
DEFINE_SMARTPOINTER(ArclinkRequestLine);
|
||||
|
||||
class ArclinkLog;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkRequestIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkRequestIndex();
|
||||
ArclinkRequestIndex(Seiscomp::Core::Time created,
|
||||
const std::string& requestID,
|
||||
const std::string& userID);
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkRequestIndex(const ArclinkRequestIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ArclinkRequestIndex&) const;
|
||||
bool operator!=(const ArclinkRequestIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Seiscomp::Core::Time created;
|
||||
std::string requestID;
|
||||
std::string userID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkRequest : public PublicObject {
|
||||
DECLARE_SC_CLASS(ArclinkRequest)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ArclinkRequest();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ArclinkRequest(const ArclinkRequest& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ArclinkRequest(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkRequest() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ArclinkRequest* Create();
|
||||
static ArclinkRequest* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ArclinkRequest* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ArclinkRequest& operator=(const ArclinkRequest& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkRequest& other) const;
|
||||
bool operator!=(const ArclinkRequest& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkRequest& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setRequestID(const std::string& requestID);
|
||||
const std::string& requestID() const;
|
||||
|
||||
void setUserID(const std::string& userID);
|
||||
const std::string& userID() const;
|
||||
|
||||
void setUserIP(const std::string& userIP);
|
||||
const std::string& userIP() const;
|
||||
|
||||
void setClientID(const std::string& clientID);
|
||||
const std::string& clientID() const;
|
||||
|
||||
void setClientIP(const std::string& clientIP);
|
||||
const std::string& clientIP() const;
|
||||
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
void setCreated(Seiscomp::Core::Time created);
|
||||
Seiscomp::Core::Time created() const;
|
||||
|
||||
void setStatus(const std::string& status);
|
||||
const std::string& status() const;
|
||||
|
||||
void setMessage(const std::string& message);
|
||||
const std::string& message() const;
|
||||
|
||||
void setLabel(const std::string& label);
|
||||
const std::string& label() const;
|
||||
|
||||
void setHeader(const std::string& header);
|
||||
const std::string& header() const;
|
||||
|
||||
void setSummary(const OPT(ArclinkRequestSummary)& summary);
|
||||
ArclinkRequestSummary& summary();
|
||||
const ArclinkRequestSummary& summary() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ArclinkRequestIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ArclinkRequest* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(ArclinkStatusLine* obj);
|
||||
bool add(ArclinkRequestLine* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(ArclinkStatusLine* obj);
|
||||
bool remove(ArclinkRequestLine* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeArclinkStatusLine(size_t i);
|
||||
bool removeArclinkStatusLine(const ArclinkStatusLineIndex& i);
|
||||
bool removeArclinkRequestLine(size_t i);
|
||||
bool removeArclinkRequestLine(const ArclinkRequestLineIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t arclinkStatusLineCount() const;
|
||||
size_t arclinkRequestLineCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
ArclinkStatusLine* arclinkStatusLine(size_t i) const;
|
||||
ArclinkStatusLine* arclinkStatusLine(const ArclinkStatusLineIndex& i) const;
|
||||
|
||||
ArclinkRequestLine* arclinkRequestLine(size_t i) const;
|
||||
ArclinkRequestLine* arclinkRequestLine(const ArclinkRequestLineIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
ArclinkLog* arclinkLog() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ArclinkRequestIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _userIP;
|
||||
std::string _clientID;
|
||||
std::string _clientIP;
|
||||
std::string _type;
|
||||
std::string _status;
|
||||
std::string _message;
|
||||
std::string _label;
|
||||
std::string _header;
|
||||
OPT(ArclinkRequestSummary) _summary;
|
||||
|
||||
// Aggregations
|
||||
std::vector<ArclinkStatusLinePtr> _arclinkStatusLines;
|
||||
std::vector<ArclinkRequestLinePtr> _arclinkRequestLines;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ArclinkRequest);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
189
include/seiscomp/datamodel/arclinkrequestline.h
Normal file
189
include/seiscomp/datamodel/arclinkrequestline.h
Normal file
@ -0,0 +1,189 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKREQUESTLINE_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKREQUESTLINE_H
|
||||
|
||||
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/arclinkstatusline.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkRequestLine);
|
||||
|
||||
class ArclinkRequest;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkRequestLineIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkRequestLineIndex();
|
||||
ArclinkRequestLineIndex(Seiscomp::Core::Time start,
|
||||
Seiscomp::Core::Time end,
|
||||
const WaveformStreamID& streamID);
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkRequestLineIndex(const ArclinkRequestLineIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ArclinkRequestLineIndex&) const;
|
||||
bool operator!=(const ArclinkRequestLineIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Seiscomp::Core::Time start;
|
||||
Seiscomp::Core::Time end;
|
||||
WaveformStreamID streamID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkRequestLine : public Object {
|
||||
DECLARE_SC_CLASS(ArclinkRequestLine)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkRequestLine();
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkRequestLine(const ArclinkRequestLine& other);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkRequestLine() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
ArclinkRequestLine& operator=(const ArclinkRequestLine& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkRequestLine& other) const;
|
||||
bool operator!=(const ArclinkRequestLine& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkRequestLine& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
void setEnd(Seiscomp::Core::Time end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
void setStreamID(const WaveformStreamID& streamID);
|
||||
WaveformStreamID& streamID();
|
||||
const WaveformStreamID& streamID() const;
|
||||
|
||||
void setRestricted(const OPT(bool)& restricted);
|
||||
bool restricted() const;
|
||||
|
||||
void setShared(const OPT(bool)& shared);
|
||||
bool shared() const;
|
||||
|
||||
void setNetClass(const std::string& netClass);
|
||||
const std::string& netClass() const;
|
||||
|
||||
void setConstraints(const std::string& constraints);
|
||||
const std::string& constraints() const;
|
||||
|
||||
void setStatus(const ArclinkStatusLine& status);
|
||||
ArclinkStatusLine& status();
|
||||
ArclinkStatusLine status() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ArclinkRequestLineIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ArclinkRequestLine* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
ArclinkRequest* arclinkRequest() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ArclinkRequestLineIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(bool) _restricted;
|
||||
OPT(bool) _shared;
|
||||
std::string _netClass;
|
||||
std::string _constraints;
|
||||
ArclinkStatusLine _status;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
100
include/seiscomp/datamodel/arclinkrequestsummary.h
Normal file
100
include/seiscomp/datamodel/arclinkrequestsummary.h
Normal file
@ -0,0 +1,100 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKREQUESTSUMMARY_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKREQUESTSUMMARY_H
|
||||
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkRequestSummary);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkRequestSummary : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(ArclinkRequestSummary)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkRequestSummary();
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkRequestSummary(const ArclinkRequestSummary& other);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkRequestSummary() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
ArclinkRequestSummary& operator=(const ArclinkRequestSummary& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkRequestSummary& other) const;
|
||||
bool operator!=(const ArclinkRequestSummary& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkRequestSummary& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setOkLineCount(int okLineCount);
|
||||
int okLineCount() const;
|
||||
|
||||
void setTotalLineCount(int totalLineCount);
|
||||
int totalLineCount() const;
|
||||
|
||||
void setAverageTimeWindow(int averageTimeWindow);
|
||||
int averageTimeWindow() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
int _okLineCount;
|
||||
int _totalLineCount;
|
||||
int _averageTimeWindow;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
172
include/seiscomp/datamodel/arclinkstatusline.h
Normal file
172
include/seiscomp/datamodel/arclinkstatusline.h
Normal file
@ -0,0 +1,172 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKSTATUSLINE_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKSTATUSLINE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkStatusLine);
|
||||
|
||||
class ArclinkRequest;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkStatusLineIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkStatusLineIndex();
|
||||
ArclinkStatusLineIndex(const std::string& volumeID,
|
||||
const std::string& type,
|
||||
const std::string& status);
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkStatusLineIndex(const ArclinkStatusLineIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ArclinkStatusLineIndex&) const;
|
||||
bool operator!=(const ArclinkStatusLineIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string volumeID;
|
||||
std::string type;
|
||||
std::string status;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkStatusLine : public Object {
|
||||
DECLARE_SC_CLASS(ArclinkStatusLine)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkStatusLine();
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkStatusLine(const ArclinkStatusLine& other);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkStatusLine() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
ArclinkStatusLine& operator=(const ArclinkStatusLine& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkStatusLine& other) const;
|
||||
bool operator!=(const ArclinkStatusLine& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkStatusLine& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
void setStatus(const std::string& status);
|
||||
const std::string& status() const;
|
||||
|
||||
void setSize(const OPT(int)& size);
|
||||
int size() const;
|
||||
|
||||
void setMessage(const std::string& message);
|
||||
const std::string& message() const;
|
||||
|
||||
void setVolumeID(const std::string& volumeID);
|
||||
const std::string& volumeID() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ArclinkStatusLineIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ArclinkStatusLine* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
ArclinkRequest* arclinkRequest() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ArclinkStatusLineIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(int) _size;
|
||||
std::string _message;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
188
include/seiscomp/datamodel/arclinkuser.h
Normal file
188
include/seiscomp/datamodel/arclinkuser.h
Normal file
@ -0,0 +1,188 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINKUSER_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINKUSER_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArclinkUser);
|
||||
|
||||
class ArclinkLog;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkUserIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArclinkUserIndex();
|
||||
ArclinkUserIndex(const std::string& name,
|
||||
const std::string& email);
|
||||
|
||||
//! Copy constructor
|
||||
ArclinkUserIndex(const ArclinkUserIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ArclinkUserIndex&) const;
|
||||
bool operator!=(const ArclinkUserIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
std::string email;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArclinkUser : public PublicObject {
|
||||
DECLARE_SC_CLASS(ArclinkUser)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ArclinkUser();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ArclinkUser(const ArclinkUser& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ArclinkUser(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ArclinkUser() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ArclinkUser* Create();
|
||||
static ArclinkUser* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ArclinkUser* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ArclinkUser& operator=(const ArclinkUser& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ArclinkUser& other) const;
|
||||
bool operator!=(const ArclinkUser& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ArclinkUser& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
void setEmail(const std::string& email);
|
||||
const std::string& email() const;
|
||||
|
||||
void setPassword(const std::string& password);
|
||||
const std::string& password() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ArclinkUserIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ArclinkUser* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
ArclinkLog* arclinkLog() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ArclinkUserIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _password;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ArclinkUser);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
278
include/seiscomp/datamodel/arrival.h
Normal file
278
include/seiscomp/datamodel/arrival.h
Normal file
@ -0,0 +1,278 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARRIVAL_H
|
||||
#define SEISCOMP_DATAMODEL_ARRIVAL_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/phase.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Arrival);
|
||||
|
||||
class Origin;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ArrivalIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ArrivalIndex();
|
||||
ArrivalIndex(const std::string& pickID);
|
||||
|
||||
//! Copy constructor
|
||||
ArrivalIndex(const ArrivalIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ArrivalIndex&) const;
|
||||
bool operator!=(const ArrivalIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string pickID;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Successful association of a pick with an origin qualifies
|
||||
* \brief this pick as
|
||||
* \brief an arrival. An arrival thus connects a pick with an origin
|
||||
* \brief and provides
|
||||
* \brief additional attributes that describe this relationship.
|
||||
* \brief Usually qualification
|
||||
* \brief of a pick as an arrival for a given origin is a hypothesis,
|
||||
* \brief which is
|
||||
* \brief based on assumptions about the type of arrival (phase) as
|
||||
* \brief well as
|
||||
* \brief observed and (on the basis of an earth model) computed
|
||||
* \brief arrival times,
|
||||
* \brief or the residual, respectively. Additional pick attributes
|
||||
* \brief like the
|
||||
* \brief horizontal slowness and backazimuth of the observed
|
||||
* \brief wave-especially if
|
||||
* \brief derived from array data-may further constrain the nature of
|
||||
* \brief the arrival.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Arrival : public Object {
|
||||
DECLARE_SC_CLASS(Arrival)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Arrival();
|
||||
|
||||
//! Copy constructor
|
||||
Arrival(const Arrival& other);
|
||||
|
||||
//! Destructor
|
||||
~Arrival() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Arrival& operator=(const Arrival& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Arrival& other) const;
|
||||
bool operator!=(const Arrival& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Arrival& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Refers to a publicID of a Pick.
|
||||
void setPickID(const std::string& pickID);
|
||||
const std::string& pickID() const;
|
||||
|
||||
//! Phase identification. For possible values, please refer to
|
||||
//! the description of the Phase type.
|
||||
void setPhase(const Phase& phase);
|
||||
Phase& phase();
|
||||
const Phase& phase() const;
|
||||
|
||||
//! Time correction value. Usually, a value characteristic for
|
||||
//! the station
|
||||
//! at which the pick was detected, sometimes also
|
||||
//! characteristic for the
|
||||
//! phase type or the slowness in seconds.
|
||||
void setTimeCorrection(const OPT(double)& timeCorrection);
|
||||
double timeCorrection() const;
|
||||
|
||||
//! Azimuth of station as seen from the epicenter in degrees.
|
||||
void setAzimuth(const OPT(double)& azimuth);
|
||||
double azimuth() const;
|
||||
|
||||
//! Epicentral distance in degrees.
|
||||
void setDistance(const OPT(double)& distance);
|
||||
double distance() const;
|
||||
|
||||
//! Angle of emerging ray at the source, measured against the
|
||||
//! downward
|
||||
//! normal direction in degrees.
|
||||
void setTakeOffAngle(const OPT(double)& takeOffAngle);
|
||||
double takeOffAngle() const;
|
||||
|
||||
//! Residual between observed and expected arrival time
|
||||
//! assuming proper
|
||||
//! phase identification and given the earthModelID of the
|
||||
//! Origin,
|
||||
//! taking into account the timeCorrection in seconds.
|
||||
void setTimeResidual(const OPT(double)& timeResidual);
|
||||
double timeResidual() const;
|
||||
|
||||
//! Residual of horizontal slowness and the expected slowness
|
||||
//! given the
|
||||
//! current origin (refers to attribute horizontalSlowness of
|
||||
//! class Pick)
|
||||
//! in s/deg.
|
||||
void setHorizontalSlownessResidual(const OPT(double)& horizontalSlownessResidual);
|
||||
double horizontalSlownessResidual() const;
|
||||
|
||||
//! Residual of backazimuth and the backazimuth computed for
|
||||
//! the current
|
||||
//! origin (refers to attribute backazimuth of class Pick) in
|
||||
//! degrees.
|
||||
void setBackazimuthResidual(const OPT(double)& backazimuthResidual);
|
||||
double backazimuthResidual() const;
|
||||
|
||||
void setTimeUsed(const OPT(bool)& timeUsed);
|
||||
bool timeUsed() const;
|
||||
|
||||
//! Weight of the horizontal slowness for computation of the
|
||||
//! associated Origin.
|
||||
//! Note that the sum of all weights is not required to be
|
||||
//! unity.
|
||||
void setHorizontalSlownessUsed(const OPT(bool)& horizontalSlownessUsed);
|
||||
bool horizontalSlownessUsed() const;
|
||||
|
||||
void setBackazimuthUsed(const OPT(bool)& backazimuthUsed);
|
||||
bool backazimuthUsed() const;
|
||||
|
||||
//! Weight of the arrival time for computation of the
|
||||
//! associated Origin.
|
||||
//! Note that the sum of all weights is not required to be
|
||||
//! unity.
|
||||
void setWeight(const OPT(double)& weight);
|
||||
double weight() const;
|
||||
|
||||
//! Earth model which is used for the association of Arrival to
|
||||
//! Pick and computation of the
|
||||
//! residuals.
|
||||
void setEarthModelID(const std::string& earthModelID);
|
||||
const std::string& earthModelID() const;
|
||||
|
||||
//! Indicates if the arrival is preliminary.
|
||||
void setPreliminary(const OPT(bool)& preliminary);
|
||||
bool preliminary() const;
|
||||
|
||||
//! CreationInfo for the Arrival object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ArrivalIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Arrival* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Origin* origin() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ArrivalIndex _index;
|
||||
|
||||
// Attributes
|
||||
Phase _phase;
|
||||
OPT(double) _timeCorrection;
|
||||
OPT(double) _azimuth;
|
||||
OPT(double) _distance;
|
||||
OPT(double) _takeOffAngle;
|
||||
OPT(double) _timeResidual;
|
||||
OPT(double) _horizontalSlownessResidual;
|
||||
OPT(double) _backazimuthResidual;
|
||||
OPT(bool) _timeUsed;
|
||||
OPT(bool) _horizontalSlownessUsed;
|
||||
OPT(bool) _backazimuthUsed;
|
||||
OPT(double) _weight;
|
||||
std::string _earthModelID;
|
||||
OPT(bool) _preliminary;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
249
include/seiscomp/datamodel/auxdevice.h
Normal file
249
include/seiscomp/datamodel/auxdevice.h
Normal file
@ -0,0 +1,249 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AUXDEVICE_H
|
||||
#define SEISCOMP_DATAMODEL_AUXDEVICE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/auxsource.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(AuxDevice);
|
||||
DEFINE_SMARTPOINTER(AuxSource);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AuxDeviceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AuxDeviceIndex();
|
||||
AuxDeviceIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
AuxDeviceIndex(const AuxDeviceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const AuxDeviceIndex&) const;
|
||||
bool operator!=(const AuxDeviceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes an auxiliary device
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API AuxDevice : public PublicObject {
|
||||
DECLARE_SC_CLASS(AuxDevice)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
AuxDevice();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
AuxDevice(const AuxDevice& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
AuxDevice(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~AuxDevice() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static AuxDevice* Create();
|
||||
static AuxDevice* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static AuxDevice* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
AuxDevice& operator=(const AuxDevice& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const AuxDevice& other) const;
|
||||
bool operator!=(const AuxDevice& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const AuxDevice& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique device name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Device description
|
||||
void setDescription(const std::string& description);
|
||||
const std::string& description() const;
|
||||
|
||||
//! Device model
|
||||
void setModel(const std::string& model);
|
||||
const std::string& model() const;
|
||||
|
||||
//! Device manufacturer
|
||||
void setManufacturer(const std::string& manufacturer);
|
||||
const std::string& manufacturer() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const AuxDeviceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const AuxDevice* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(AuxSource* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(AuxSource* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeAuxSource(size_t i);
|
||||
bool removeAuxSource(const AuxSourceIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t auxSourceCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
AuxSource* auxSource(size_t i) const;
|
||||
AuxSource* auxSource(const AuxSourceIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
AuxDeviceIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _description;
|
||||
std::string _model;
|
||||
std::string _manufacturer;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
// Aggregations
|
||||
std::vector<AuxSourcePtr> _auxSources;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(AuxDevice);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
201
include/seiscomp/datamodel/auxsource.h
Normal file
201
include/seiscomp/datamodel/auxsource.h
Normal file
@ -0,0 +1,201 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AUXSOURCE_H
|
||||
#define SEISCOMP_DATAMODEL_AUXSOURCE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(AuxSource);
|
||||
|
||||
class AuxDevice;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AuxSourceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AuxSourceIndex();
|
||||
AuxSourceIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
AuxSourceIndex(const AuxSourceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const AuxSourceIndex&) const;
|
||||
bool operator!=(const AuxSourceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a channel of an auxiliary device
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API AuxSource : public Object {
|
||||
DECLARE_SC_CLASS(AuxSource)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AuxSource();
|
||||
|
||||
//! Copy constructor
|
||||
AuxSource(const AuxSource& other);
|
||||
|
||||
//! Custom constructor
|
||||
AuxSource(const std::string& name);
|
||||
AuxSource(const std::string& name,
|
||||
const std::string& description,
|
||||
const std::string& unit,
|
||||
const std::string& conversion,
|
||||
const OPT(int)& sampleRateNumerator = Seiscomp::Core::None,
|
||||
const OPT(int)& sampleRateDenominator = Seiscomp::Core::None,
|
||||
const OPT(Blob)& remark = Seiscomp::Core::None);
|
||||
|
||||
//! Destructor
|
||||
~AuxSource() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
AuxSource& operator=(const AuxSource& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const AuxSource& other) const;
|
||||
bool operator!=(const AuxSource& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const AuxSource& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Referred from network/station/auxStream/@source
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Description
|
||||
void setDescription(const std::string& description);
|
||||
const std::string& description() const;
|
||||
|
||||
//! Unit of mesurement
|
||||
void setUnit(const std::string& unit);
|
||||
const std::string& unit() const;
|
||||
|
||||
//! Conversion formula from counts to unit of measurement
|
||||
void setConversion(const std::string& conversion);
|
||||
const std::string& conversion() const;
|
||||
|
||||
//! Output sample rate (numerator); referred from
|
||||
//! network/station/AuxStream/@sampleRateNumerator
|
||||
void setSampleRateNumerator(const OPT(int)& sampleRateNumerator);
|
||||
int sampleRateNumerator() const;
|
||||
|
||||
//! Output sample rate (denominator); referred from
|
||||
//! network/station/AuxStream/@sampleRateDenominator
|
||||
void setSampleRateDenominator(const OPT(int)& sampleRateDenominator);
|
||||
int sampleRateDenominator() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const AuxSourceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const AuxSource* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
AuxDevice* auxDevice() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
AuxSourceIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _description;
|
||||
std::string _unit;
|
||||
std::string _conversion;
|
||||
OPT(int) _sampleRateNumerator;
|
||||
OPT(int) _sampleRateDenominator;
|
||||
OPT(Blob) _remark;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
207
include/seiscomp/datamodel/auxstream.h
Normal file
207
include/seiscomp/datamodel/auxstream.h
Normal file
@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AUXSTREAM_H
|
||||
#define SEISCOMP_DATAMODEL_AUXSTREAM_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(AuxStream);
|
||||
|
||||
class SensorLocation;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API AuxStreamIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AuxStreamIndex();
|
||||
AuxStreamIndex(const std::string& code,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
AuxStreamIndex(const AuxStreamIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const AuxStreamIndex&) const;
|
||||
bool operator!=(const AuxStreamIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string code;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a stream (channel) without defined
|
||||
* \brief frequency response
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API AuxStream : public Object {
|
||||
DECLARE_SC_CLASS(AuxStream)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
AuxStream();
|
||||
|
||||
//! Copy constructor
|
||||
AuxStream(const AuxStream& other);
|
||||
|
||||
//! Destructor
|
||||
~AuxStream() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
AuxStream& operator=(const AuxStream& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const AuxStream& other) const;
|
||||
bool operator!=(const AuxStream& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const AuxStream& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Stream code (52.04)
|
||||
void setCode(const std::string& code);
|
||||
const std::string& code() const;
|
||||
|
||||
//! Start of epoch in ISO datetime format (52.22)
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of epoch (52.23)
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! Reference to auxDevice/@publicID
|
||||
void setDevice(const std::string& device);
|
||||
const std::string& device() const;
|
||||
|
||||
//! Serial number of device
|
||||
void setDeviceSerialNumber(const std::string& deviceSerialNumber);
|
||||
const std::string& deviceSerialNumber() const;
|
||||
|
||||
//! Reference to auxSource/@name
|
||||
void setSource(const std::string& source);
|
||||
const std::string& source() const;
|
||||
|
||||
//! Data format, eg.: "steim1", "steim2", "mseedN" (N =
|
||||
//! encoding format in blockette 1000)
|
||||
void setFormat(const std::string& format);
|
||||
const std::string& format() const;
|
||||
|
||||
//! Channel flags (52.21)
|
||||
void setFlags(const std::string& flags);
|
||||
const std::string& flags() const;
|
||||
|
||||
//! Whether the stream is "restricted"
|
||||
void setRestricted(const OPT(bool)& restricted);
|
||||
bool restricted() const;
|
||||
|
||||
//! Whether the metadata is synchronized with other datacenters
|
||||
void setShared(const OPT(bool)& shared);
|
||||
bool shared() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const AuxStreamIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const AuxStream* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
SensorLocation* sensorLocation() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
AuxStreamIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
std::string _device;
|
||||
std::string _deviceSerialNumber;
|
||||
std::string _source;
|
||||
std::string _format;
|
||||
std::string _flags;
|
||||
OPT(bool) _restricted;
|
||||
OPT(bool) _shared;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
119
include/seiscomp/datamodel/axis.h
Normal file
119
include/seiscomp/datamodel/axis.h
Normal file
@ -0,0 +1,119 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_AXIS_H
|
||||
#define SEISCOMP_DATAMODEL_AXIS_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Axis);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes an eigenvector of a moment tensor
|
||||
* \brief expressed in its
|
||||
* \brief principal-axes system. It uses the angles azimuth, plunge,
|
||||
* \brief and the
|
||||
* \brief eigenvalue length.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Axis : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Axis)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Axis();
|
||||
|
||||
//! Copy constructor
|
||||
Axis(const Axis& other);
|
||||
|
||||
//! Destructor
|
||||
~Axis() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Axis& operator=(const Axis& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Axis& other) const;
|
||||
bool operator!=(const Axis& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Axis& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Azimuth of eigenvector of moment tensor expressed in
|
||||
//! principal-axes system. Measured clockwise
|
||||
//! from South-North direction at epicenter in degrees.
|
||||
void setAzimuth(const RealQuantity& azimuth);
|
||||
RealQuantity& azimuth();
|
||||
const RealQuantity& azimuth() const;
|
||||
|
||||
//! Plunge of eigenvector of moment tensor expressed in
|
||||
//! principal-axes system. Measured against downward
|
||||
//! vertical direction at epicenter in degrees.
|
||||
void setPlunge(const RealQuantity& plunge);
|
||||
RealQuantity& plunge();
|
||||
const RealQuantity& plunge() const;
|
||||
|
||||
//! Eigenvalue of moment tensor expressed in principal-axes
|
||||
//! system in Nm.
|
||||
void setLength(const RealQuantity& length);
|
||||
RealQuantity& length();
|
||||
const RealQuantity& length() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
RealQuantity _azimuth;
|
||||
RealQuantity _plunge;
|
||||
RealQuantity _length;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
93
include/seiscomp/datamodel/blob.h
Normal file
93
include/seiscomp/datamodel/blob.h
Normal file
@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_BLOB_H
|
||||
#define SEISCOMP_DATAMODEL_BLOB_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Blob);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Blob : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Blob)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Blob();
|
||||
|
||||
//! Copy constructor
|
||||
Blob(const Blob& other);
|
||||
|
||||
//! Destructor
|
||||
~Blob() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Blob& operator=(const Blob& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Blob& other) const;
|
||||
bool operator!=(const Blob& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Blob& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setContent(const std::string& content);
|
||||
const std::string& content() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _content;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
213
include/seiscomp/datamodel/comment.h
Normal file
213
include/seiscomp/datamodel/comment.h
Normal file
@ -0,0 +1,213 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_COMMENT_H
|
||||
#define SEISCOMP_DATAMODEL_COMMENT_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class MomentTensor;
|
||||
class FocalMechanism;
|
||||
class Amplitude;
|
||||
class Magnitude;
|
||||
class StationMagnitude;
|
||||
class Pick;
|
||||
class Event;
|
||||
class Origin;
|
||||
class Parameter;
|
||||
class ParameterSet;
|
||||
class Stream;
|
||||
class SensorLocation;
|
||||
class Station;
|
||||
class Network;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API CommentIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
CommentIndex();
|
||||
CommentIndex(const std::string& id);
|
||||
|
||||
//! Copy constructor
|
||||
CommentIndex(const CommentIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const CommentIndex&) const;
|
||||
bool operator!=(const CommentIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string id;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Comment holds information on comments to a resource as well
|
||||
* \brief as author and creation time information.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Comment : public Object {
|
||||
DECLARE_SC_CLASS(Comment)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Comment();
|
||||
|
||||
//! Copy constructor
|
||||
Comment(const Comment& other);
|
||||
|
||||
//! Destructor
|
||||
~Comment() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Comment& operator=(const Comment& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Comment& other) const;
|
||||
bool operator!=(const Comment& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Comment& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Text of comment.
|
||||
void setText(const std::string& text);
|
||||
const std::string& text() const;
|
||||
|
||||
//! Identifier of comment, possibly in QuakeML RI format.
|
||||
void setId(const std::string& id);
|
||||
const std::string& id() const;
|
||||
|
||||
//! Start of epoch in ISO datetime format
|
||||
void setStart(const OPT(Seiscomp::Core::Time)& start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of epoch (empty if the comment epoch is open)
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! CreationInfo for the Comment object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const CommentIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Comment* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* The following methods return the parent object by type.
|
||||
* Because different parent types are possible, just one
|
||||
* of these methods will return a valid pointer at a time.
|
||||
*/
|
||||
MomentTensor* momentTensor() const;
|
||||
FocalMechanism* focalMechanism() const;
|
||||
Amplitude* amplitude() const;
|
||||
Magnitude* magnitude() const;
|
||||
StationMagnitude* stationMagnitude() const;
|
||||
Pick* pick() const;
|
||||
Event* event() const;
|
||||
Origin* origin() const;
|
||||
Parameter* parameter() const;
|
||||
ParameterSet* parameterSet() const;
|
||||
Stream* stream() const;
|
||||
SensorLocation* sensorLocation() const;
|
||||
Station* station() const;
|
||||
Network* network() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
CommentIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _text;
|
||||
OPT(Seiscomp::Core::Time) _start;
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
95
include/seiscomp/datamodel/complexarray.h
Normal file
95
include/seiscomp/datamodel/complexarray.h
Normal file
@ -0,0 +1,95 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_COMPLEXARRAY_H
|
||||
#define SEISCOMP_DATAMODEL_COMPLEXARRAY_H
|
||||
|
||||
|
||||
#include <complex>
|
||||
#include <vector>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ComplexArray);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ComplexArray : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(ComplexArray)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ComplexArray();
|
||||
|
||||
//! Copy constructor
|
||||
ComplexArray(const ComplexArray& other);
|
||||
|
||||
//! Destructor
|
||||
~ComplexArray() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
ComplexArray& operator=(const ComplexArray& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ComplexArray& other) const;
|
||||
bool operator!=(const ComplexArray& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ComplexArray& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setContent(const std::vector< std::complex<double> >&);
|
||||
const std::vector< std::complex<double> >& content() const;
|
||||
std::vector< std::complex<double> >& content();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::vector< std::complex<double> > _content;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
179
include/seiscomp/datamodel/compositetime.h
Normal file
179
include/seiscomp/datamodel/compositetime.h
Normal file
@ -0,0 +1,179 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_COMPOSITETIME_H
|
||||
#define SEISCOMP_DATAMODEL_COMPOSITETIME_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/integerquantity.h>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(CompositeTime);
|
||||
|
||||
class Origin;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Focal times differ significantly in their precision. While
|
||||
* \brief focal times
|
||||
* \brief of instrumentally located earthquakes are estimated
|
||||
* \brief precisely down to
|
||||
* \brief seconds, historic events have only incomplete time
|
||||
* \brief descriptions. Sometimes,
|
||||
* \brief even contradictory information about the rupture time
|
||||
* \brief exist. The
|
||||
* \brief CompositeTime type allows for such complex descriptions. If
|
||||
* \brief the specification
|
||||
* \brief is given with no greater accuracy than days (i.e., no time
|
||||
* \brief components are
|
||||
* \brief given), the date refers to local time. However, if time
|
||||
* \brief components are
|
||||
* \brief given, they have to refer to UTC. As an example, consider a
|
||||
* \brief historic
|
||||
* \brief earthquake in California, e.g., on 28 February 1730, with
|
||||
* \brief no time information
|
||||
* \brief given. Expressed in UTC, this day extends from
|
||||
* \brief 1730-02-28T08:00:00Z
|
||||
* \brief until 1730-03-01T08:00:00Z. Such a specification would be
|
||||
* \brief against intuition.
|
||||
* \brief Therefore, for date-time specifications without time
|
||||
* \brief components, local
|
||||
* \brief time is used. In the example, the CompositeTime attributes
|
||||
* \brief are simply
|
||||
* \brief year 1730, month 2, and day 28. In the corresponding time
|
||||
* \brief attribute of
|
||||
* \brief the origin, however, UTC has to be used. If the unknown
|
||||
* \brief time components
|
||||
* \brief are assumed to be zero, the value is 1730-02-28T08:00:00Z.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API CompositeTime : public Object {
|
||||
DECLARE_SC_CLASS(CompositeTime)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
CompositeTime();
|
||||
|
||||
//! Copy constructor
|
||||
CompositeTime(const CompositeTime& other);
|
||||
|
||||
//! Destructor
|
||||
~CompositeTime() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
CompositeTime& operator=(const CompositeTime& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const CompositeTime& other) const;
|
||||
bool operator!=(const CompositeTime& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const CompositeTime& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Year or range of years of the event's focal time.
|
||||
void setYear(const OPT(IntegerQuantity)& year);
|
||||
IntegerQuantity& year();
|
||||
const IntegerQuantity& year() const;
|
||||
|
||||
//! Month or range of months of the event's focal time.
|
||||
void setMonth(const OPT(IntegerQuantity)& month);
|
||||
IntegerQuantity& month();
|
||||
const IntegerQuantity& month() const;
|
||||
|
||||
//! Day or range of days of the event's focal time.
|
||||
void setDay(const OPT(IntegerQuantity)& day);
|
||||
IntegerQuantity& day();
|
||||
const IntegerQuantity& day() const;
|
||||
|
||||
//! Hour or range of hours of the event's focal time.
|
||||
void setHour(const OPT(IntegerQuantity)& hour);
|
||||
IntegerQuantity& hour();
|
||||
const IntegerQuantity& hour() const;
|
||||
|
||||
//! Minute or range of minutes of the event's focal time.
|
||||
void setMinute(const OPT(IntegerQuantity)& minute);
|
||||
IntegerQuantity& minute();
|
||||
const IntegerQuantity& minute() const;
|
||||
|
||||
//! Second and fraction of seconds or range of seconds with
|
||||
//! fraction of the event's focal time.
|
||||
void setSecond(const OPT(RealQuantity)& second);
|
||||
RealQuantity& second();
|
||||
const RealQuantity& second() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Origin* origin() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
OPT(IntegerQuantity) _year;
|
||||
OPT(IntegerQuantity) _month;
|
||||
OPT(IntegerQuantity) _day;
|
||||
OPT(IntegerQuantity) _hour;
|
||||
OPT(IntegerQuantity) _minute;
|
||||
OPT(RealQuantity) _second;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
183
include/seiscomp/datamodel/confidenceellipsoid.h
Normal file
183
include/seiscomp/datamodel/confidenceellipsoid.h
Normal file
@ -0,0 +1,183 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CONFIDENCEELLIPSOID_H
|
||||
#define SEISCOMP_DATAMODEL_CONFIDENCEELLIPSOID_H
|
||||
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ConfidenceEllipsoid);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class represents a description of the location
|
||||
* \brief uncertainty as a confidence
|
||||
* \brief ellipsoid with arbitrary orientation in space. The
|
||||
* \brief orientation of a rigid
|
||||
* \brief body in three-dimensional Euclidean space can be described
|
||||
* \brief by three
|
||||
* \brief parameters. We use the convention of Euler angles, which
|
||||
* \brief can be interpreted
|
||||
* \brief as a composition of three elemental rotations (i.e.,
|
||||
* \brief rotations around a single axis).
|
||||
* \brief In the special case of Euler angles we use here, the angles
|
||||
* \brief are referred
|
||||
* \brief to as Tait-Bryan (or Cardan) angles. These angles may be
|
||||
* \brief familiar to
|
||||
* \brief the reader from their application in flight dynamics, and
|
||||
* \brief are referred
|
||||
* \brief to as heading (yaw, psi), elevation (attitude, pitch, phi),
|
||||
* \brief and bank (roll, theta).
|
||||
* \brief For a definition of the angles, see Figure 4. Through the
|
||||
* \brief three elemental
|
||||
* \brief rotations, a Cartesian system (x, y, z) centered at the
|
||||
* \brief epicenter, with
|
||||
* \brief the South-North direction x, the West-East direction y, and
|
||||
* \brief the downward
|
||||
* \brief vertical direction z, is transferred into a different
|
||||
* \brief Cartesian system
|
||||
* \brief (X, Y , Z) centered on the confidence ellipsoid. Here, X
|
||||
* \brief denotes the direction
|
||||
* \brief of the major axis, and Y denotes the direction of the minor
|
||||
* \brief axis of the
|
||||
* \brief ellipsoid. Note that Figure 4 can be interpreted as a
|
||||
* \brief hypothetical view
|
||||
* \brief from the interior of the Earth to the inner face of a shell
|
||||
* \brief representing
|
||||
* \brief Earth's surface. The three Tait-Bryan rotations are
|
||||
* \brief performed as follows:
|
||||
* \brief (i) a rotation about the Z axis with angle psi (heading, or
|
||||
* \brief azimuth);
|
||||
* \brief (ii) a rotation about the Y axis with angle phi (elevation,
|
||||
* \brief or plunge);
|
||||
* \brief and (iii) a rotation about the X axis with angle theta
|
||||
* \brief (bank). Note that in
|
||||
* \brief the case of Tait-Bryan angles, the rotations are performed
|
||||
* \brief about the
|
||||
* \brief ellipsoid's axes, not about the axes of the fixed (x, y, z)
|
||||
* \brief Cartesian system.
|
||||
* \brief In the following list the correspondence of the attributes
|
||||
* \brief of class
|
||||
* \brief ConfidenceEllipsoid to the respective Tait-Bryan angles is
|
||||
* \brief listed:
|
||||
* \brief majorAxisPlunge: elevation (pitch, phi), majorAxisAzimuth:
|
||||
* \brief heading (yaw, psi), majorAxisRotation: bank (roll, theta)
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ConfidenceEllipsoid : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(ConfidenceEllipsoid)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ConfidenceEllipsoid();
|
||||
|
||||
//! Copy constructor
|
||||
ConfidenceEllipsoid(const ConfidenceEllipsoid& other);
|
||||
|
||||
//! Destructor
|
||||
~ConfidenceEllipsoid() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
ConfidenceEllipsoid& operator=(const ConfidenceEllipsoid& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ConfidenceEllipsoid& other) const;
|
||||
bool operator!=(const ConfidenceEllipsoid& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ConfidenceEllipsoid& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Largest uncertainty, corresponding to the semi-major axis
|
||||
//! of the confidence ellipsoid in meter.
|
||||
void setSemiMajorAxisLength(double semiMajorAxisLength);
|
||||
double semiMajorAxisLength() const;
|
||||
|
||||
//! Smallest uncertainty, corresponding to the semi-minor axis
|
||||
//! of the confidence ellipsoid in meter.
|
||||
void setSemiMinorAxisLength(double semiMinorAxisLength);
|
||||
double semiMinorAxisLength() const;
|
||||
|
||||
//! Uncertainty in direction orthogonal to major and minor axes
|
||||
//! of the confidence ellipsoid in meter.
|
||||
void setSemiIntermediateAxisLength(double semiIntermediateAxisLength);
|
||||
double semiIntermediateAxisLength() const;
|
||||
|
||||
//! Plunge angle of major axis of confidence ellipsoid.
|
||||
//! Corresponds to Tait-Bryan angle phi
|
||||
//! in degrees.
|
||||
void setMajorAxisPlunge(double majorAxisPlunge);
|
||||
double majorAxisPlunge() const;
|
||||
|
||||
//! Azimuth angle of major axis of confidence ellipsoid.
|
||||
//! Corresponds to Tait-Bryan angle psi
|
||||
//! in degrees.
|
||||
void setMajorAxisAzimuth(double majorAxisAzimuth);
|
||||
double majorAxisAzimuth() const;
|
||||
|
||||
//! This angle describes a rotation about the confidence
|
||||
//! ellipsoid's major axis which is required
|
||||
//! to define the direction of the ellipsoid's minor axis.
|
||||
//! Corresponds to Tait-Bryan angle theta
|
||||
//! in degrees.
|
||||
void setMajorAxisRotation(double majorAxisRotation);
|
||||
double majorAxisRotation() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
double _semiMajorAxisLength;
|
||||
double _semiMinorAxisLength;
|
||||
double _semiIntermediateAxisLength;
|
||||
double _majorAxisPlunge;
|
||||
double _majorAxisAzimuth;
|
||||
double _majorAxisRotation;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
153
include/seiscomp/datamodel/config.h
Normal file
153
include/seiscomp/datamodel/config.h
Normal file
@ -0,0 +1,153 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CONFIG_H
|
||||
#define SEISCOMP_DATAMODEL_CONFIG_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Config);
|
||||
DEFINE_SMARTPOINTER(ParameterSet);
|
||||
DEFINE_SMARTPOINTER(ConfigModule);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Config : public PublicObject {
|
||||
DECLARE_SC_CLASS(Config)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Config();
|
||||
|
||||
//! Copy constructor
|
||||
Config(const Config& other);
|
||||
|
||||
//! Destructor
|
||||
~Config() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Config& operator=(const Config& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Config& other) const;
|
||||
bool operator!=(const Config& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Config& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(ParameterSet* obj);
|
||||
bool add(ConfigModule* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(ParameterSet* obj);
|
||||
bool remove(ConfigModule* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeParameterSet(size_t i);
|
||||
bool removeConfigModule(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t parameterSetCount() const;
|
||||
size_t configModuleCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
ParameterSet* parameterSet(size_t i) const;
|
||||
ConfigModule* configModule(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
ParameterSet* findParameterSet(const std::string& publicID) const;
|
||||
ConfigModule* findConfigModule(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<ParameterSetPtr> _parameterSets;
|
||||
std::vector<ConfigModulePtr> _configModules;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Config);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
33
include/seiscomp/datamodel/config_package.h
Normal file
33
include/seiscomp/datamodel/config_package.h
Normal file
@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CONFIG_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_CONFIG_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/parameter.h>
|
||||
#include <seiscomp/datamodel/parameterset.h>
|
||||
#include <seiscomp/datamodel/setup.h>
|
||||
#include <seiscomp/datamodel/configstation.h>
|
||||
#include <seiscomp/datamodel/configmodule.h>
|
||||
#include <seiscomp/datamodel/config.h>
|
||||
|
||||
|
||||
#endif
|
||||
191
include/seiscomp/datamodel/configmodule.h
Normal file
191
include/seiscomp/datamodel/configmodule.h
Normal file
@ -0,0 +1,191 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CONFIGMODULE_H
|
||||
#define SEISCOMP_DATAMODEL_CONFIGMODULE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/configstation.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ConfigModule);
|
||||
DEFINE_SMARTPOINTER(ConfigStation);
|
||||
|
||||
class Config;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ConfigModule : public PublicObject {
|
||||
DECLARE_SC_CLASS(ConfigModule)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ConfigModule();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ConfigModule(const ConfigModule& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ConfigModule(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ConfigModule() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ConfigModule* Create();
|
||||
static ConfigModule* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ConfigModule* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ConfigModule& operator=(const ConfigModule& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ConfigModule& other) const;
|
||||
bool operator!=(const ConfigModule& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ConfigModule& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
void setParameterSetID(const std::string& parameterSetID);
|
||||
const std::string& parameterSetID() const;
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
bool enabled() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(ConfigStation* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(ConfigStation* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeConfigStation(size_t i);
|
||||
bool removeConfigStation(const ConfigStationIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t configStationCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
ConfigStation* configStation(size_t i) const;
|
||||
ConfigStation* configStation(const ConfigStationIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
ConfigStation* findConfigStation(const std::string& publicID) const;
|
||||
|
||||
Config* config() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _name;
|
||||
std::string _parameterSetID;
|
||||
bool _enabled;
|
||||
|
||||
// Aggregations
|
||||
std::vector<ConfigStationPtr> _configStations;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ConfigModule);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
240
include/seiscomp/datamodel/configstation.h
Normal file
240
include/seiscomp/datamodel/configstation.h
Normal file
@ -0,0 +1,240 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CONFIGSTATION_H
|
||||
#define SEISCOMP_DATAMODEL_CONFIGSTATION_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/setup.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ConfigStation);
|
||||
DEFINE_SMARTPOINTER(Setup);
|
||||
|
||||
class ConfigModule;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ConfigStationIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ConfigStationIndex();
|
||||
ConfigStationIndex(const std::string& networkCode,
|
||||
const std::string& stationCode);
|
||||
|
||||
//! Copy constructor
|
||||
ConfigStationIndex(const ConfigStationIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ConfigStationIndex&) const;
|
||||
bool operator!=(const ConfigStationIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string networkCode;
|
||||
std::string stationCode;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ConfigStation : public PublicObject {
|
||||
DECLARE_SC_CLASS(ConfigStation)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ConfigStation();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ConfigStation(const ConfigStation& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ConfigStation(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ConfigStation() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ConfigStation* Create();
|
||||
static ConfigStation* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ConfigStation* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ConfigStation& operator=(const ConfigStation& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ConfigStation& other) const;
|
||||
bool operator!=(const ConfigStation& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ConfigStation& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setNetworkCode(const std::string& networkCode);
|
||||
const std::string& networkCode() const;
|
||||
|
||||
void setStationCode(const std::string& stationCode);
|
||||
const std::string& stationCode() const;
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
bool enabled() const;
|
||||
|
||||
//! CreationInfo for the ConfigStation object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ConfigStationIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ConfigStation* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Setup* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Setup* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeSetup(size_t i);
|
||||
bool removeSetup(const SetupIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t setupCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Setup* setup(size_t i) const;
|
||||
Setup* setup(const SetupIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
ConfigModule* configModule() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ConfigStationIndex _index;
|
||||
|
||||
// Attributes
|
||||
bool _enabled;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<SetupPtr> _setups;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ConfigStation);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
133
include/seiscomp/datamodel/creationinfo.h
Normal file
133
include/seiscomp/datamodel/creationinfo.h
Normal file
@ -0,0 +1,133 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_CREATIONINFO_H
|
||||
#define SEISCOMP_DATAMODEL_CREATIONINFO_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(CreationInfo);
|
||||
|
||||
|
||||
/**
|
||||
* \brief CreationInfo is used to describe creation metadata (author,
|
||||
* \brief version, and creation time) of a resource.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API CreationInfo : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(CreationInfo)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
CreationInfo();
|
||||
|
||||
//! Copy constructor
|
||||
CreationInfo(const CreationInfo& other);
|
||||
|
||||
//! Destructor
|
||||
~CreationInfo() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
CreationInfo& operator=(const CreationInfo& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const CreationInfo& other) const;
|
||||
bool operator!=(const CreationInfo& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const CreationInfo& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Designation of agency that published a resource. The string
|
||||
//! has a maximum length of 64 characters.
|
||||
void setAgencyID(const std::string& agencyID);
|
||||
const std::string& agencyID() const;
|
||||
|
||||
//! RI of the agency that published a resource.
|
||||
void setAgencyURI(const std::string& agencyURI);
|
||||
const std::string& agencyURI() const;
|
||||
|
||||
//! Name describing the author of a resource. The string has a
|
||||
//! maximum length of 128 characters.
|
||||
void setAuthor(const std::string& author);
|
||||
const std::string& author() const;
|
||||
|
||||
//! RI of the author of a resource.
|
||||
void setAuthorURI(const std::string& authorURI);
|
||||
const std::string& authorURI() const;
|
||||
|
||||
//! Time of creation of a resource, in ISO 8601 format. It has
|
||||
//! to be given in UTC.
|
||||
void setCreationTime(const OPT(Seiscomp::Core::Time)& creationTime);
|
||||
Seiscomp::Core::Time creationTime() const;
|
||||
|
||||
//! Time of last modification of a resource, in ISO 8601
|
||||
//! format. It has to be given in UTC.
|
||||
void setModificationTime(const OPT(Seiscomp::Core::Time)& modificationTime);
|
||||
Seiscomp::Core::Time modificationTime() const;
|
||||
|
||||
//! Version string of a resource.
|
||||
void setVersion(const std::string& version);
|
||||
const std::string& version() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _agencyID;
|
||||
std::string _agencyURI;
|
||||
std::string _author;
|
||||
std::string _authorURI;
|
||||
OPT(Seiscomp::Core::Time) _creationTime;
|
||||
OPT(Seiscomp::Core::Time) _modificationTime;
|
||||
std::string _version;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
184
include/seiscomp/datamodel/dataattributeextent.h
Normal file
184
include/seiscomp/datamodel/dataattributeextent.h
Normal file
@ -0,0 +1,184 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATAATTRIBUTEEXTENT_H
|
||||
#define SEISCOMP_DATAMODEL_DATAATTRIBUTEEXTENT_H
|
||||
|
||||
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataAttributeExtent);
|
||||
|
||||
class DataExtent;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataAttributeExtentIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataAttributeExtentIndex();
|
||||
DataAttributeExtentIndex(double sampleRate,
|
||||
const std::string& quality);
|
||||
|
||||
//! Copy constructor
|
||||
DataAttributeExtentIndex(const DataAttributeExtentIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DataAttributeExtentIndex&) const;
|
||||
bool operator!=(const DataAttributeExtentIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
double sampleRate;
|
||||
std::string quality;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataAttributeExtent : public Object {
|
||||
DECLARE_SC_CLASS(DataAttributeExtent)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataAttributeExtent();
|
||||
|
||||
//! Copy constructor
|
||||
DataAttributeExtent(const DataAttributeExtent& other);
|
||||
|
||||
//! Destructor
|
||||
~DataAttributeExtent() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
DataAttributeExtent& operator=(const DataAttributeExtent& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataAttributeExtent& other) const;
|
||||
bool operator!=(const DataAttributeExtent& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataAttributeExtent& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Time of first sample of data attribute extent.
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! Time after last sample of data attribute extent.
|
||||
void setEnd(Seiscomp::Core::Time end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! Sample rate of the current data attribute extent.
|
||||
void setSampleRate(double sampleRate);
|
||||
double sampleRate() const;
|
||||
|
||||
//! Quality indicator of current data attribute extent.
|
||||
void setQuality(const std::string& quality);
|
||||
const std::string& quality() const;
|
||||
|
||||
//! The time of the last update or creation of this data
|
||||
//! attribute extent.
|
||||
void setUpdated(Seiscomp::Core::Time updated);
|
||||
Seiscomp::Core::Time updated() const;
|
||||
|
||||
//! Number of data segments covered by this data attribute
|
||||
//! extent.
|
||||
void setSegmentCount(int segmentCount);
|
||||
int segmentCount() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DataAttributeExtentIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const DataAttributeExtent* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
DataExtent* dataExtent() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DataAttributeExtentIndex _index;
|
||||
|
||||
// Attributes
|
||||
Seiscomp::Core::Time _start;
|
||||
Seiscomp::Core::Time _end;
|
||||
Seiscomp::Core::Time _updated;
|
||||
int _segmentCount;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
152
include/seiscomp/datamodel/dataavailability.h
Normal file
152
include/seiscomp/datamodel/dataavailability.h
Normal file
@ -0,0 +1,152 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATAAVAILABILITY_H
|
||||
#define SEISCOMP_DATAMODEL_DATAAVAILABILITY_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/dataextent.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataAvailability);
|
||||
DEFINE_SMARTPOINTER(DataExtent);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type can hold data availability related objects
|
||||
* \brief (extent and segment).
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DataAvailability : public PublicObject {
|
||||
DECLARE_SC_CLASS(DataAvailability)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataAvailability();
|
||||
|
||||
//! Copy constructor
|
||||
DataAvailability(const DataAvailability& other);
|
||||
|
||||
//! Destructor
|
||||
~DataAvailability() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
DataAvailability& operator=(const DataAvailability& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataAvailability& other) const;
|
||||
bool operator!=(const DataAvailability& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataAvailability& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(DataExtent* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(DataExtent* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeDataExtent(size_t i);
|
||||
bool removeDataExtent(const DataExtentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t dataExtentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
DataExtent* dataExtent(size_t i) const;
|
||||
DataExtent* dataExtent(const DataExtentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
DataExtent* findDataExtent(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<DataExtentPtr> _dataExtents;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(DataAvailability);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
31
include/seiscomp/datamodel/dataavailability_package.h
Normal file
31
include/seiscomp/datamodel/dataavailability_package.h
Normal file
@ -0,0 +1,31 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATAAVAILABILITY_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_DATAAVAILABILITY_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/datasegment.h>
|
||||
#include <seiscomp/datamodel/dataattributeextent.h>
|
||||
#include <seiscomp/datamodel/dataextent.h>
|
||||
#include <seiscomp/datamodel/dataavailability.h>
|
||||
|
||||
|
||||
#endif
|
||||
640
include/seiscomp/datamodel/databasearchive.h
Normal file
640
include/seiscomp/datamodel/databasearchive.h
Normal file
@ -0,0 +1,640 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATABASEARCHIVE_H__
|
||||
#define SEISCOMP_DATAMODEL_DATABASEARCHIVE_H__
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core/strings.h>
|
||||
#include <seiscomp/core/io.h>
|
||||
#include <seiscomp/io/database.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseArchive);
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator class to iterate over a sequence of database objects.
|
||||
* The iteration is done on the database side. Only the current object
|
||||
* is hold in memory unless a reference of previous objects has been
|
||||
* stored somewhere else.
|
||||
* The iterator does not destroy or end a started query in its
|
||||
* destructor. The query will be finished after iterating over all
|
||||
* objects. To stop an iteration you have to call close() explicitly
|
||||
* unless you receive a nullptr object at the end of iteration.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DatabaseIterator : public Seiscomp::Core::BaseObject {
|
||||
// ----------------------------------------------------------------------
|
||||
// Public types
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
typedef IO::DatabaseInterface::OID OID;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected c'tor used by DatabaseArchive
|
||||
DatabaseIterator(DatabaseArchive *database,
|
||||
const Seiscomp::Core::RTTI *rtti);
|
||||
|
||||
public:
|
||||
//! C'tor
|
||||
DatabaseIterator();
|
||||
//! Copy c'tor
|
||||
DatabaseIterator(const DatabaseIterator &iter);
|
||||
|
||||
//! D'tor
|
||||
~DatabaseIterator();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
Object *get() const;
|
||||
|
||||
//! Returns the current result column count
|
||||
size_t fieldCount() const;
|
||||
|
||||
//! Returns the current result field
|
||||
const char *field(size_t index) const;
|
||||
|
||||
DatabaseIterator &operator=(const DatabaseIterator& it);
|
||||
Object* operator*() const;
|
||||
|
||||
DatabaseIterator &operator++();
|
||||
DatabaseIterator &operator++(int);
|
||||
|
||||
//! Returns if the current objectiterator is valid
|
||||
//! and has a valid result set
|
||||
bool valid() const;
|
||||
|
||||
//! Steps to the next result set and returns valid()
|
||||
bool next();
|
||||
|
||||
/**
|
||||
* Closes the iterator and ends the started query.
|
||||
* This method is useful if you want to break an
|
||||
* iteration and to start a new one.
|
||||
*/
|
||||
void close();
|
||||
|
||||
//! Returns the number of elements read
|
||||
size_t count() const;
|
||||
|
||||
Core::Time lastModified() const {
|
||||
if ( _lastModified ) return *_lastModified;
|
||||
throw Core::ValueException("DatabaseIterator.lastModified is not set");
|
||||
}
|
||||
|
||||
OID oid() const { return _oid; }
|
||||
OID parentOid() const { return _parent_oid; }
|
||||
|
||||
//! Returns whether the object has been read from the database
|
||||
//! directly (false) or fetched from the global object pool (true)
|
||||
bool cached() const { return _cached; }
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
Object *fetch() const;
|
||||
|
||||
|
||||
private:
|
||||
const Seiscomp::Core::RTTI *_rtti;
|
||||
DatabaseArchive *_reader;
|
||||
mutable size_t _count;
|
||||
ObjectPtr _object;
|
||||
|
||||
mutable OID _oid;
|
||||
mutable OID _parent_oid;
|
||||
mutable bool _cached;
|
||||
mutable OPT(Core::Time) _lastModified;
|
||||
|
||||
//! Make DatabaseArchive a friend class
|
||||
friend class DatabaseArchive;
|
||||
};
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
class SC_SYSTEM_CORE_API DatabaseObjectWriter : protected Visitor {
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
DatabaseObjectWriter(DatabaseArchive &archive,
|
||||
bool addToDatabase = true);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! Does the actual writing
|
||||
bool operator()(Object *object);
|
||||
bool operator()(Object *object, const std::string &parentID);
|
||||
|
||||
//! Returns the number of handled objects
|
||||
int count() const { return _count; }
|
||||
//! Returns the number of errors while writing
|
||||
int errors() const { return _errors; }
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Visitor interface
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
bool visit(PublicObject *publicObject) override;
|
||||
void visit(Object *object) override;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
bool write(Object *object);
|
||||
|
||||
private:
|
||||
DatabaseArchive &_archive;
|
||||
std::string _parentID;
|
||||
bool _addObjects{true};
|
||||
int _errors{0};
|
||||
int _count{0};
|
||||
};
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
/**
|
||||
* \brief A class containing basic functionality to read and write
|
||||
* \brief schema objects from and to a database.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DatabaseArchive : protected Core::Archive,
|
||||
public Observer {
|
||||
// ----------------------------------------------------------------------
|
||||
// Public types
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
using OID = IO::DatabaseInterface::OID;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
//! @param dbDriver The database driver used to access a
|
||||
//! database. If the database has not been
|
||||
//! opened by the DatabaseReader it will not
|
||||
//! be closed by it. Neither by destruction nor
|
||||
//! by calling DatabaseReader::close().
|
||||
DatabaseArchive(Seiscomp::IO::DatabaseInterface* dbDriver);
|
||||
|
||||
//! Destructor
|
||||
virtual ~DatabaseArchive();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Public Interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
using Seiscomp::Core::Archive::version;
|
||||
using Seiscomp::Core::Archive::versionMajor;
|
||||
using Seiscomp::Core::Archive::versionMinor;
|
||||
using Seiscomp::Core::Archive::isVersion;
|
||||
using Seiscomp::Core::Archive::isLowerVersion;
|
||||
using Seiscomp::Core::Archive::isHigherVersion;
|
||||
using Seiscomp::Core::Archive::supportsVersion;
|
||||
|
||||
|
||||
//! Implements derived method
|
||||
//! @param dataSource user:password@host:port/database
|
||||
bool open(const char* dataSource);
|
||||
|
||||
//! Implements derived method
|
||||
void close();
|
||||
|
||||
//! Returns the used database driver
|
||||
Seiscomp::IO::DatabaseInterface* driver() const;
|
||||
|
||||
//! Sets the database driver to use
|
||||
void setDriver(Seiscomp::IO::DatabaseInterface*);
|
||||
|
||||
//! Returns if the archive is in an erroneous state eg after setting
|
||||
//! a database interface.
|
||||
bool hasError() const;
|
||||
|
||||
//! Returns the error message if hasError() return true
|
||||
const std::string errorMsg() const;
|
||||
|
||||
void benchmarkQueries(int count);
|
||||
|
||||
/**
|
||||
* Reads a public object from the database.
|
||||
* @param classType The type of the object to be read. The type has
|
||||
* to be derived from PublicObject
|
||||
* @param publicId The publicId of the public object
|
||||
* @return An unmanaged object pointer. The ownership goes over
|
||||
* to the caller.
|
||||
*/
|
||||
PublicObject* getObject(const Seiscomp::Core::RTTI& classType,
|
||||
const std::string& publicID);
|
||||
|
||||
/**
|
||||
* Returns an iterator over all objects of a given type.
|
||||
* @param parentID The publicID of the parent object. When empty,
|
||||
* an iterator for all objects with type 'classType'
|
||||
* is returned.
|
||||
* @param classType The type of the objects to iterate over.
|
||||
* @param ignorePublicObject If true then the PublicObject table will
|
||||
* not be joined. That might be important if
|
||||
* during a schema evolution an objects turned
|
||||
* into a PublicObject but an old version
|
||||
* should be read.
|
||||
* @return The database iterator
|
||||
*/
|
||||
DatabaseIterator getObjects(const std::string& parentID,
|
||||
const Seiscomp::Core::RTTI& classType,
|
||||
bool ignorePublicObject = false);
|
||||
|
||||
/**
|
||||
* Returns an iterator over all objects of a given type for a parent
|
||||
* object.
|
||||
* @param parent The parent object. When nullptr, an iterator for all
|
||||
* objects with type 'classType' is returned.
|
||||
* @param classType The type of the objects to iterate over.
|
||||
* @param ignorePublicObject If true then the PublicObject table will
|
||||
* not be joined. That might be important if
|
||||
* during a schema evolution an objects turned
|
||||
* into a PublicObject but an old version
|
||||
* should be read.
|
||||
* @return The database iterator
|
||||
*/
|
||||
DatabaseIterator getObjects(const PublicObject* parent,
|
||||
const Seiscomp::Core::RTTI& classType,
|
||||
bool ignorePublicObject = false);
|
||||
|
||||
/**
|
||||
* Returns the number of objects of a given type.
|
||||
* @param parentID The publicID of the parent object. When empty,
|
||||
* an iterator for all objects with type 'classType'
|
||||
* is returned.
|
||||
* @param classType The type of the objects to iterate over.
|
||||
* @return The object count
|
||||
*/
|
||||
size_t getObjectCount(const std::string& parentID,
|
||||
const Seiscomp::Core::RTTI& classType);
|
||||
|
||||
/**
|
||||
* Returns the number of objects of a given type for a parent
|
||||
* object.
|
||||
* @param parent The parent object. When nullptr, an iterator for all
|
||||
* objects with type 'classType' is returned.
|
||||
* @param classType The type of the objects to iterate over.
|
||||
* @return The object count
|
||||
*/
|
||||
size_t getObjectCount(const PublicObject* parent,
|
||||
const Seiscomp::Core::RTTI &classType);
|
||||
|
||||
|
||||
//! Returns the database id for an object
|
||||
//! @return The id or 0 of no id was cached for this object
|
||||
OID getCachedId(const Object*) const;
|
||||
|
||||
/**
|
||||
* Returns the publicID of the parent object if any.
|
||||
* @param object The PublicObject whose parent is queried.
|
||||
* @return The publicID of the parent or an empty string.
|
||||
*/
|
||||
std::string parentPublicID(const PublicObject* object);
|
||||
|
||||
/**
|
||||
* Inserts an object into the database.
|
||||
* @param object The object to be written
|
||||
* @param parentId The publicID of the parent object used
|
||||
* when no parent pointer is set.
|
||||
*/
|
||||
bool insert(Object* object, const std::string &parentID = "");
|
||||
|
||||
/**
|
||||
* Updates an object in the database. While serializing the
|
||||
* index attributes (Archive hint: INDEX_ATTRIBUTE) will not be
|
||||
* recognized when object is not a PublicObject. Then the index
|
||||
* attributes will be used to lookup the corresponding row in the
|
||||
* object table. The publicID is readonly in any case.
|
||||
* @param object The object to be updated
|
||||
* @param parentId The publicID of the parent object used
|
||||
* when no parent pointer is set.
|
||||
*/
|
||||
bool update(Object *object, const std::string &parentID = "");
|
||||
|
||||
/**
|
||||
* Removes an object in the database. If the object is not a
|
||||
* PublicObject the index attributes (serialized with Archive hint
|
||||
* set to INDEX_ATTRIBUTE) will be used instead.
|
||||
* @param object The object to be removed
|
||||
* @param parentID The parentID of the parent objects used
|
||||
* when no parent pointer is set.
|
||||
*/
|
||||
bool remove(Object *object, const std::string &parentID = "");
|
||||
|
||||
//! Returns an iterator for objects of a given type.
|
||||
DatabaseIterator getObjectIterator(const std::string &query,
|
||||
const Seiscomp::Core::RTTI &classType);
|
||||
|
||||
DatabaseIterator getObjectIterator(const std::string &query,
|
||||
const Seiscomp::Core::RTTI *classType);
|
||||
|
||||
template <typename T>
|
||||
std::string toString(const T& value) const { return Core::toString(value); }
|
||||
|
||||
std::string toString(const std::string &value) const;
|
||||
std::string toString(const char *value) const;
|
||||
std::string toString(const Core::Time& value) const;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Protected Interface
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
//! Implements derived method
|
||||
bool create(const char* dataSource);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Protected Archive Interface
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
//! Reads an integer
|
||||
virtual void read(std::int8_t& value);
|
||||
virtual void read(std::int16_t& value);
|
||||
virtual void read(std::int32_t& value);
|
||||
virtual void read(std::int64_t& value);
|
||||
//! Reads a float
|
||||
virtual void read(float& value);
|
||||
//! Reads a double
|
||||
virtual void read(double& value);
|
||||
//! Reads a float complex
|
||||
virtual void read(std::complex<float>& value);
|
||||
//! Reads a double complex
|
||||
virtual void read(std::complex<double>& value);
|
||||
//! Reads a boolean
|
||||
virtual void read(bool& value);
|
||||
|
||||
//! Reads a vector of native types
|
||||
virtual void read(std::vector<char>& value);
|
||||
virtual void read(std::vector<int8_t>& value);
|
||||
virtual void read(std::vector<int16_t>& value);
|
||||
virtual void read(std::vector<int32_t>& value);
|
||||
virtual void read(std::vector<int64_t>& value);
|
||||
virtual void read(std::vector<float>& value);
|
||||
virtual void read(std::vector<double>& value);
|
||||
virtual void read(std::vector<std::string>& value);
|
||||
virtual void read(std::vector<Core::Time>& value);
|
||||
|
||||
//! Reads a vector of complex doubles
|
||||
virtual void read(std::vector<std::complex<double> >& value);
|
||||
|
||||
//! Reads a string
|
||||
virtual void read(std::string& value);
|
||||
|
||||
//! Reads a time
|
||||
virtual void read(Seiscomp::Core::Time& value);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Write methods
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Writes an integer
|
||||
virtual void write(std::int8_t value);
|
||||
virtual void write(std::int16_t value);
|
||||
virtual void write(std::int32_t value);
|
||||
virtual void write(std::int64_t value);
|
||||
//! Writes a float
|
||||
virtual void write(float value);
|
||||
//! Writes a double
|
||||
virtual void write(double value);
|
||||
//! Writes a float complex
|
||||
virtual void write(std::complex<float>& value);
|
||||
//! Writes a double complex
|
||||
virtual void write(std::complex<double>& value);
|
||||
//! Writes a boolean
|
||||
virtual void write(bool value);
|
||||
|
||||
//! Writes a vector of native types
|
||||
virtual void write(std::vector<char>& value);
|
||||
virtual void write(std::vector<int8_t>& value);
|
||||
virtual void write(std::vector<int16_t>& value);
|
||||
virtual void write(std::vector<int32_t>& value);
|
||||
virtual void write(std::vector<int64_t>& value);
|
||||
virtual void write(std::vector<float>& value);
|
||||
virtual void write(std::vector<double>& value);
|
||||
virtual void write(std::vector<std::string>& value);
|
||||
virtual void write(std::vector<Core::Time>& value);
|
||||
|
||||
//! Writes a vector of complex doubles
|
||||
virtual void write(std::vector<std::complex<double> >& value);
|
||||
|
||||
//! Writes a string
|
||||
virtual void write(std::string& value);
|
||||
|
||||
//! Writes a time
|
||||
virtual void write(Seiscomp::Core::Time& value);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Protected observer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void onObjectDestroyed(Object* object);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Protected interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Implements derived method
|
||||
virtual bool locateObjectByName(const char* name, const char* targetClass, bool nullable);
|
||||
//! Implements derived method
|
||||
virtual bool locateNextObjectByName(const char* name, const char* targetClass);
|
||||
//! Implements derived method
|
||||
virtual void locateNullObjectByName(const char* name, const char* targetClass, bool first);
|
||||
|
||||
//! Implements derived method
|
||||
virtual std::string determineClassName();
|
||||
|
||||
//! Implements derived method
|
||||
virtual void setClassName(const char*);
|
||||
|
||||
//! Implements derived method
|
||||
void serialize(RootType* object);
|
||||
|
||||
//! Implements derived method
|
||||
void serialize(SerializeDispatcher&);
|
||||
|
||||
std::string buildQuery(const std::string& table,
|
||||
const std::string& filter = "");
|
||||
std::string buildExtendedQuery(const std::string& what,
|
||||
const std::string& tables,
|
||||
const std::string& filter = "");
|
||||
|
||||
bool validInterface() const;
|
||||
|
||||
//! Associates an objects with an id and caches
|
||||
//! this information
|
||||
void registerId(const Object*, OID id);
|
||||
|
||||
//! Returns the number of cached object
|
||||
int getCacheSize() const;
|
||||
|
||||
//! Serializes an objects and registeres its id in the cache
|
||||
void serializeObject(Object*);
|
||||
|
||||
Object* queryObject(const Seiscomp::Core::RTTI& classType,
|
||||
const std::string& query);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Privates types
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
typedef std::map<const Object*, OID> ObjectIdMap;
|
||||
typedef std::map<std::string, OPT(std::string)> AttributeMap;
|
||||
|
||||
typedef std::pair<std::string, AttributeMap> ChildTable;
|
||||
typedef std::list<ChildTable> ChildTables;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
bool fetchVersion();
|
||||
|
||||
//! Removes an objects from the id cache
|
||||
void removeId(Object*);
|
||||
|
||||
//! Returns the current field content
|
||||
const char* cfield() const { return _field; }
|
||||
|
||||
std::string sfield() const { return std::string(_field, _fieldSize); }
|
||||
|
||||
//! Returns the current field size
|
||||
size_t fieldSize() const { return _fieldSize; }
|
||||
|
||||
//! Writes an attribute into the attribute map
|
||||
void writeAttrib(OPT_CR(std::string) value) const;
|
||||
|
||||
//! Reads an attribute from the query result
|
||||
void readAttrib() const;
|
||||
|
||||
//! Resets the attribute prefix
|
||||
void resetAttributePrefix() const;
|
||||
|
||||
//! Appends a name to the current attribute prefix
|
||||
void pushAttributePrefix(const char* name) const;
|
||||
|
||||
//! Removes the last attribute prefix when using complex types
|
||||
//! in one table.
|
||||
void popAttribPrefix() const;
|
||||
|
||||
void renderAttributes(const AttributeMap&);
|
||||
void renderValues(const AttributeMap&);
|
||||
|
||||
//! Returns an iterator for objects of a given type.
|
||||
DatabaseIterator getObjectIterator(OID parentID,
|
||||
const Seiscomp::Core::RTTI& classType,
|
||||
bool ignorePublicObject = false);
|
||||
|
||||
//! Queries for the database id of a PublicObject for
|
||||
//! a given publicID
|
||||
OID publicObjectId(const std::string& publicId);
|
||||
|
||||
//! Queries for the database id of an Object
|
||||
OID objectId(Object*, const std::string& parentID);
|
||||
|
||||
//! Insert a base object column and return its database id
|
||||
OID insertObject();
|
||||
|
||||
//! Insert a row into a table
|
||||
bool insertRow(const std::string& table,
|
||||
const AttributeMap& attributes,
|
||||
const std::string& parentId = "");
|
||||
|
||||
//! Delete an object with a given database id
|
||||
bool deleteObject(OID id);
|
||||
|
||||
protected:
|
||||
Seiscomp::IO::DatabaseInterfacePtr _db;
|
||||
|
||||
private:
|
||||
std::string _errorMsg;
|
||||
std::string _publicIDColumn;
|
||||
|
||||
mutable std::mutex _objectIdMutex;
|
||||
mutable ObjectIdMap _objectIdCache;
|
||||
mutable int _fieldIndex;
|
||||
mutable const char* _field;
|
||||
mutable size_t _fieldSize;
|
||||
|
||||
mutable AttributeMap _rootAttributes;
|
||||
mutable AttributeMap _indexAttributes;
|
||||
mutable AttributeMap* _objectAttributes;
|
||||
mutable ChildTables _childTables;
|
||||
mutable ChildTables::iterator _currentChildTable;
|
||||
mutable int _childDepth;
|
||||
|
||||
mutable std::string _currentAttributePrefix;
|
||||
mutable std::string _currentAttributeName;
|
||||
mutable bool _ignoreIndexAttributes;
|
||||
|
||||
mutable int _prefixPos;
|
||||
mutable std::string::size_type _prefixOffset[64];
|
||||
|
||||
bool _allowDbClose;
|
||||
|
||||
friend class DatabaseIterator;
|
||||
friend class AttributeMapper;
|
||||
friend class ValueMapper;
|
||||
};
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
466
include/seiscomp/datamodel/databasequery.h
Normal file
466
include/seiscomp/datamodel/databasequery.h
Normal file
@ -0,0 +1,466 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATABASE_QUERY_H__
|
||||
#define SEISCOMP_DATAMODEL_DATABASE_QUERY_H__
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/timequantity.h>
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/phase.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/timewindow.h>
|
||||
#include <seiscomp/datamodel/originquality.h>
|
||||
#include <seiscomp/datamodel/originuncertainty.h>
|
||||
#include <seiscomp/datamodel/integerquantity.h>
|
||||
#include <seiscomp/datamodel/nodalplanes.h>
|
||||
#include <seiscomp/datamodel/principalaxes.h>
|
||||
#include <seiscomp/datamodel/tensor.h>
|
||||
#include <seiscomp/datamodel/sourcetimefunction.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/complexarray.h>
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/datamodel/arclinkrequestsummary.h>
|
||||
#include <seiscomp/datamodel/arclinkstatusline.h>
|
||||
#include <seiscomp/datamodel/databasereader.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseQuery);
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
/** \brief Query class for the scheme packages
|
||||
* This class implements the query interface and executes a query
|
||||
* on a database.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DatabaseQuery : public DatabaseReader {
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DatabaseQuery(Seiscomp::IO::DatabaseInterface* dbDriver);
|
||||
|
||||
//! Destructor
|
||||
~DatabaseQuery();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Query interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
Station* getStation(const std::string& network_code,
|
||||
const std::string& station_code,
|
||||
Seiscomp::Core::Time time);
|
||||
|
||||
/**
|
||||
* Returns the Event referencing a particular Origin.
|
||||
* @param originID The publicID of the Origin
|
||||
* @return A pointer to the Event object
|
||||
*/
|
||||
Event* getEvent(const std::string& originID);
|
||||
|
||||
/**
|
||||
* Returns the Event having a particular preferredMagnitudeID.
|
||||
* @param magnitudeID The publicID of the NetworkMagnitude
|
||||
* @return A pointer to the Event object
|
||||
*/
|
||||
Event* getEventByPreferredMagnitudeID(const std::string& magnitudeID);
|
||||
|
||||
/**
|
||||
* Returns the Event referencing a particular FocalMechanism.
|
||||
* @param focalMechanismID The publicID of the FocalMechanism
|
||||
* @return A pointer to the Event object
|
||||
*/
|
||||
Event* getEventForFocalMechanism(const std::string& focalMechanismID);
|
||||
|
||||
/**
|
||||
* Returns the Event.
|
||||
* @param eventID The publicID of the Event
|
||||
* @return A pointer to the Event object
|
||||
*/
|
||||
Event* getEventByPublicID(const std::string& eventID);
|
||||
|
||||
/**
|
||||
* Returns an Amplitude of a particular type and
|
||||
* references a certain Pick.
|
||||
* @param pickID The referenced publicID of a Pick
|
||||
* @param type The type of the StationAmplitude
|
||||
* @return A pointer to the StationAmplitude object
|
||||
*/
|
||||
Amplitude* getAmplitude(const std::string& pickID,
|
||||
const std::string& type);
|
||||
|
||||
/**
|
||||
* Returns all Amplitudes in a given timewindow. As reference
|
||||
* time
|
||||
* for the Amplitude is timeWindow.reference used.
|
||||
* @param startTime The starttime of the timewindow
|
||||
* @param endTime The endtime of the timewindow
|
||||
* @return An iterator to iterate over the amplitudes.
|
||||
*/
|
||||
DatabaseIterator getAmplitudes(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns all Amplitudes referencing a certain Pick.
|
||||
* @param pickID The referenced publicID of a Pick
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getAmplitudesForPick(const std::string& pickID);
|
||||
|
||||
/**
|
||||
* Returns all Amplitudes that are references by the Arrivals
|
||||
* of an Origin.
|
||||
* @param originID The publicID of the Origin
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getAmplitudesForOrigin(const std::string& originID);
|
||||
|
||||
/**
|
||||
* Returns all Origins where an assoziated pick is references
|
||||
* by the
|
||||
* AmplitudeID.
|
||||
* @param amplitudeID The publicID of the Amplitude
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getOriginsForAmplitude(const std::string& amplitudeID);
|
||||
|
||||
/**
|
||||
* Returns all the origin that holds the given magnitude.
|
||||
* @param magnitudeID The publicID of the magnitude
|
||||
* @return A pointer to the Origin object
|
||||
*/
|
||||
Origin* getOriginByMagnitude(const std::string& magnitudeID);
|
||||
|
||||
/**
|
||||
* Returns all Arrivals where an assoziated pick is references
|
||||
* by the
|
||||
* AmplitudeID.
|
||||
* @param amplitudeID The publicID of the Amplitude
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getArrivalsForAmplitude(const std::string& amplitudeID);
|
||||
|
||||
/**
|
||||
* Returns all Picks that are references by the Arrivals of an
|
||||
* Origin.
|
||||
* @param originID The publicID of the Origin
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getPicks(const std::string& originID);
|
||||
|
||||
/**
|
||||
* Returns all Picks in a given timewindow
|
||||
* @param startTime The starttime of the timewindow
|
||||
* @param endTime The endtime of the timewindow
|
||||
* @return An iterator to iterate over the picks
|
||||
*/
|
||||
DatabaseIterator getPicks(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns all Picks in a given timewindow for a given stream
|
||||
* @param startTime The starttime of the timewindow
|
||||
* @param endTime The endtime of the timewindow
|
||||
* @param The waveformStreamID
|
||||
* @return An iterator to iterate over the picks
|
||||
*/
|
||||
DatabaseIterator getPicks(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const WaveformStreamID& waveformID);
|
||||
|
||||
/**
|
||||
* Returns current waveform quality reports or alerts
|
||||
* (assuming the end time is not set).
|
||||
* @param type report/alert
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getWaveformQuality(const std::string& type);
|
||||
|
||||
/**
|
||||
* Returns waveform quality reports in a given time window for
|
||||
* a given streamID and parameter.
|
||||
* @param streamID a WaveformStreamID
|
||||
* @param parameter latency/delay/timing quality/gaps
|
||||
* interval/gaps length/spikes interval/spikes amplitude/
|
||||
* spikes count/offset/rms/availability
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return an iterator to iterate over the WaveformQuality
|
||||
* objects
|
||||
*/
|
||||
DatabaseIterator getWaveformQuality(const WaveformStreamID& waveformID,
|
||||
const std::string& parameter,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns waveform quality reports in a given time window for
|
||||
* a given streamID and parameter.
|
||||
* @param parameter latency/delay/timing quality/gaps
|
||||
* interval/gaps length/spikes interval/spikes amplitude/
|
||||
* spikes count/offset/rms/availability
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return an iterator to iterate over the WaveformQuality
|
||||
* objects
|
||||
*/
|
||||
DatabaseIterator getWaveformQuality(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns waveform quality of a certain type (report/alert)
|
||||
* in a given time window for a given streamID and parameter.
|
||||
* @param streamID a WaveformStreamID
|
||||
* @param parameter latency/delay/timing quality/gaps
|
||||
* interval/gaps length/spikes interval/spikes amplitude/
|
||||
* spikes count/offset/rms/availability
|
||||
* @param type report/alert
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return an iterator to iterate over the WaveformQuality
|
||||
* objects
|
||||
*/
|
||||
DatabaseIterator getWaveformQuality(const WaveformStreamID& waveformID,
|
||||
const std::string& parameter,
|
||||
const std::string& type,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns WaveformQualities for a given waveformID, parameter
|
||||
* and type, ordered by end date
|
||||
* the youngest first.
|
||||
* @param streamID a WaveformStreamID
|
||||
* @param parameter latency/delay/timing quality/gaps
|
||||
* interval/gaps
|
||||
* length/spikes interval/spikes amplitude/ spikes
|
||||
* count/offset/rms/availability
|
||||
* @param type report/alert
|
||||
* @return An iterator to iterate over the WaveformQualities
|
||||
*/
|
||||
DatabaseIterator getWaveformQualityDescending(const WaveformStreamID& waveformID,
|
||||
const std::string& parameter,
|
||||
const std::string& type);
|
||||
|
||||
/**
|
||||
* Returns outages for the given waveform stream ID and the
|
||||
* given time window
|
||||
* @param streamID a WaveformStreamID
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return an iterator to iterate over the Outage objects
|
||||
*/
|
||||
DatabaseIterator getOutage(const WaveformStreamID& waveformID,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns qclogs for the given waveform stream ID and the
|
||||
* given time window
|
||||
* @param streamID a WaveformStreamID
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return an iterator to iterate over the QCLog objects
|
||||
*/
|
||||
DatabaseIterator getQCLog(const WaveformStreamID& waveformID,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns preferred origins of events in a given time range
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @param referenceOriginID origin to exclude
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getPreferredOrigins(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& referenceOriginID);
|
||||
|
||||
/**
|
||||
* Returns preferred magnitudes of events in a given time range
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @param referenceMagnitudeID magnitude to exclude
|
||||
* @return An iterator to iterate over the result set
|
||||
*/
|
||||
DatabaseIterator getPreferredMagnitudes(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& referenceMagnitudeID);
|
||||
|
||||
/**
|
||||
* Returns events in a given time range
|
||||
* @param startTime start time
|
||||
* @param endTime end time
|
||||
* @return An iterator to iterate over the events
|
||||
*/
|
||||
DatabaseIterator getEvents(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns origins for a given event ordered by creation date
|
||||
* the oldest first.
|
||||
* @param eventID The ID of the event
|
||||
* @return An iterator to iterate over the origins
|
||||
*/
|
||||
DatabaseIterator getOrigins(const std::string& eventID);
|
||||
|
||||
/**
|
||||
* Returns origins for a given event ordered by creation date
|
||||
* the youngest first.
|
||||
* @param eventID The ID of the event
|
||||
* @return An iterator to iterate over the origins
|
||||
*/
|
||||
DatabaseIterator getOriginsDescending(const std::string& eventID);
|
||||
|
||||
/**
|
||||
* Returns focal mechanisms for a given event ordered by
|
||||
* creation date
|
||||
* the youngest first.
|
||||
* @param eventID The ID of the event
|
||||
* @return An iterator to iterate over the focal mechanisms
|
||||
*/
|
||||
DatabaseIterator getFocalMechanismsDescending(const std::string& eventID);
|
||||
|
||||
/**
|
||||
* Returns the pickID's of all origins of an event with
|
||||
* given publicID
|
||||
* @param publicID The event's publicID (eventID)
|
||||
* @return An iterator to iterator over the result ID's
|
||||
* that are unique in the result set.
|
||||
*/
|
||||
DatabaseIterator getEventPickIDs(const std::string& publicID);
|
||||
|
||||
/**
|
||||
* Returns the pickID's of all origins of an event with
|
||||
* given publicID and with weight greater a given weight
|
||||
* @param publicID The event's publicID (eventID)
|
||||
* @param weight The minimum weight for an arrival
|
||||
* @return An iterator to iterator over the result ID's
|
||||
* that are unique in the result set.
|
||||
*/
|
||||
DatabaseIterator getEventPickIDsByWeight(const std::string& publicID,
|
||||
double weight);
|
||||
|
||||
/**
|
||||
* Returns the picks of all origins of an event with
|
||||
* given eventID.
|
||||
* @param eventID The event's publicID
|
||||
* @return An iterator to iterate over the picks where the
|
||||
* publicID is unique in the result set.
|
||||
*/
|
||||
DatabaseIterator getEventPicks(const std::string& eventID);
|
||||
|
||||
/**
|
||||
* Returns the picks of all origins of an event with
|
||||
* given publicID and with weight greater a given weight
|
||||
* @param publicID The event's publicID (eventID)
|
||||
* @param weight The minimum weight for an arrival
|
||||
* @return An iterator to iterator over the result ID's
|
||||
* that are unique in the result set.
|
||||
*/
|
||||
DatabaseIterator getEventPicksByWeight(const std::string& publicID,
|
||||
double weight);
|
||||
|
||||
/**
|
||||
* Returns the ConfigModule objects by name and state.
|
||||
*/
|
||||
DatabaseIterator getConfigModule(const std::string& name,
|
||||
bool enabled);
|
||||
|
||||
/**
|
||||
*/
|
||||
DatabaseIterator getEquivalentPick(const std::string& stationCode,
|
||||
const std::string& networkCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& channelCode,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime);
|
||||
|
||||
/**
|
||||
* Returns all journal entries for a particular PublicObject.
|
||||
*/
|
||||
DatabaseIterator getJournal(const std::string& objectID);
|
||||
|
||||
/**
|
||||
* Returns all journal entries for a particular PublicObject
|
||||
* related to an action.
|
||||
*/
|
||||
DatabaseIterator getJournalAction(const std::string& objectID,
|
||||
const std::string& action);
|
||||
|
||||
DatabaseIterator getArclinkRequestByStreamCode(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& channelCode,
|
||||
const std::string& type);
|
||||
|
||||
DatabaseIterator getArclinkRequestByRequestID(const std::string& requestID);
|
||||
|
||||
DatabaseIterator getArclinkRequestByUserID(const std::string& userID,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& type);
|
||||
|
||||
DatabaseIterator getArclinkRequestByTime(Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& type);
|
||||
|
||||
DatabaseIterator getArclinkRequest(const std::string& userID,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& channelCode,
|
||||
const std::string& type,
|
||||
const std::string& netClass);
|
||||
|
||||
DatabaseIterator getArclinkRequestRestricted(const std::string& userID,
|
||||
Seiscomp::Core::Time startTime,
|
||||
Seiscomp::Core::Time endTime,
|
||||
const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& channelCode,
|
||||
const std::string& type,
|
||||
const std::string& netClass,
|
||||
bool restricted);
|
||||
};
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
269
include/seiscomp/datamodel/databasereader.h
Normal file
269
include/seiscomp/datamodel/databasereader.h
Normal file
@ -0,0 +1,269 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATABASEREADER_H__
|
||||
#define SEISCOMP_DATAMODEL_DATABASEREADER_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/datamodel/databasearchive.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
class EventParameters;
|
||||
class Pick;
|
||||
class Comment;
|
||||
class Amplitude;
|
||||
class Reading;
|
||||
class PickReference;
|
||||
class AmplitudeReference;
|
||||
class Origin;
|
||||
class CompositeTime;
|
||||
class Arrival;
|
||||
class StationMagnitude;
|
||||
class Magnitude;
|
||||
class StationMagnitudeContribution;
|
||||
class FocalMechanism;
|
||||
class MomentTensor;
|
||||
class DataUsed;
|
||||
class MomentTensorPhaseSetting;
|
||||
class MomentTensorStationContribution;
|
||||
class MomentTensorComponentContribution;
|
||||
class Event;
|
||||
class EventDescription;
|
||||
class OriginReference;
|
||||
class FocalMechanismReference;
|
||||
class Config;
|
||||
class ParameterSet;
|
||||
class Parameter;
|
||||
class ConfigModule;
|
||||
class ConfigStation;
|
||||
class Setup;
|
||||
class QualityControl;
|
||||
class QCLog;
|
||||
class WaveformQuality;
|
||||
class Outage;
|
||||
class Inventory;
|
||||
class StationGroup;
|
||||
class StationReference;
|
||||
class AuxDevice;
|
||||
class AuxSource;
|
||||
class Sensor;
|
||||
class SensorCalibration;
|
||||
class Datalogger;
|
||||
class DataloggerCalibration;
|
||||
class Decimation;
|
||||
class ResponsePAZ;
|
||||
class ResponseFIR;
|
||||
class ResponseIIR;
|
||||
class ResponsePolynomial;
|
||||
class ResponseFAP;
|
||||
class Network;
|
||||
class Station;
|
||||
class SensorLocation;
|
||||
class AuxStream;
|
||||
class Stream;
|
||||
class Routing;
|
||||
class Route;
|
||||
class RouteArclink;
|
||||
class RouteSeedlink;
|
||||
class Access;
|
||||
class Journaling;
|
||||
class JournalEntry;
|
||||
class ArclinkLog;
|
||||
class ArclinkRequest;
|
||||
class ArclinkStatusLine;
|
||||
class ArclinkRequestLine;
|
||||
class ArclinkUser;
|
||||
class DataAvailability;
|
||||
class DataExtent;
|
||||
class DataSegment;
|
||||
class DataAttributeExtent;
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseReader);
|
||||
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
/** \brief Database reader class for the scheme classes
|
||||
* This class uses a database interface to read objects from a database.
|
||||
* Different database backends can be implemented by creating a driver
|
||||
* in seiscomp/services/database.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DatabaseReader : public DatabaseArchive {
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DatabaseReader(Seiscomp::IO::DatabaseInterface* dbDriver);
|
||||
|
||||
//! Destructor
|
||||
~DatabaseReader();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Read methods
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Loads the object with the given publicID from the
|
||||
* database with all its children and subchildren.
|
||||
* @param classType The type of the object
|
||||
* @param publicID The publicID of the object
|
||||
* @return An unmanaged pointer thats ownership goes
|
||||
* over to the caller. If no object has been found, NULL
|
||||
* is returned.
|
||||
*/
|
||||
PublicObject* loadObject(const Seiscomp::Core::RTTI& classType,
|
||||
const std::string& publicID);
|
||||
|
||||
EventParameters* loadEventParameters();
|
||||
int load(EventParameters*);
|
||||
int loadPicks(EventParameters*);
|
||||
int loadAmplitudes(EventParameters*);
|
||||
int loadReadings(EventParameters*);
|
||||
int loadOrigins(EventParameters*);
|
||||
int loadFocalMechanisms(EventParameters*);
|
||||
int loadEvents(EventParameters*);
|
||||
int load(Pick*);
|
||||
int loadComments(Pick*);
|
||||
int load(Amplitude*);
|
||||
int loadComments(Amplitude*);
|
||||
int load(Reading*);
|
||||
int loadPickReferences(Reading*);
|
||||
int loadAmplitudeReferences(Reading*);
|
||||
int load(Origin*);
|
||||
int loadComments(Origin*);
|
||||
int loadCompositeTimes(Origin*);
|
||||
int loadArrivals(Origin*);
|
||||
int loadStationMagnitudes(Origin*);
|
||||
int loadMagnitudes(Origin*);
|
||||
int load(StationMagnitude*);
|
||||
int loadComments(StationMagnitude*);
|
||||
int load(Magnitude*);
|
||||
int loadComments(Magnitude*);
|
||||
int loadStationMagnitudeContributions(Magnitude*);
|
||||
int load(FocalMechanism*);
|
||||
int loadComments(FocalMechanism*);
|
||||
int loadMomentTensors(FocalMechanism*);
|
||||
int load(MomentTensor*);
|
||||
int loadComments(MomentTensor*);
|
||||
int loadDataUseds(MomentTensor*);
|
||||
int loadMomentTensorPhaseSettings(MomentTensor*);
|
||||
int loadMomentTensorStationContributions(MomentTensor*);
|
||||
int load(MomentTensorStationContribution*);
|
||||
int loadMomentTensorComponentContributions(MomentTensorStationContribution*);
|
||||
int load(Event*);
|
||||
int loadEventDescriptions(Event*);
|
||||
int loadComments(Event*);
|
||||
int loadOriginReferences(Event*);
|
||||
int loadFocalMechanismReferences(Event*);
|
||||
|
||||
Config* loadConfig();
|
||||
int load(Config*);
|
||||
int loadParameterSets(Config*);
|
||||
int loadConfigModules(Config*);
|
||||
int load(ParameterSet*);
|
||||
int loadParameters(ParameterSet*);
|
||||
int loadComments(ParameterSet*);
|
||||
int load(Parameter*);
|
||||
int loadComments(Parameter*);
|
||||
int load(ConfigModule*);
|
||||
int loadConfigStations(ConfigModule*);
|
||||
int load(ConfigStation*);
|
||||
int loadSetups(ConfigStation*);
|
||||
|
||||
QualityControl* loadQualityControl();
|
||||
int load(QualityControl*);
|
||||
int loadQCLogs(QualityControl*);
|
||||
int loadWaveformQualitys(QualityControl*);
|
||||
int loadOutages(QualityControl*);
|
||||
|
||||
Inventory* loadInventory();
|
||||
int load(Inventory*);
|
||||
int loadStationGroups(Inventory*);
|
||||
int loadAuxDevices(Inventory*);
|
||||
int loadSensors(Inventory*);
|
||||
int loadDataloggers(Inventory*);
|
||||
int loadResponsePAZs(Inventory*);
|
||||
int loadResponseFIRs(Inventory*);
|
||||
int loadResponseIIRs(Inventory*);
|
||||
int loadResponsePolynomials(Inventory*);
|
||||
int loadResponseFAPs(Inventory*);
|
||||
int loadNetworks(Inventory*);
|
||||
int load(StationGroup*);
|
||||
int loadStationReferences(StationGroup*);
|
||||
int load(AuxDevice*);
|
||||
int loadAuxSources(AuxDevice*);
|
||||
int load(Sensor*);
|
||||
int loadSensorCalibrations(Sensor*);
|
||||
int load(Datalogger*);
|
||||
int loadDataloggerCalibrations(Datalogger*);
|
||||
int loadDecimations(Datalogger*);
|
||||
int load(Network*);
|
||||
int loadComments(Network*);
|
||||
int loadStations(Network*);
|
||||
int load(Station*);
|
||||
int loadComments(Station*);
|
||||
int loadSensorLocations(Station*);
|
||||
int load(SensorLocation*);
|
||||
int loadComments(SensorLocation*);
|
||||
int loadAuxStreams(SensorLocation*);
|
||||
int loadStreams(SensorLocation*);
|
||||
int load(Stream*);
|
||||
int loadComments(Stream*);
|
||||
|
||||
Routing* loadRouting();
|
||||
int load(Routing*);
|
||||
int loadRoutes(Routing*);
|
||||
int loadAccesss(Routing*);
|
||||
int load(Route*);
|
||||
int loadRouteArclinks(Route*);
|
||||
int loadRouteSeedlinks(Route*);
|
||||
|
||||
Journaling* loadJournaling();
|
||||
int load(Journaling*);
|
||||
int loadJournalEntrys(Journaling*);
|
||||
|
||||
ArclinkLog* loadArclinkLog();
|
||||
int load(ArclinkLog*);
|
||||
int loadArclinkRequests(ArclinkLog*);
|
||||
int loadArclinkUsers(ArclinkLog*);
|
||||
int load(ArclinkRequest*);
|
||||
int loadArclinkStatusLines(ArclinkRequest*);
|
||||
int loadArclinkRequestLines(ArclinkRequest*);
|
||||
|
||||
DataAvailability* loadDataAvailability();
|
||||
int load(DataAvailability*);
|
||||
int loadDataExtents(DataAvailability*);
|
||||
int load(DataExtent*);
|
||||
int loadDataSegments(DataExtent*);
|
||||
int loadDataAttributeExtents(DataExtent*);
|
||||
|
||||
};
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
262
include/seiscomp/datamodel/dataextent.h
Normal file
262
include/seiscomp/datamodel/dataextent.h
Normal file
@ -0,0 +1,262 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATAEXTENT_H
|
||||
#define SEISCOMP_DATAMODEL_DATAEXTENT_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/datasegment.h>
|
||||
#include <seiscomp/datamodel/dataattributeextent.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataExtent);
|
||||
DEFINE_SMARTPOINTER(DataSegment);
|
||||
DEFINE_SMARTPOINTER(DataAttributeExtent);
|
||||
|
||||
class DataAvailability;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataExtentIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataExtentIndex();
|
||||
DataExtentIndex(const WaveformStreamID& waveformID);
|
||||
|
||||
//! Copy constructor
|
||||
DataExtentIndex(const DataExtentIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DataExtentIndex&) const;
|
||||
bool operator!=(const DataExtentIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
WaveformStreamID waveformID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataExtent : public PublicObject {
|
||||
DECLARE_SC_CLASS(DataExtent)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
DataExtent();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
DataExtent(const DataExtent& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
DataExtent(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~DataExtent() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static DataExtent* Create();
|
||||
static DataExtent* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static DataExtent* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
DataExtent& operator=(const DataExtent& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataExtent& other) const;
|
||||
bool operator!=(const DataExtent& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataExtent& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setWaveformID(const WaveformStreamID& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
//! Time of first sample of data available
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! Time after last sample of data available
|
||||
void setEnd(Seiscomp::Core::Time end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! The time of the last update or creation of this segment
|
||||
void setUpdated(Seiscomp::Core::Time updated);
|
||||
Seiscomp::Core::Time updated() const;
|
||||
|
||||
//! The time of the last waveform archive scan
|
||||
void setLastScan(Seiscomp::Core::Time lastScan);
|
||||
Seiscomp::Core::Time lastScan() const;
|
||||
|
||||
//! Flags the stream to be to fragmented for processing.
|
||||
void setSegmentOverflow(bool segmentOverflow);
|
||||
bool segmentOverflow() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DataExtentIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const DataExtent* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(DataSegment* obj);
|
||||
bool add(DataAttributeExtent* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(DataSegment* obj);
|
||||
bool remove(DataAttributeExtent* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeDataSegment(size_t i);
|
||||
bool removeDataSegment(const DataSegmentIndex& i);
|
||||
bool removeDataAttributeExtent(size_t i);
|
||||
bool removeDataAttributeExtent(const DataAttributeExtentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t dataSegmentCount() const;
|
||||
size_t dataAttributeExtentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
DataSegment* dataSegment(size_t i) const;
|
||||
DataSegment* dataSegment(const DataSegmentIndex& i) const;
|
||||
|
||||
DataAttributeExtent* dataAttributeExtent(size_t i) const;
|
||||
DataAttributeExtent* dataAttributeExtent(const DataAttributeExtentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
DataAvailability* dataAvailability() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DataExtentIndex _index;
|
||||
|
||||
// Attributes
|
||||
Seiscomp::Core::Time _start;
|
||||
Seiscomp::Core::Time _end;
|
||||
Seiscomp::Core::Time _updated;
|
||||
Seiscomp::Core::Time _lastScan;
|
||||
bool _segmentOverflow;
|
||||
|
||||
// Aggregations
|
||||
std::vector<DataSegmentPtr> _dataSegments;
|
||||
std::vector<DataAttributeExtentPtr> _dataAttributeExtents;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(DataExtent);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
296
include/seiscomp/datamodel/datalogger.h
Normal file
296
include/seiscomp/datamodel/datalogger.h
Normal file
@ -0,0 +1,296 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATALOGGER_H
|
||||
#define SEISCOMP_DATAMODEL_DATALOGGER_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/dataloggercalibration.h>
|
||||
#include <seiscomp/datamodel/decimation.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Datalogger);
|
||||
DEFINE_SMARTPOINTER(DataloggerCalibration);
|
||||
DEFINE_SMARTPOINTER(Decimation);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataloggerIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataloggerIndex();
|
||||
DataloggerIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
DataloggerIndex(const DataloggerIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DataloggerIndex&) const;
|
||||
bool operator!=(const DataloggerIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a datalogger (digitizer and recorder)
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Datalogger : public PublicObject {
|
||||
DECLARE_SC_CLASS(Datalogger)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Datalogger();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Datalogger(const Datalogger& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Datalogger(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Datalogger() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Datalogger* Create();
|
||||
static Datalogger* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Datalogger* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Datalogger& operator=(const Datalogger& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Datalogger& other) const;
|
||||
bool operator!=(const Datalogger& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Datalogger& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique datalogger name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Datalogger description
|
||||
void setDescription(const std::string& description);
|
||||
const std::string& description() const;
|
||||
|
||||
//! Digitizer model
|
||||
void setDigitizerModel(const std::string& digitizerModel);
|
||||
const std::string& digitizerModel() const;
|
||||
|
||||
//! Digitizer manufacturer
|
||||
void setDigitizerManufacturer(const std::string& digitizerManufacturer);
|
||||
const std::string& digitizerManufacturer() const;
|
||||
|
||||
//! Recorder model
|
||||
void setRecorderModel(const std::string& recorderModel);
|
||||
const std::string& recorderModel() const;
|
||||
|
||||
//! Recorder manufacturer
|
||||
void setRecorderManufacturer(const std::string& recorderManufacturer);
|
||||
const std::string& recorderManufacturer() const;
|
||||
|
||||
//! Clock model (mostly unused)
|
||||
void setClockModel(const std::string& clockModel);
|
||||
const std::string& clockModel() const;
|
||||
|
||||
//! Clock manufacturer (mostly unused)
|
||||
void setClockManufacturer(const std::string& clockManufacturer);
|
||||
const std::string& clockManufacturer() const;
|
||||
|
||||
//! Clock type (mostly unused)
|
||||
void setClockType(const std::string& clockType);
|
||||
const std::string& clockType() const;
|
||||
|
||||
//! Sensitivity of digitizer, counts/V (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Max clock drift, seconds/second (not identical to 52.19,
|
||||
//! which is seconds/sample)
|
||||
void setMaxClockDrift(const OPT(double)& maxClockDrift);
|
||||
double maxClockDrift() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DataloggerIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Datalogger* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(DataloggerCalibration* obj);
|
||||
bool add(Decimation* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(DataloggerCalibration* obj);
|
||||
bool remove(Decimation* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeDataloggerCalibration(size_t i);
|
||||
bool removeDataloggerCalibration(const DataloggerCalibrationIndex& i);
|
||||
bool removeDecimation(size_t i);
|
||||
bool removeDecimation(const DecimationIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t dataloggerCalibrationCount() const;
|
||||
size_t decimationCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
DataloggerCalibration* dataloggerCalibration(size_t i) const;
|
||||
DataloggerCalibration* dataloggerCalibration(const DataloggerCalibrationIndex& i) const;
|
||||
|
||||
Decimation* decimation(size_t i) const;
|
||||
Decimation* decimation(const DecimationIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DataloggerIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _description;
|
||||
std::string _digitizerModel;
|
||||
std::string _digitizerManufacturer;
|
||||
std::string _recorderModel;
|
||||
std::string _recorderManufacturer;
|
||||
std::string _clockModel;
|
||||
std::string _clockManufacturer;
|
||||
std::string _clockType;
|
||||
OPT(double) _gain;
|
||||
OPT(double) _maxClockDrift;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
// Aggregations
|
||||
std::vector<DataloggerCalibrationPtr> _dataloggerCalibrations;
|
||||
std::vector<DecimationPtr> _decimations;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Datalogger);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
193
include/seiscomp/datamodel/dataloggercalibration.h
Normal file
193
include/seiscomp/datamodel/dataloggercalibration.h
Normal file
@ -0,0 +1,193 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATALOGGERCALIBRATION_H
|
||||
#define SEISCOMP_DATAMODEL_DATALOGGERCALIBRATION_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataloggerCalibration);
|
||||
|
||||
class Datalogger;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataloggerCalibrationIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataloggerCalibrationIndex();
|
||||
DataloggerCalibrationIndex(const std::string& serialNumber,
|
||||
int channel,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
DataloggerCalibrationIndex(const DataloggerCalibrationIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DataloggerCalibrationIndex&) const;
|
||||
bool operator!=(const DataloggerCalibrationIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string serialNumber;
|
||||
int channel;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a datalogger calibration
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DataloggerCalibration : public Object {
|
||||
DECLARE_SC_CLASS(DataloggerCalibration)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataloggerCalibration();
|
||||
|
||||
//! Copy constructor
|
||||
DataloggerCalibration(const DataloggerCalibration& other);
|
||||
|
||||
//! Destructor
|
||||
~DataloggerCalibration() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
DataloggerCalibration& operator=(const DataloggerCalibration& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataloggerCalibration& other) const;
|
||||
bool operator!=(const DataloggerCalibration& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataloggerCalibration& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Referred from network/station/Stream/@dataloggerSerialNumber
|
||||
void setSerialNumber(const std::string& serialNumber);
|
||||
const std::string& serialNumber() const;
|
||||
|
||||
//! Referred from network/station/Stream/@dataloggerChannel
|
||||
void setChannel(int channel);
|
||||
int channel() const;
|
||||
|
||||
//! Start of validity
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of validity
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! Overrides nominal gain of calibrated datalogger
|
||||
//! (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DataloggerCalibrationIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const DataloggerCalibration* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Datalogger* datalogger() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DataloggerCalibrationIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
OPT(Blob) _remark;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
182
include/seiscomp/datamodel/datasegment.h
Normal file
182
include/seiscomp/datamodel/datasegment.h
Normal file
@ -0,0 +1,182 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATASEGMENT_H
|
||||
#define SEISCOMP_DATAMODEL_DATASEGMENT_H
|
||||
|
||||
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataSegment);
|
||||
|
||||
class DataExtent;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataSegmentIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataSegmentIndex();
|
||||
DataSegmentIndex(Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
DataSegmentIndex(const DataSegmentIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DataSegmentIndex&) const;
|
||||
bool operator!=(const DataSegmentIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DataSegment : public Object {
|
||||
DECLARE_SC_CLASS(DataSegment)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataSegment();
|
||||
|
||||
//! Copy constructor
|
||||
DataSegment(const DataSegment& other);
|
||||
|
||||
//! Destructor
|
||||
~DataSegment() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
DataSegment& operator=(const DataSegment& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataSegment& other) const;
|
||||
bool operator!=(const DataSegment& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataSegment& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Time of first sample of data segment.
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! Time after last sample of data segment.
|
||||
void setEnd(Seiscomp::Core::Time end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! The time of the last update or creation of this data
|
||||
//! segment.
|
||||
void setUpdated(Seiscomp::Core::Time updated);
|
||||
Seiscomp::Core::Time updated() const;
|
||||
|
||||
//! Sample rate of the current data segment.
|
||||
void setSampleRate(double sampleRate);
|
||||
double sampleRate() const;
|
||||
|
||||
//! Quality indicator of current data segment.
|
||||
void setQuality(const std::string& quality);
|
||||
const std::string& quality() const;
|
||||
|
||||
//! Whether this segment is an out-of-order segment or not.
|
||||
void setOutOfOrder(bool outOfOrder);
|
||||
bool outOfOrder() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DataSegmentIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const DataSegment* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
DataExtent* dataExtent() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DataSegmentIndex _index;
|
||||
|
||||
// Attributes
|
||||
Seiscomp::Core::Time _end;
|
||||
Seiscomp::Core::Time _updated;
|
||||
double _sampleRate;
|
||||
std::string _quality;
|
||||
bool _outOfOrder;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
134
include/seiscomp/datamodel/dataused.h
Normal file
134
include/seiscomp/datamodel/dataused.h
Normal file
@ -0,0 +1,134 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DATAUSED_H
|
||||
#define SEISCOMP_DATAMODEL_DATAUSED_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DataUsed);
|
||||
|
||||
class MomentTensor;
|
||||
|
||||
|
||||
/**
|
||||
* \brief The DataUsed class describes the type of data that has been
|
||||
* \brief used for a
|
||||
* \brief moment-tensor inversion.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API DataUsed : public Object {
|
||||
DECLARE_SC_CLASS(DataUsed)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DataUsed();
|
||||
|
||||
//! Copy constructor
|
||||
DataUsed(const DataUsed& other);
|
||||
|
||||
//! Destructor
|
||||
~DataUsed() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
DataUsed& operator=(const DataUsed& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const DataUsed& other) const;
|
||||
bool operator!=(const DataUsed& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const DataUsed& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Type of waveform data.
|
||||
void setWaveType(DataUsedWaveType waveType);
|
||||
DataUsedWaveType waveType() const;
|
||||
|
||||
//! Number of stations that have contributed data of the type
|
||||
//! given in waveType.
|
||||
void setStationCount(int stationCount);
|
||||
int stationCount() const;
|
||||
|
||||
//! Number of data components of the type given in waveType.
|
||||
void setComponentCount(int componentCount);
|
||||
int componentCount() const;
|
||||
|
||||
//! Shortest period present in data in seconds.
|
||||
void setShortestPeriod(const OPT(double)& shortestPeriod);
|
||||
double shortestPeriod() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
MomentTensor* momentTensor() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
DataUsedWaveType _waveType;
|
||||
int _stationCount;
|
||||
int _componentCount;
|
||||
OPT(double) _shortestPeriod;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
182
include/seiscomp/datamodel/decimation.h
Normal file
182
include/seiscomp/datamodel/decimation.h
Normal file
@ -0,0 +1,182 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DECIMATION_H
|
||||
#define SEISCOMP_DATAMODEL_DECIMATION_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Decimation);
|
||||
|
||||
class Datalogger;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API DecimationIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
DecimationIndex();
|
||||
DecimationIndex(int sampleRateNumerator,
|
||||
int sampleRateDenominator);
|
||||
|
||||
//! Copy constructor
|
||||
DecimationIndex(const DecimationIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const DecimationIndex&) const;
|
||||
bool operator!=(const DecimationIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
int sampleRateNumerator;
|
||||
int sampleRateDenominator;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a decimation to a certain sample rate
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Decimation : public Object {
|
||||
DECLARE_SC_CLASS(Decimation)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Decimation();
|
||||
|
||||
//! Copy constructor
|
||||
Decimation(const Decimation& other);
|
||||
|
||||
//! Destructor
|
||||
~Decimation() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Decimation& operator=(const Decimation& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Decimation& other) const;
|
||||
bool operator!=(const Decimation& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Decimation& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Output sample rate (numerator); referred from
|
||||
//! network/station/Stream/@sampleRateNumerator
|
||||
void setSampleRateNumerator(int sampleRateNumerator);
|
||||
int sampleRateNumerator() const;
|
||||
|
||||
//! Output sample rate (denominator); referred from
|
||||
//! network/station/Stream/@sampleRateDenominator
|
||||
void setSampleRateDenominator(int sampleRateDenominator);
|
||||
int sampleRateDenominator() const;
|
||||
|
||||
//! Specifies analogue filters between seismometer and
|
||||
//! digitizer. Each element (separated by space) references
|
||||
//! responsePAZ/@publicID
|
||||
void setAnalogueFilterChain(const OPT(Blob)& analogueFilterChain);
|
||||
Blob& analogueFilterChain();
|
||||
const Blob& analogueFilterChain() const;
|
||||
|
||||
//! Specifies digital filters (decimation, gain removal). Each
|
||||
//! element (separated by space) references
|
||||
//! responsePAZ@publicID or responseFIR/@publicID
|
||||
void setDigitalFilterChain(const OPT(Blob)& digitalFilterChain);
|
||||
Blob& digitalFilterChain();
|
||||
const Blob& digitalFilterChain() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const DecimationIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Decimation* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Datalogger* datalogger() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
DecimationIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Blob) _analogueFilterChain;
|
||||
OPT(Blob) _digitalFilterChain;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
233
include/seiscomp/datamodel/diff.h
Normal file
233
include/seiscomp/datamodel/diff.h
Normal file
@ -0,0 +1,233 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_DIFF_H
|
||||
#define SEISCOMP_DATAMODEL_DIFF_H
|
||||
|
||||
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
/**
|
||||
* @brief An object tree difference calculator.
|
||||
*
|
||||
* This class implements a difference calculator between two object trees.
|
||||
* The goal is to have have same tree on both sides after the operation.
|
||||
* The result is a list of notifiers. Both object trees won't be changed.
|
||||
*/
|
||||
class Diff2 {
|
||||
public:
|
||||
DEFINE_SMARTPOINTER(LogNode);
|
||||
class LogNode: public Core::BaseObject {
|
||||
public:
|
||||
enum LogLevel {
|
||||
OPERATIONS = 0, // e.g. ADD, UPDATE, REMOVE, MERGE
|
||||
DIFFERENCES = 1, // objects and its children which differ
|
||||
ALL = 2 // all objects and its children
|
||||
};
|
||||
|
||||
LogNode(const std::string &title = "",
|
||||
LogLevel level = OPERATIONS,
|
||||
LogNode *parent = nullptr)
|
||||
: _title(title), _level(level), _parent(parent) {}
|
||||
|
||||
inline const std::string& title() const { return _title; }
|
||||
inline void setTitle(const std::string &title) { _title = title; }
|
||||
|
||||
inline LogLevel level() const { return _level; }
|
||||
inline void setLevel(LogLevel level) { _level = level; }
|
||||
|
||||
inline LogNode* parent() const { return _parent; }
|
||||
inline void setParent(LogNode* parent) { _parent = parent; }
|
||||
|
||||
inline LogNode* addChild(const std::string &title,
|
||||
const std::string &msg = "") {
|
||||
LogNode *child = new LogNode(title, _level, this);
|
||||
child->setMessage(msg);
|
||||
_children.push_back(child);
|
||||
return child;
|
||||
}
|
||||
inline void addChild(LogNode *logNode, const std::string &msg = "") {
|
||||
if ( !msg.empty() )
|
||||
logNode->setMessage(msg);
|
||||
logNode->setParent(this);
|
||||
_children.push_back(logNode);
|
||||
}
|
||||
inline size_t childCount() { return _children.size(); }
|
||||
|
||||
inline void setMessage(const std::string &msg) { _message = msg; }
|
||||
|
||||
void write(std::ostream &os, int padding = 0, int indent = 1,
|
||||
bool ignoreFirstPad = false) const;
|
||||
|
||||
private:
|
||||
std::string _title;
|
||||
LogLevel _level;
|
||||
LogNode *_parent;
|
||||
|
||||
std::vector<LogNodePtr> _children;
|
||||
std::string _message;
|
||||
};
|
||||
|
||||
typedef std::vector<NotifierPtr> Notifiers;
|
||||
typedef std::map<std::string, const Core::MetaProperty*> PropertyIndex;
|
||||
|
||||
|
||||
public:
|
||||
Diff2();
|
||||
virtual ~Diff2();
|
||||
|
||||
/**
|
||||
* @brief Calculates a list of notifiers so that o1 will reflect the
|
||||
* state of o2.
|
||||
* @param o1 The target tree.
|
||||
* @param o2 The reference tree.
|
||||
* @param o1ParentID The optional parent ID of o1.
|
||||
* @param notifiers The list of notifiers to be populated.
|
||||
* @param logNode The log node root which will be populated with
|
||||
* log messages. This is optional.
|
||||
*/
|
||||
void diff(Object *o1, Object *o2,
|
||||
const std::string &o1ParentID, Notifiers ¬ifiers,
|
||||
LogNode *logNode = nullptr);
|
||||
|
||||
NotifierMessage *diff2Message(Object *o1, Object *o2,
|
||||
const std::string &o1ParentID, LogNode *logNode = nullptr);
|
||||
|
||||
protected:
|
||||
std::string o2t(const Core::BaseObject *o) const;
|
||||
void createLogNodes(LogNode *rootLogNode, const std::string &rootID,
|
||||
Notifiers::const_iterator begin,
|
||||
Notifiers::const_iterator end);
|
||||
|
||||
/**
|
||||
* @brief Allows for derived classes to block an object.
|
||||
* @param o The object to be checked.
|
||||
* @param node The log node which can be used to set reason for the blocking.
|
||||
* @param local Whether it is the local object (true) or the remote (false).
|
||||
* @return true if the object is blocked, false if should be processed.
|
||||
*/
|
||||
virtual bool blocked(const Core::BaseObject *o, LogNode *node, bool local);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief An object tree difference calculator version 3.
|
||||
*
|
||||
* In addition to Diff2 this class allows for derived classes to skip possible
|
||||
* updates. For that the virtual method confirmUpdate has been introduced which
|
||||
* allows to block an update based on some criteria, e.g. comparison result of
|
||||
* creation or modification time.
|
||||
*/
|
||||
class Diff3 : public Diff2 {
|
||||
public:
|
||||
void diff(Object *o1, Object *o2,
|
||||
const std::string &o1ParentID, Notifiers ¬ifiers,
|
||||
LogNode *logNode = nullptr);
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Decide whether an object may be updated or not.
|
||||
*
|
||||
* If the algorithm decides that the local object must be updated
|
||||
* to reflect the remote object it will call this method to ask for
|
||||
* permission to do so.
|
||||
*
|
||||
* Even if the object is not allowed to be updated, the algorithm will
|
||||
* still decent to child objects.
|
||||
*
|
||||
* @param localO The local object which would receive the update.
|
||||
* @param remoteO The remote object, the reference.
|
||||
* @param node The log node.
|
||||
* @return true if the object may be updated, false otherwise.
|
||||
*/
|
||||
virtual bool confirmUpdate(const Core::BaseObject *localO,
|
||||
const Core::BaseObject *remoteO,
|
||||
LogNode *node) = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief An object tree difference calculator version 4.
|
||||
*
|
||||
* In addition to version 3 this class allows for derived classes to decide
|
||||
* whether decending to child nodes is allowed or not on a per node basis.
|
||||
*
|
||||
* Sometimes it might be desirable to skip an entire subtree if the parent
|
||||
* object must not be updated, e.g. if the modification time of the local object
|
||||
* is later than the modification time of the remote object and child objects
|
||||
* do not provide any information to compare modification times.
|
||||
*
|
||||
* @version 15.1
|
||||
*/
|
||||
class Diff4 : public Diff3 {
|
||||
public:
|
||||
void diff(Object *o1, Object *o2,
|
||||
const std::string &o1ParentID, Notifiers ¬ifiers,
|
||||
LogNode *logNode = nullptr);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Confirm removal of an object.
|
||||
*
|
||||
* This method will be called if there is not remote counterpart.
|
||||
*
|
||||
* @param localO The local object
|
||||
* @param node The log node
|
||||
* @return true if the object is allowed to be removed, false otherwise
|
||||
*/
|
||||
virtual bool confirmRemove(const Core::BaseObject *localO,
|
||||
LogNode *node) = 0;
|
||||
|
||||
/**
|
||||
* @brief Confirm descending to child objects.
|
||||
*
|
||||
* This method will only be called on array properties.
|
||||
*
|
||||
* @param localO The local parent node.
|
||||
* @param remoteO The remote parent node.
|
||||
* @param updateConfirmed The state of the preceding confirmUpdate call.
|
||||
* @param property The property which reflects the subtree.
|
||||
* @param node The log node.
|
||||
* @return true if descending is allowed, false otherwise.
|
||||
*/
|
||||
virtual bool confirmDescent(const Core::BaseObject *localO,
|
||||
const Core::BaseObject *remoteO,
|
||||
bool updateConfirmed,
|
||||
const Core::MetaProperty *property,
|
||||
LogNode *node) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // ns DataModel
|
||||
} // ns Seiscomp
|
||||
|
||||
#endif // SEISCOMP_DATAMODEL_DIFF_H__
|
||||
263
include/seiscomp/datamodel/event.h
Normal file
263
include/seiscomp/datamodel/event.h
Normal file
@ -0,0 +1,263 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_EVENT_H
|
||||
#define SEISCOMP_DATAMODEL_EVENT_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/eventdescription.h>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/originreference.h>
|
||||
#include <seiscomp/datamodel/focalmechanismreference.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Event);
|
||||
DEFINE_SMARTPOINTER(EventDescription);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(OriginReference);
|
||||
DEFINE_SMARTPOINTER(FocalMechanismReference);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief The class Event describes a seismic event which does not
|
||||
* \brief necessarily need
|
||||
* \brief to be a tectonic earthquake. An event is usually associated
|
||||
* \brief with one or
|
||||
* \brief more origins, which contain information about focal time
|
||||
* \brief and geographical
|
||||
* \brief location of the event. Multiple origins can cover automatic
|
||||
* \brief and manual
|
||||
* \brief locations, a set of location from different agencies,
|
||||
* \brief locations generated
|
||||
* \brief with different location programs and earth models, etc.
|
||||
* \brief Furthermore, an event
|
||||
* \brief is usually associated with one or more magnitudes, and with
|
||||
* \brief one or more focal
|
||||
* \brief mechanism determinations.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Event : public PublicObject {
|
||||
DECLARE_SC_CLASS(Event)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Event();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Event(const Event& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Event(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Event() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Event* Create();
|
||||
static Event* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Event* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Event& operator=(const Event& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Event& other) const;
|
||||
bool operator!=(const Event& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Event& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Refers to the publicID of the preferred Origin object.
|
||||
void setPreferredOriginID(const std::string& preferredOriginID);
|
||||
const std::string& preferredOriginID() const;
|
||||
|
||||
//! Refers to the publicID of the preferred Magnitude object.
|
||||
void setPreferredMagnitudeID(const std::string& preferredMagnitudeID);
|
||||
const std::string& preferredMagnitudeID() const;
|
||||
|
||||
//! Refers to the publicID of the preferred FocalMechanism
|
||||
//! object.
|
||||
void setPreferredFocalMechanismID(const std::string& preferredFocalMechanismID);
|
||||
const std::string& preferredFocalMechanismID() const;
|
||||
|
||||
//! Describes the type of an event (Storchak et al. 2012).
|
||||
void setType(const OPT(EventType)& type);
|
||||
EventType type() const;
|
||||
|
||||
//! Denotes how certain the information on event type is
|
||||
//! (Storchak et al. 2012).
|
||||
void setTypeCertainty(const OPT(EventTypeCertainty)& typeCertainty);
|
||||
EventTypeCertainty typeCertainty() const;
|
||||
|
||||
//! CreationInfo for the Event object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(EventDescription* obj);
|
||||
bool add(Comment* obj);
|
||||
bool add(OriginReference* obj);
|
||||
bool add(FocalMechanismReference* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(EventDescription* obj);
|
||||
bool remove(Comment* obj);
|
||||
bool remove(OriginReference* obj);
|
||||
bool remove(FocalMechanismReference* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeEventDescription(size_t i);
|
||||
bool removeEventDescription(const EventDescriptionIndex& i);
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeOriginReference(size_t i);
|
||||
bool removeOriginReference(const OriginReferenceIndex& i);
|
||||
bool removeFocalMechanismReference(size_t i);
|
||||
bool removeFocalMechanismReference(const FocalMechanismReferenceIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t eventDescriptionCount() const;
|
||||
size_t commentCount() const;
|
||||
size_t originReferenceCount() const;
|
||||
size_t focalMechanismReferenceCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
EventDescription* eventDescription(size_t i) const;
|
||||
EventDescription* eventDescription(const EventDescriptionIndex& i) const;
|
||||
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
OriginReference* originReference(size_t i) const;
|
||||
OriginReference* originReference(const OriginReferenceIndex& i) const;
|
||||
|
||||
FocalMechanismReference* focalMechanismReference(size_t i) const;
|
||||
FocalMechanismReference* focalMechanismReference(const FocalMechanismReferenceIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _preferredOriginID;
|
||||
std::string _preferredMagnitudeID;
|
||||
std::string _preferredFocalMechanismID;
|
||||
OPT(EventType) _type;
|
||||
OPT(EventTypeCertainty) _typeCertainty;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<EventDescriptionPtr> _eventDescriptions;
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<OriginReferencePtr> _originReferences;
|
||||
std::vector<FocalMechanismReferencePtr> _focalMechanismReferences;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Event);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
173
include/seiscomp/datamodel/eventdescription.h
Normal file
173
include/seiscomp/datamodel/eventdescription.h
Normal file
@ -0,0 +1,173 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_EVENTDESCRIPTION_H
|
||||
#define SEISCOMP_DATAMODEL_EVENTDESCRIPTION_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(EventDescription);
|
||||
|
||||
class Event;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API EventDescriptionIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
EventDescriptionIndex();
|
||||
EventDescriptionIndex(EventDescriptionType type);
|
||||
|
||||
//! Copy constructor
|
||||
EventDescriptionIndex(const EventDescriptionIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const EventDescriptionIndex&) const;
|
||||
bool operator!=(const EventDescriptionIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
EventDescriptionType type;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Free-form string with additional event description. This
|
||||
* \brief can be a
|
||||
* \brief well-known name, like 1906 San Francisco Earthquake. A
|
||||
* \brief number of
|
||||
* \brief categories can be given in type.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API EventDescription : public Object {
|
||||
DECLARE_SC_CLASS(EventDescription)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
EventDescription();
|
||||
|
||||
//! Copy constructor
|
||||
EventDescription(const EventDescription& other);
|
||||
|
||||
//! Custom constructor
|
||||
EventDescription(const std::string& text);
|
||||
EventDescription(const std::string& text,
|
||||
EventDescriptionType type);
|
||||
|
||||
//! Destructor
|
||||
~EventDescription() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
EventDescription& operator=(const EventDescription& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const EventDescription& other) const;
|
||||
bool operator!=(const EventDescription& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const EventDescription& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Free-form text with earthquake description.
|
||||
void setText(const std::string& text);
|
||||
const std::string& text() const;
|
||||
|
||||
//! Category of earthquake description.
|
||||
void setType(EventDescriptionType type);
|
||||
EventDescriptionType type() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const EventDescriptionIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const EventDescription* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Event* event() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
EventDescriptionIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _text;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
190
include/seiscomp/datamodel/eventparameters.h
Normal file
190
include/seiscomp/datamodel/eventparameters.h
Normal file
@ -0,0 +1,190 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_EVENTPARAMETERS_H
|
||||
#define SEISCOMP_DATAMODEL_EVENTPARAMETERS_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(EventParameters);
|
||||
DEFINE_SMARTPOINTER(Pick);
|
||||
DEFINE_SMARTPOINTER(Amplitude);
|
||||
DEFINE_SMARTPOINTER(Reading);
|
||||
DEFINE_SMARTPOINTER(Origin);
|
||||
DEFINE_SMARTPOINTER(FocalMechanism);
|
||||
DEFINE_SMARTPOINTER(Event);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type can hold objects of type Event, Origin,
|
||||
* \brief Magnitude, StationMagnitude,
|
||||
* \brief FocalMechanism, Reading, Amplitude, and Pick.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API EventParameters : public PublicObject {
|
||||
DECLARE_SC_CLASS(EventParameters)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
EventParameters();
|
||||
|
||||
//! Copy constructor
|
||||
EventParameters(const EventParameters& other);
|
||||
|
||||
//! Destructor
|
||||
~EventParameters() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
EventParameters& operator=(const EventParameters& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const EventParameters& other) const;
|
||||
bool operator!=(const EventParameters& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const EventParameters& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Pick* obj);
|
||||
bool add(Amplitude* obj);
|
||||
bool add(Reading* obj);
|
||||
bool add(Origin* obj);
|
||||
bool add(FocalMechanism* obj);
|
||||
bool add(Event* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Pick* obj);
|
||||
bool remove(Amplitude* obj);
|
||||
bool remove(Reading* obj);
|
||||
bool remove(Origin* obj);
|
||||
bool remove(FocalMechanism* obj);
|
||||
bool remove(Event* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removePick(size_t i);
|
||||
bool removeAmplitude(size_t i);
|
||||
bool removeReading(size_t i);
|
||||
bool removeOrigin(size_t i);
|
||||
bool removeFocalMechanism(size_t i);
|
||||
bool removeEvent(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t pickCount() const;
|
||||
size_t amplitudeCount() const;
|
||||
size_t readingCount() const;
|
||||
size_t originCount() const;
|
||||
size_t focalMechanismCount() const;
|
||||
size_t eventCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Pick* pick(size_t i) const;
|
||||
Amplitude* amplitude(size_t i) const;
|
||||
Reading* reading(size_t i) const;
|
||||
Origin* origin(size_t i) const;
|
||||
FocalMechanism* focalMechanism(size_t i) const;
|
||||
Event* event(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
Pick* findPick(const std::string& publicID) const;
|
||||
Amplitude* findAmplitude(const std::string& publicID) const;
|
||||
Reading* findReading(const std::string& publicID) const;
|
||||
Origin* findOrigin(const std::string& publicID) const;
|
||||
FocalMechanism* findFocalMechanism(const std::string& publicID) const;
|
||||
Event* findEvent(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<PickPtr> _picks;
|
||||
std::vector<AmplitudePtr> _amplitudes;
|
||||
std::vector<ReadingPtr> _readings;
|
||||
std::vector<OriginPtr> _origins;
|
||||
std::vector<FocalMechanismPtr> _focalMechanisms;
|
||||
std::vector<EventPtr> _events;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(EventParameters);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
49
include/seiscomp/datamodel/eventparameters_package.h
Normal file
49
include/seiscomp/datamodel/eventparameters_package.h
Normal file
@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_EVENTPARAMETERS_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_EVENTPARAMETERS_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/eventdescription.h>
|
||||
#include <seiscomp/datamodel/dataused.h>
|
||||
#include <seiscomp/datamodel/compositetime.h>
|
||||
#include <seiscomp/datamodel/pickreference.h>
|
||||
#include <seiscomp/datamodel/amplitudereference.h>
|
||||
#include <seiscomp/datamodel/reading.h>
|
||||
#include <seiscomp/datamodel/momenttensorcomponentcontribution.h>
|
||||
#include <seiscomp/datamodel/momenttensorstationcontribution.h>
|
||||
#include <seiscomp/datamodel/momenttensorphasesetting.h>
|
||||
#include <seiscomp/datamodel/momenttensor.h>
|
||||
#include <seiscomp/datamodel/focalmechanism.h>
|
||||
#include <seiscomp/datamodel/amplitude.h>
|
||||
#include <seiscomp/datamodel/stationmagnitudecontribution.h>
|
||||
#include <seiscomp/datamodel/magnitude.h>
|
||||
#include <seiscomp/datamodel/stationmagnitude.h>
|
||||
#include <seiscomp/datamodel/pick.h>
|
||||
#include <seiscomp/datamodel/originreference.h>
|
||||
#include <seiscomp/datamodel/focalmechanismreference.h>
|
||||
#include <seiscomp/datamodel/event.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/origin.h>
|
||||
#include <seiscomp/datamodel/eventparameters.h>
|
||||
|
||||
|
||||
#endif
|
||||
57
include/seiscomp/datamodel/exchange/arclink.h
Normal file
57
include/seiscomp/datamodel/exchange/arclink.h
Normal file
@ -0,0 +1,57 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ARCLINK_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_ARCLINK_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/xml/importer.h>
|
||||
#include <seiscomp/io/xml/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ImporterArclink : public IO::XML::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterArclink();
|
||||
};
|
||||
|
||||
|
||||
class ExporterArclink : public IO::XML::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterArclink();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
107
include/seiscomp/datamodel/exchange/binary.h
Normal file
107
include/seiscomp/datamodel/exchange/binary.h
Normal file
@ -0,0 +1,107 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_BINARY_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_BINARY_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/xml/importer.h>
|
||||
#include <seiscomp/io/xml/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ImporterBinary : public IO::XML::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterBinary() = default;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Importer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
Core::BaseObject *get(std::streambuf* buf) override;
|
||||
};
|
||||
|
||||
|
||||
class ImporterVBinary : public IO::XML::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterVBinary() = default;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Importer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
Core::BaseObject *get(std::streambuf* buf) override;
|
||||
};
|
||||
|
||||
|
||||
class ExporterBinary : public IO::XML::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterBinary() = default;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
bool put(std::streambuf* buf, const IO::ExportObjectList &objects);
|
||||
};
|
||||
|
||||
|
||||
class ExporterVBinary : public IO::XML::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterVBinary() = default;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
bool put(std::streambuf* buf, const IO::ExportObjectList &objects);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
88
include/seiscomp/datamodel/exchange/bson.h
Normal file
88
include/seiscomp/datamodel/exchange/bson.h
Normal file
@ -0,0 +1,88 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_BSON_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_BSON_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/importer.h>
|
||||
#include <seiscomp/io/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ImporterBSON : public IO::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterBSON();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Importer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
Core::BaseObject *get(std::streambuf* buf);
|
||||
};
|
||||
|
||||
|
||||
class ExporterBSON : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterBSON();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
};
|
||||
|
||||
|
||||
class ExporterBSONJSON : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterBSONJSON();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
59
include/seiscomp/datamodel/exchange/csv.h
Normal file
59
include/seiscomp/datamodel/exchange/csv.h
Normal file
@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_CSV_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_CSV_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ExporterCSV : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterCSV();
|
||||
|
||||
void setDelimiter(std::string &);
|
||||
const std::string& getDelimiter() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
|
||||
private:
|
||||
std::string _delim;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
53
include/seiscomp/datamodel/exchange/hyp71sum2k.h
Normal file
53
include/seiscomp/datamodel/exchange/hyp71sum2k.h
Normal file
@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_HYP71SUM2K_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_HYP71SUM2K_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ExporterHYP71SUM2K : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterHYP71SUM2K();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
65
include/seiscomp/datamodel/exchange/ims10.h
Normal file
65
include/seiscomp/datamodel/exchange/ims10.h
Normal file
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_IMS10_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_IMS10_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/exporter.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/amplitude.h>
|
||||
#include <seiscomp/datamodel/pick.h>
|
||||
#include <seiscomp/datamodel/stationmagnitude.h>
|
||||
#include <seiscomp/datamodel/stationmagnitudecontribution.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ExporterIMS10 : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterIMS10();
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
private:
|
||||
// ------------------------------------------------------------------
|
||||
// Members
|
||||
// ------------------------------------------------------------------
|
||||
std::vector<Seiscomp::DataModel::ArrivalPtr> _arrivalList;
|
||||
std::vector<Seiscomp::DataModel::PickPtr> _pickList;
|
||||
std::vector<Seiscomp::DataModel::AmplitudePtr> _amplitudeList;
|
||||
std::vector<Seiscomp::DataModel::StationMagnitudePtr> _stationMagnitudeList;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
71
include/seiscomp/datamodel/exchange/json.h
Normal file
71
include/seiscomp/datamodel/exchange/json.h
Normal file
@ -0,0 +1,71 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_JSON_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_JSON_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/importer.h>
|
||||
#include <seiscomp/io/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ImporterJSON : public IO::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterJSON();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Importer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
Core::BaseObject *get(std::streambuf* buf);
|
||||
};
|
||||
|
||||
|
||||
class ExporterJSON : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterJSON();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
108
include/seiscomp/datamodel/exchange/quakeml.h
Normal file
108
include/seiscomp/datamodel/exchange/quakeml.h
Normal file
@ -0,0 +1,108 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_QML_XML_H
|
||||
#define SEISCOMP_QML_XML_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
|
||||
#include <seiscomp/io/xml/exporter.h>
|
||||
#include <seiscomp/io/xml/handler.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
/** @version 15.1 */
|
||||
const char *QML_NS();
|
||||
/** @version 15.1 */
|
||||
const char *QML_NS_RT();
|
||||
/** @version 15.1 */
|
||||
const char *QML_NS_BED();
|
||||
/** @version 15.1 */
|
||||
const char *QML_NS_BED_RT();
|
||||
|
||||
/** @version 15.1 */
|
||||
constexpr const char *QML_SMIPrefixEnvVar = "QML_SMI_PREFIX";
|
||||
/** @version 15.1 */
|
||||
const std::string &QML_SMIPrefix();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace QML {
|
||||
|
||||
|
||||
class TypeMapper {
|
||||
public:
|
||||
/**
|
||||
* @brief Maps an QML event type string to the EventType enumeration.
|
||||
*
|
||||
* If the conversion fails, an ValueException is thrown.
|
||||
*
|
||||
* @param str The input string
|
||||
* @return The mapped event type or an exception
|
||||
*/
|
||||
static DataModel::EventType EventTypeFromString(const std::string &str);
|
||||
|
||||
/**
|
||||
* @brief Maps an EventType to an QML event type string.
|
||||
* @param type The EventType
|
||||
* @return The QML event type string
|
||||
*/
|
||||
static std::string EventTypeToString(DataModel::EventType type);
|
||||
|
||||
/**
|
||||
* @brief Maps an EventTypeCertainty to an QML event type string.
|
||||
* @param type The EventTypeCertainty
|
||||
* @return The QML event type certainty string
|
||||
*/
|
||||
static std::string EventTypeCertaintyToString(DataModel::EventTypeCertainty type);
|
||||
};
|
||||
|
||||
|
||||
class Exporter : public IO::XML::Exporter {
|
||||
public:
|
||||
Exporter();
|
||||
|
||||
protected:
|
||||
void collectNamespaces(Core::BaseObject *) override;
|
||||
};
|
||||
|
||||
|
||||
class RTExporter : public IO::XML::Exporter {
|
||||
public:
|
||||
RTExporter();
|
||||
|
||||
protected:
|
||||
void collectNamespaces(Core::BaseObject *) override;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
65
include/seiscomp/datamodel/exchange/scdm051.h
Normal file
65
include/seiscomp/datamodel/exchange/scdm051.h
Normal file
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_0_51_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_0_51_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/xml/importer.h>
|
||||
#include <seiscomp/io/xml/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
namespace SCDM051 {
|
||||
|
||||
struct GenericHandler : public IO::XML::GenericHandler {
|
||||
GenericHandler();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class ImporterSCDM051 : public IO::XML::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterSCDM051();
|
||||
};
|
||||
|
||||
|
||||
class ExporterSCDM051 : public IO::XML::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterSCDM051();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
72
include/seiscomp/datamodel/exchange/trunk.h
Normal file
72
include/seiscomp/datamodel/exchange/trunk.h
Normal file
@ -0,0 +1,72 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCDM_TRUNK_EXCHANGE_H
|
||||
#define SEISCOMP_DATAMODEL_SCDM_TRUNK_EXCHANGE_H
|
||||
|
||||
|
||||
#include <seiscomp/io/importer.h>
|
||||
#include <seiscomp/io/exporter.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
class ImporterTrunk : public IO::Importer {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ImporterTrunk();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Importer interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
Core::BaseObject *get(std::streambuf* buf);
|
||||
};
|
||||
|
||||
|
||||
class ExporterTrunk : public IO::Exporter {
|
||||
// ------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
ExporterTrunk();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Exporter interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
bool put(std::streambuf* buf, Core::BaseObject *);
|
||||
bool put(std::streambuf* buf, const IO::ExportObjectList &objects);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
267
include/seiscomp/datamodel/focalmechanism.h
Normal file
267
include/seiscomp/datamodel/focalmechanism.h
Normal file
@ -0,0 +1,267 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_FOCALMECHANISM_H
|
||||
#define SEISCOMP_DATAMODEL_FOCALMECHANISM_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/nodalplanes.h>
|
||||
#include <seiscomp/datamodel/principalaxes.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(FocalMechanism);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(MomentTensor);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes the focal mechanism of an event. It
|
||||
* \brief includes different
|
||||
* \brief descriptions like nodal planes, principal axes, and a
|
||||
* \brief moment tensor.
|
||||
* \brief The moment tensor description is provided by objects of the
|
||||
* \brief class
|
||||
* \brief MomentTensor which can be specified as child elements of
|
||||
* \brief FocalMechanism.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API FocalMechanism : public PublicObject {
|
||||
DECLARE_SC_CLASS(FocalMechanism)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
FocalMechanism();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
FocalMechanism(const FocalMechanism& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
FocalMechanism(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~FocalMechanism() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static FocalMechanism* Create();
|
||||
static FocalMechanism* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static FocalMechanism* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
FocalMechanism& operator=(const FocalMechanism& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const FocalMechanism& other) const;
|
||||
bool operator!=(const FocalMechanism& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const FocalMechanism& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Refers to the publicID of the triggering origin.
|
||||
void setTriggeringOriginID(const std::string& triggeringOriginID);
|
||||
const std::string& triggeringOriginID() const;
|
||||
|
||||
//! Nodal planes of the focal mechanism.
|
||||
void setNodalPlanes(const OPT(NodalPlanes)& nodalPlanes);
|
||||
NodalPlanes& nodalPlanes();
|
||||
const NodalPlanes& nodalPlanes() const;
|
||||
|
||||
//! Principal axes of the focal mechanism.
|
||||
void setPrincipalAxes(const OPT(PrincipalAxes)& principalAxes);
|
||||
PrincipalAxes& principalAxes();
|
||||
const PrincipalAxes& principalAxes() const;
|
||||
|
||||
//! Largest azimuthal gap in distribution of stations used for
|
||||
//! determination
|
||||
//! of focal mechanism in degrees.
|
||||
void setAzimuthalGap(const OPT(double)& azimuthalGap);
|
||||
double azimuthalGap() const;
|
||||
|
||||
//! Number of station polarities used for determination of
|
||||
//! focal mechanism.
|
||||
void setStationPolarityCount(const OPT(int)& stationPolarityCount);
|
||||
int stationPolarityCount() const;
|
||||
|
||||
//! Fraction of misfit polarities in a first-motion focal
|
||||
//! mechanism determination.
|
||||
//! Decimal fraction between 0 and 1.
|
||||
void setMisfit(const OPT(double)& misfit);
|
||||
double misfit() const;
|
||||
|
||||
//! Station distribution ratio (STDR) parameter. Indicates how
|
||||
//! the stations
|
||||
//! are distributed about the focal sphere (Reasenberg and
|
||||
//! Oppenheimer 1985).
|
||||
//! Decimal fraction between 0 and 1.
|
||||
void setStationDistributionRatio(const OPT(double)& stationDistributionRatio);
|
||||
double stationDistributionRatio() const;
|
||||
|
||||
//! Resource identifier of the method used for determination of
|
||||
//! the focal mechanism.
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Evaluation mode of FocalMechanism.
|
||||
void setEvaluationMode(const OPT(EvaluationMode)& evaluationMode);
|
||||
EvaluationMode evaluationMode() const;
|
||||
|
||||
//! Evaluation status of FocalMechanism.
|
||||
void setEvaluationStatus(const OPT(EvaluationStatus)& evaluationStatus);
|
||||
EvaluationStatus evaluationStatus() const;
|
||||
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
bool add(MomentTensor* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
bool remove(MomentTensor* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeMomentTensor(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
size_t momentTensorCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
MomentTensor* momentTensor(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
MomentTensor* findMomentTensor(const std::string& publicID) const;
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _triggeringOriginID;
|
||||
OPT(NodalPlanes) _nodalPlanes;
|
||||
OPT(PrincipalAxes) _principalAxes;
|
||||
OPT(double) _azimuthalGap;
|
||||
OPT(int) _stationPolarityCount;
|
||||
OPT(double) _misfit;
|
||||
OPT(double) _stationDistributionRatio;
|
||||
std::string _methodID;
|
||||
OPT(EvaluationMode) _evaluationMode;
|
||||
OPT(EvaluationStatus) _evaluationStatus;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<MomentTensorPtr> _momentTensors;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(FocalMechanism);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
155
include/seiscomp/datamodel/focalmechanismreference.h
Normal file
155
include/seiscomp/datamodel/focalmechanismreference.h
Normal file
@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_FOCALMECHANISMREFERENCE_H
|
||||
#define SEISCOMP_DATAMODEL_FOCALMECHANISMREFERENCE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(FocalMechanismReference);
|
||||
|
||||
class Event;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API FocalMechanismReferenceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
FocalMechanismReferenceIndex();
|
||||
FocalMechanismReferenceIndex(const std::string& focalMechanismID);
|
||||
|
||||
//! Copy constructor
|
||||
FocalMechanismReferenceIndex(const FocalMechanismReferenceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const FocalMechanismReferenceIndex&) const;
|
||||
bool operator!=(const FocalMechanismReferenceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string focalMechanismID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API FocalMechanismReference : public Object {
|
||||
DECLARE_SC_CLASS(FocalMechanismReference)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
FocalMechanismReference();
|
||||
|
||||
//! Copy constructor
|
||||
FocalMechanismReference(const FocalMechanismReference& other);
|
||||
|
||||
//! Custom constructor
|
||||
FocalMechanismReference(const std::string& focalMechanismID);
|
||||
|
||||
//! Destructor
|
||||
~FocalMechanismReference() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
FocalMechanismReference& operator=(const FocalMechanismReference& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const FocalMechanismReference& other) const;
|
||||
bool operator!=(const FocalMechanismReference& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const FocalMechanismReference& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setFocalMechanismID(const std::string& focalMechanismID);
|
||||
const std::string& focalMechanismID() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const FocalMechanismReferenceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const FocalMechanismReference* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Event* event() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
FocalMechanismReferenceIndex _index;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
146
include/seiscomp/datamodel/integerquantity.h
Normal file
146
include/seiscomp/datamodel/integerquantity.h
Normal file
@ -0,0 +1,146 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_INTEGERQUANTITY_H
|
||||
#define SEISCOMP_DATAMODEL_INTEGERQUANTITY_H
|
||||
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(IntegerQuantity);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Physical quantities expressed as integers are represented
|
||||
* \brief by their
|
||||
* \brief measured or computed values and optional values for
|
||||
* \brief symmetric or upper
|
||||
* \brief and lower uncertainties. The interpretation of these
|
||||
* \brief uncertainties is
|
||||
* \brief not defined in the standard. They can contain statistically
|
||||
* \brief well-defined
|
||||
* \brief error measures, but the mechanism can also be used to
|
||||
* \brief simply describe a
|
||||
* \brief possible value range. If the confidence level of the
|
||||
* \brief uncertainty is known,
|
||||
* \brief it can be listed in the optional attribute confidenceLevel.
|
||||
* \brief Note that uncertainty, upperUncertainty, and
|
||||
* \brief lowerUncertainty are given as absolute values of the
|
||||
* \brief deviation
|
||||
* \brief from the main value.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API IntegerQuantity : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(IntegerQuantity)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
IntegerQuantity();
|
||||
|
||||
//! Copy constructor
|
||||
IntegerQuantity(const IntegerQuantity& other);
|
||||
|
||||
//! Custom constructor
|
||||
IntegerQuantity(int value,
|
||||
const OPT(int)& uncertainty = Seiscomp::Core::None,
|
||||
const OPT(int)& lowerUncertainty = Seiscomp::Core::None,
|
||||
const OPT(int)& upperUncertainty = Seiscomp::Core::None,
|
||||
const OPT(double)& confidenceLevel = Seiscomp::Core::None);
|
||||
|
||||
//! Destructor
|
||||
~IntegerQuantity() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
operator int&();
|
||||
operator int() const;
|
||||
|
||||
//! Copies the metadata of other to this
|
||||
IntegerQuantity& operator=(const IntegerQuantity& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const IntegerQuantity& other) const;
|
||||
bool operator!=(const IntegerQuantity& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const IntegerQuantity& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Value of the quantity. The unit is implicitly defined and
|
||||
//! depends on the context.
|
||||
void setValue(int value);
|
||||
int value() const;
|
||||
|
||||
//! Uncertainty as the absolute value of symmetric deviation
|
||||
//! from the main value.
|
||||
void setUncertainty(const OPT(int)& uncertainty);
|
||||
int uncertainty() const;
|
||||
|
||||
//! Uncertainty as the absolute value of deviation from the
|
||||
//! main value towards smaller values.
|
||||
void setLowerUncertainty(const OPT(int)& lowerUncertainty);
|
||||
int lowerUncertainty() const;
|
||||
|
||||
//! Uncertainty as the absolute value of deviation from the
|
||||
//! main value towards larger values.
|
||||
void setUpperUncertainty(const OPT(int)& upperUncertainty);
|
||||
int upperUncertainty() const;
|
||||
|
||||
//! Confidence level of the uncertainty, given in percent.
|
||||
void setConfidenceLevel(const OPT(double)& confidenceLevel);
|
||||
double confidenceLevel() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
int _value;
|
||||
OPT(int) _uncertainty;
|
||||
OPT(int) _lowerUncertainty;
|
||||
OPT(int) _upperUncertainty;
|
||||
OPT(double) _confidenceLevel;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
256
include/seiscomp/datamodel/inventory.h
Normal file
256
include/seiscomp/datamodel/inventory.h
Normal file
@ -0,0 +1,256 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_INVENTORY_H
|
||||
#define SEISCOMP_DATAMODEL_INVENTORY_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/stationgroup.h>
|
||||
#include <seiscomp/datamodel/auxdevice.h>
|
||||
#include <seiscomp/datamodel/sensor.h>
|
||||
#include <seiscomp/datamodel/datalogger.h>
|
||||
#include <seiscomp/datamodel/responsepaz.h>
|
||||
#include <seiscomp/datamodel/responsefir.h>
|
||||
#include <seiscomp/datamodel/responseiir.h>
|
||||
#include <seiscomp/datamodel/responsepolynomial.h>
|
||||
#include <seiscomp/datamodel/responsefap.h>
|
||||
#include <seiscomp/datamodel/network.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Inventory);
|
||||
DEFINE_SMARTPOINTER(StationGroup);
|
||||
DEFINE_SMARTPOINTER(AuxDevice);
|
||||
DEFINE_SMARTPOINTER(Sensor);
|
||||
DEFINE_SMARTPOINTER(Datalogger);
|
||||
DEFINE_SMARTPOINTER(ResponsePAZ);
|
||||
DEFINE_SMARTPOINTER(ResponseFIR);
|
||||
DEFINE_SMARTPOINTER(ResponseIIR);
|
||||
DEFINE_SMARTPOINTER(ResponsePolynomial);
|
||||
DEFINE_SMARTPOINTER(ResponseFAP);
|
||||
DEFINE_SMARTPOINTER(Network);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Inventory : public PublicObject {
|
||||
DECLARE_SC_CLASS(Inventory)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Inventory();
|
||||
|
||||
//! Copy constructor
|
||||
Inventory(const Inventory& other);
|
||||
|
||||
//! Destructor
|
||||
~Inventory() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Inventory& operator=(const Inventory& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Inventory& other) const;
|
||||
bool operator!=(const Inventory& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Inventory& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(StationGroup* obj);
|
||||
bool add(AuxDevice* obj);
|
||||
bool add(Sensor* obj);
|
||||
bool add(Datalogger* obj);
|
||||
bool add(ResponsePAZ* obj);
|
||||
bool add(ResponseFIR* obj);
|
||||
bool add(ResponseIIR* obj);
|
||||
bool add(ResponsePolynomial* obj);
|
||||
bool add(ResponseFAP* obj);
|
||||
bool add(Network* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(StationGroup* obj);
|
||||
bool remove(AuxDevice* obj);
|
||||
bool remove(Sensor* obj);
|
||||
bool remove(Datalogger* obj);
|
||||
bool remove(ResponsePAZ* obj);
|
||||
bool remove(ResponseFIR* obj);
|
||||
bool remove(ResponseIIR* obj);
|
||||
bool remove(ResponsePolynomial* obj);
|
||||
bool remove(ResponseFAP* obj);
|
||||
bool remove(Network* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeStationGroup(size_t i);
|
||||
bool removeStationGroup(const StationGroupIndex& i);
|
||||
bool removeAuxDevice(size_t i);
|
||||
bool removeAuxDevice(const AuxDeviceIndex& i);
|
||||
bool removeSensor(size_t i);
|
||||
bool removeSensor(const SensorIndex& i);
|
||||
bool removeDatalogger(size_t i);
|
||||
bool removeDatalogger(const DataloggerIndex& i);
|
||||
bool removeResponsePAZ(size_t i);
|
||||
bool removeResponsePAZ(const ResponsePAZIndex& i);
|
||||
bool removeResponseFIR(size_t i);
|
||||
bool removeResponseFIR(const ResponseFIRIndex& i);
|
||||
bool removeResponseIIR(size_t i);
|
||||
bool removeResponseIIR(const ResponseIIRIndex& i);
|
||||
bool removeResponsePolynomial(size_t i);
|
||||
bool removeResponsePolynomial(const ResponsePolynomialIndex& i);
|
||||
bool removeResponseFAP(size_t i);
|
||||
bool removeResponseFAP(const ResponseFAPIndex& i);
|
||||
bool removeNetwork(size_t i);
|
||||
bool removeNetwork(const NetworkIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t stationGroupCount() const;
|
||||
size_t auxDeviceCount() const;
|
||||
size_t sensorCount() const;
|
||||
size_t dataloggerCount() const;
|
||||
size_t responsePAZCount() const;
|
||||
size_t responseFIRCount() const;
|
||||
size_t responseIIRCount() const;
|
||||
size_t responsePolynomialCount() const;
|
||||
size_t responseFAPCount() const;
|
||||
size_t networkCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
StationGroup* stationGroup(size_t i) const;
|
||||
StationGroup* stationGroup(const StationGroupIndex& i) const;
|
||||
|
||||
AuxDevice* auxDevice(size_t i) const;
|
||||
AuxDevice* auxDevice(const AuxDeviceIndex& i) const;
|
||||
|
||||
Sensor* sensor(size_t i) const;
|
||||
Sensor* sensor(const SensorIndex& i) const;
|
||||
|
||||
Datalogger* datalogger(size_t i) const;
|
||||
Datalogger* datalogger(const DataloggerIndex& i) const;
|
||||
|
||||
ResponsePAZ* responsePAZ(size_t i) const;
|
||||
ResponsePAZ* responsePAZ(const ResponsePAZIndex& i) const;
|
||||
|
||||
ResponseFIR* responseFIR(size_t i) const;
|
||||
ResponseFIR* responseFIR(const ResponseFIRIndex& i) const;
|
||||
|
||||
ResponseIIR* responseIIR(size_t i) const;
|
||||
ResponseIIR* responseIIR(const ResponseIIRIndex& i) const;
|
||||
|
||||
ResponsePolynomial* responsePolynomial(size_t i) const;
|
||||
ResponsePolynomial* responsePolynomial(const ResponsePolynomialIndex& i) const;
|
||||
|
||||
ResponseFAP* responseFAP(size_t i) const;
|
||||
ResponseFAP* responseFAP(const ResponseFAPIndex& i) const;
|
||||
|
||||
Network* network(size_t i) const;
|
||||
Network* network(const NetworkIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
StationGroup* findStationGroup(const std::string& publicID) const;
|
||||
AuxDevice* findAuxDevice(const std::string& publicID) const;
|
||||
Sensor* findSensor(const std::string& publicID) const;
|
||||
Datalogger* findDatalogger(const std::string& publicID) const;
|
||||
ResponsePAZ* findResponsePAZ(const std::string& publicID) const;
|
||||
ResponseFIR* findResponseFIR(const std::string& publicID) const;
|
||||
ResponseIIR* findResponseIIR(const std::string& publicID) const;
|
||||
ResponsePolynomial* findResponsePolynomial(const std::string& publicID) const;
|
||||
ResponseFAP* findResponseFAP(const std::string& publicID) const;
|
||||
Network* findNetwork(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<StationGroupPtr> _stationGroups;
|
||||
std::vector<AuxDevicePtr> _auxDevices;
|
||||
std::vector<SensorPtr> _sensors;
|
||||
std::vector<DataloggerPtr> _dataloggers;
|
||||
std::vector<ResponsePAZPtr> _responsePAZs;
|
||||
std::vector<ResponseFIRPtr> _responseFIRs;
|
||||
std::vector<ResponseIIRPtr> _responseIIRs;
|
||||
std::vector<ResponsePolynomialPtr> _responsePolynomials;
|
||||
std::vector<ResponseFAPPtr> _responseFAPs;
|
||||
std::vector<NetworkPtr> _networks;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Inventory);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
47
include/seiscomp/datamodel/inventory_package.h
Normal file
47
include/seiscomp/datamodel/inventory_package.h
Normal file
@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_INVENTORY_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_INVENTORY_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/stationreference.h>
|
||||
#include <seiscomp/datamodel/stationgroup.h>
|
||||
#include <seiscomp/datamodel/auxsource.h>
|
||||
#include <seiscomp/datamodel/auxdevice.h>
|
||||
#include <seiscomp/datamodel/sensorcalibration.h>
|
||||
#include <seiscomp/datamodel/sensor.h>
|
||||
#include <seiscomp/datamodel/responsepaz.h>
|
||||
#include <seiscomp/datamodel/responsepolynomial.h>
|
||||
#include <seiscomp/datamodel/responsefap.h>
|
||||
#include <seiscomp/datamodel/responsefir.h>
|
||||
#include <seiscomp/datamodel/responseiir.h>
|
||||
#include <seiscomp/datamodel/dataloggercalibration.h>
|
||||
#include <seiscomp/datamodel/decimation.h>
|
||||
#include <seiscomp/datamodel/datalogger.h>
|
||||
#include <seiscomp/datamodel/auxstream.h>
|
||||
#include <seiscomp/datamodel/stream.h>
|
||||
#include <seiscomp/datamodel/sensorlocation.h>
|
||||
#include <seiscomp/datamodel/station.h>
|
||||
#include <seiscomp/datamodel/network.h>
|
||||
#include <seiscomp/datamodel/inventory.h>
|
||||
|
||||
|
||||
#endif
|
||||
129
include/seiscomp/datamodel/journalentry.h
Normal file
129
include/seiscomp/datamodel/journalentry.h
Normal file
@ -0,0 +1,129 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_JOURNALENTRY_H
|
||||
#define SEISCOMP_DATAMODEL_JOURNALENTRY_H
|
||||
|
||||
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(JournalEntry);
|
||||
|
||||
class Journaling;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API JournalEntry : public Object {
|
||||
DECLARE_SC_CLASS(JournalEntry)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
JournalEntry();
|
||||
|
||||
//! Copy constructor
|
||||
JournalEntry(const JournalEntry& other);
|
||||
|
||||
//! Destructor
|
||||
~JournalEntry() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
JournalEntry& operator=(const JournalEntry& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const JournalEntry& other) const;
|
||||
bool operator!=(const JournalEntry& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const JournalEntry& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setCreated(const OPT(Seiscomp::Core::Time)& created);
|
||||
Seiscomp::Core::Time created() const;
|
||||
|
||||
void setObjectID(const std::string& objectID);
|
||||
const std::string& objectID() const;
|
||||
|
||||
void setSender(const std::string& sender);
|
||||
const std::string& sender() const;
|
||||
|
||||
void setAction(const std::string& action);
|
||||
const std::string& action() const;
|
||||
|
||||
void setParameters(const std::string& parameters);
|
||||
const std::string& parameters() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Journaling* journaling() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _created;
|
||||
std::string _objectID;
|
||||
std::string _sender;
|
||||
std::string _action;
|
||||
std::string _parameters;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
145
include/seiscomp/datamodel/journaling.h
Normal file
145
include/seiscomp/datamodel/journaling.h
Normal file
@ -0,0 +1,145 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_JOURNALING_H
|
||||
#define SEISCOMP_DATAMODEL_JOURNALING_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Journaling);
|
||||
DEFINE_SMARTPOINTER(JournalEntry);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Journaling : public PublicObject {
|
||||
DECLARE_SC_CLASS(Journaling)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Journaling();
|
||||
|
||||
//! Copy constructor
|
||||
Journaling(const Journaling& other);
|
||||
|
||||
//! Destructor
|
||||
~Journaling() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Journaling& operator=(const Journaling& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Journaling& other) const;
|
||||
bool operator!=(const Journaling& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Journaling& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(JournalEntry* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(JournalEntry* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeJournalEntry(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t journalEntryCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
JournalEntry* journalEntry(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
JournalEntry* findJournalEntry(JournalEntry* journalEntry) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<JournalEntryPtr> _journalEntrys;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Journaling);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
29
include/seiscomp/datamodel/journaling_package.h
Normal file
29
include/seiscomp/datamodel/journaling_package.h
Normal file
@ -0,0 +1,29 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_JOURNALING_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_JOURNALING_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/journalentry.h>
|
||||
#include <seiscomp/datamodel/journaling.h>
|
||||
|
||||
|
||||
#endif
|
||||
259
include/seiscomp/datamodel/magnitude.h
Normal file
259
include/seiscomp/datamodel/magnitude.h
Normal file
@ -0,0 +1,259 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MAGNITUDE_H
|
||||
#define SEISCOMP_DATAMODEL_MAGNITUDE_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/stationmagnitudecontribution.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Magnitude);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(StationMagnitudeContribution);
|
||||
|
||||
class Origin;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Describes a magnitude which can, but does not need to be
|
||||
* \brief associated with
|
||||
* \brief an origin. Association with an origin is expressed with the
|
||||
* \brief optional
|
||||
* \brief attribute originID. It is either a combination of different
|
||||
* \brief magnitude
|
||||
* \brief estimations, or it represents the reported magnitude for
|
||||
* \brief the given event.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Magnitude : public PublicObject {
|
||||
DECLARE_SC_CLASS(Magnitude)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Magnitude();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Magnitude(const Magnitude& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Magnitude(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Magnitude() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Magnitude* Create();
|
||||
static Magnitude* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Magnitude* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Magnitude& operator=(const Magnitude& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Magnitude& other) const;
|
||||
bool operator!=(const Magnitude& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Magnitude& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Resulting magnitude value from combining values of type
|
||||
//! StationMagnitude.
|
||||
//! If no estimations are available, this value can represent
|
||||
//! the reported magnitude.
|
||||
void setMagnitude(const RealQuantity& magnitude);
|
||||
RealQuantity& magnitude();
|
||||
const RealQuantity& magnitude() const;
|
||||
|
||||
//! Describes the type of magnitude. This is a free-text field
|
||||
//! because
|
||||
//! it is impossible to cover all existing magnitude type
|
||||
//! designations
|
||||
//! with an enumeration. Possible values are unspecified
|
||||
//! magnitude (M),
|
||||
//! local magnitude (ML), body wave magnitude (Mb),
|
||||
//! surface wave magnitude (MS), moment magnitude (Mw),
|
||||
//! duration magnitude (Md), coda magnitude (Mc), MH, Mwp, M50,
|
||||
//! M100, etc.
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
//! Reference to an origin's publicID if the magnitude has an
|
||||
//! associated Origin.
|
||||
void setOriginID(const std::string& originID);
|
||||
const std::string& originID() const;
|
||||
|
||||
//! Identifies the method of magnitude estimation. Users should
|
||||
//! avoid to
|
||||
//! give contradictory information in methodID and type.
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Number of used stations for this magnitude computation.
|
||||
void setStationCount(const OPT(int)& stationCount);
|
||||
int stationCount() const;
|
||||
|
||||
//! Azimuthal gap for this magnitude computation in degrees.
|
||||
void setAzimuthalGap(const OPT(double)& azimuthalGap);
|
||||
double azimuthalGap() const;
|
||||
|
||||
//! Evaluation status of Magnitude.
|
||||
void setEvaluationStatus(const OPT(EvaluationStatus)& evaluationStatus);
|
||||
EvaluationStatus evaluationStatus() const;
|
||||
|
||||
//! CreationInfo for the Magnitude object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
bool add(StationMagnitudeContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
bool remove(StationMagnitudeContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeStationMagnitudeContribution(size_t i);
|
||||
bool removeStationMagnitudeContribution(const StationMagnitudeContributionIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
size_t stationMagnitudeContributionCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
StationMagnitudeContribution* stationMagnitudeContribution(size_t i) const;
|
||||
StationMagnitudeContribution* stationMagnitudeContribution(const StationMagnitudeContributionIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
Origin* origin() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
RealQuantity _magnitude;
|
||||
std::string _type;
|
||||
std::string _originID;
|
||||
std::string _methodID;
|
||||
OPT(int) _stationCount;
|
||||
OPT(double) _azimuthalGap;
|
||||
OPT(EvaluationStatus) _evaluationStatus;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<StationMagnitudeContributionPtr> _stationMagnitudeContributions;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Magnitude);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
192
include/seiscomp/datamodel/messages.h
Normal file
192
include/seiscomp/datamodel/messages.h
Normal file
@ -0,0 +1,192 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MESSAGES_H__
|
||||
#define SEISCOMP_DATAMODEL_MESSAGES_H__
|
||||
|
||||
|
||||
#include <seiscomp/core/genericmessage.h>
|
||||
#include <seiscomp/datamodel/eventparameters.h>
|
||||
#include <seiscomp/datamodel/origin.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ConfigSyncMessage);
|
||||
|
||||
class SC_SYSTEM_CORE_API ConfigSyncMessage : public Seiscomp::Core::Message {
|
||||
DECLARE_SC_CLASS(ConfigSyncMessage);
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
ConfigSyncMessage();
|
||||
ConfigSyncMessage(bool finished);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Message interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool empty() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo &creationInfo();
|
||||
const CreationInfo &creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public members
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool isFinished;
|
||||
|
||||
private:
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(InventorySyncMessage);
|
||||
|
||||
class SC_SYSTEM_CORE_API InventorySyncMessage : public Seiscomp::Core::Message {
|
||||
DECLARE_SC_CLASS(InventorySyncMessage);
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
InventorySyncMessage();
|
||||
InventorySyncMessage(bool finished);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo &creationInfo();
|
||||
const CreationInfo &creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Message interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool empty() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public members
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool isFinished;
|
||||
|
||||
private:
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArtificialOriginMessage);
|
||||
|
||||
class SC_SYSTEM_CORE_API ArtificialOriginMessage : public Seiscomp::Core::Message {
|
||||
DECLARE_SC_CLASS(ArtificialOriginMessage);
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
ArtificialOriginMessage();
|
||||
|
||||
public:
|
||||
ArtificialOriginMessage(DataModel::Origin *origin);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Message interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
DataModel::Origin *origin() const;
|
||||
void setOrigin(DataModel::Origin *origin);
|
||||
|
||||
virtual bool empty() const;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
DataModel::OriginPtr _origin;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ArtificialOriginMessage);
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ArtificialEventParametersMessage);
|
||||
|
||||
class SC_SYSTEM_CORE_API ArtificialEventParametersMessage : public Seiscomp::Core::Message {
|
||||
DECLARE_SC_CLASS(ArtificialEventParametersMessage);
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
ArtificialEventParametersMessage();
|
||||
|
||||
public:
|
||||
ArtificialEventParametersMessage(DataModel::EventParameters *eventParameters);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Message interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
DataModel::EventParameters *eventParameters() const;
|
||||
void setEventParameters(DataModel::EventParameters *eventParameters);
|
||||
|
||||
virtual bool empty() const;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
DataModel::EventParametersPtr _eventParameters;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ArtificialEventParametersMessage);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
498
include/seiscomp/datamodel/metadata.h
Normal file
498
include/seiscomp/datamodel/metadata.h
Normal file
@ -0,0 +1,498 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_METADATA_H__
|
||||
#define SEISCOMP_DATAMODEL_METADATA_H__
|
||||
|
||||
|
||||
#include <seiscomp/core/metaproperty.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
namespace Generic {
|
||||
|
||||
|
||||
template <typename T, typename U, typename F1, typename F2, int>
|
||||
class EnumPropertyBase {};
|
||||
|
||||
|
||||
//! Non-optional enum property specialization
|
||||
template <typename T, typename U, typename F1, typename F2>
|
||||
class EnumPropertyBase<T, U, F1, F2, 0> : public Core::MetaProperty {
|
||||
public:
|
||||
EnumPropertyBase(F1 setter, F2 getter)
|
||||
: _setter(setter), _getter(getter) {}
|
||||
|
||||
bool write(Core::BaseObject *object, Core::MetaValue value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
U tmp;
|
||||
if ( !tmp.fromInt(boost::any_cast<int>(value)) )
|
||||
return false;
|
||||
|
||||
(target->*_setter)(tmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool writeString(Core::BaseObject *object, const std::string &value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
typename Core::Generic::remove_optional<U>::type tmp;
|
||||
if ( !tmp.fromString(value.c_str()) )
|
||||
return false;
|
||||
|
||||
(target->*_setter)(tmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::MetaValue read(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return (target->*_getter)().toInt();
|
||||
}
|
||||
|
||||
std::string readString(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return (target->*_getter)().toString();
|
||||
}
|
||||
|
||||
private:
|
||||
F1 _setter;
|
||||
F2 _getter;
|
||||
};
|
||||
|
||||
|
||||
//! Optional enum property specialization
|
||||
template <typename T, typename U, typename F1, typename F2>
|
||||
class EnumPropertyBase<T, U, F1, F2, 1> : public Core::MetaProperty {
|
||||
public:
|
||||
EnumPropertyBase(F1 setter, F2 getter)
|
||||
: _setter(setter), _getter(getter) {}
|
||||
|
||||
bool write(Core::BaseObject *object, Core::MetaValue value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
|
||||
if ( value.empty() )
|
||||
(target->*_setter)(Core::None);
|
||||
else {
|
||||
typename U::value_type tmp;
|
||||
if ( !tmp.fromInt(boost::any_cast<int>(value)) )
|
||||
return false;
|
||||
|
||||
(target->*_setter)(tmp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool writeString(Core::BaseObject *object, const std::string &value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
|
||||
if ( value.empty() )
|
||||
(target->*_setter)(Core::None);
|
||||
else {
|
||||
typename Core::Generic::remove_optional<U>::type tmp;
|
||||
if ( !tmp.fromString(value.c_str()) )
|
||||
return false;
|
||||
|
||||
(target->*_setter)(tmp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::MetaValue read(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return (target->*_getter)().toInt();
|
||||
}
|
||||
|
||||
std::string readString(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return (target->*_getter)().toString();
|
||||
}
|
||||
|
||||
private:
|
||||
F1 _setter;
|
||||
F2 _getter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename A, typename T, typename U, typename F1, typename F2, int>
|
||||
class BaseObjectPropertyBase {};
|
||||
|
||||
|
||||
//! Non-optional baseobject property specialization
|
||||
template <typename A, typename T, typename U, typename F1, typename F2>
|
||||
class BaseObjectPropertyBase<A, T, U, F1, F2, 0> : public Core::MetaClassProperty<A> {
|
||||
public:
|
||||
BaseObjectPropertyBase(F1 setter, F2 getter)
|
||||
: _setter(setter), _getter(getter) {}
|
||||
|
||||
bool write(Core::BaseObject *object, Core::MetaValue value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
|
||||
const Core::BaseObject *v;
|
||||
try {
|
||||
v = boost::any_cast<const Core::BaseObject*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
try {
|
||||
v = boost::any_cast<Core::BaseObject*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
try {
|
||||
v = boost::any_cast<const U*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
v = boost::any_cast<U*>(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( v == nullptr )
|
||||
throw Core::GeneralException("value must not be nullptr");
|
||||
|
||||
const U *uv = U::ConstCast(v);
|
||||
if ( uv == nullptr )
|
||||
throw Core::GeneralException("value has wrong classtype");
|
||||
|
||||
(target->*_setter)(*uv);
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::MetaValue read(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return static_cast<Core::BaseObject*>(&(const_cast<T*>(target)->*_getter)());
|
||||
}
|
||||
|
||||
private:
|
||||
F1 _setter;
|
||||
F2 _getter;
|
||||
};
|
||||
|
||||
|
||||
//! Optional baseobject property specialization
|
||||
template <typename A, typename T, typename U, typename F1, typename F2>
|
||||
class BaseObjectPropertyBase<A, T, U, F1, F2, 1> : public Core::MetaClassProperty<A> {
|
||||
public:
|
||||
BaseObjectPropertyBase(F1 setter, F2 getter)
|
||||
: _setter(setter), _getter(getter) {}
|
||||
|
||||
bool write(Core::BaseObject *object, Core::MetaValue value) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) return false;
|
||||
|
||||
if ( value.empty() )
|
||||
(target->*_setter)(Core::None);
|
||||
else {
|
||||
const Core::BaseObject *v;
|
||||
try {
|
||||
v = boost::any_cast<const Core::BaseObject*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
try {
|
||||
v = boost::any_cast<Core::BaseObject*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
try {
|
||||
v = boost::any_cast<const typename U::value_type*>(value);
|
||||
}
|
||||
catch ( boost::bad_any_cast & ) {
|
||||
v = boost::any_cast<typename U::value_type*>(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( v == nullptr )
|
||||
throw Core::GeneralException("value must not be nullptr");
|
||||
|
||||
const typename U::value_type *uv = U::value_type::ConstCast(v);
|
||||
if ( uv == nullptr )
|
||||
throw Core::GeneralException("value has wrong classtype");
|
||||
|
||||
(target->*_setter)(*uv);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::MetaValue read(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
return static_cast<Core::BaseObject*>(&(const_cast<T*>(target)->*_getter)());
|
||||
}
|
||||
|
||||
private:
|
||||
F1 _setter;
|
||||
F2 _getter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename T, typename U, typename FCOUNT, typename FOBJ, typename FADD, typename FERASE1, typename FERASE2>
|
||||
class ArrayProperty : public Core::MetaProperty {
|
||||
public:
|
||||
ArrayProperty(FCOUNT countObjects, FOBJ getObj, FADD addObj, FERASE1 eraseObjIndex, FERASE2 eraseObjPointer)
|
||||
: _countObjects(countObjects),
|
||||
_getObj(getObj),
|
||||
_addObj(addObj),
|
||||
_eraseObjIndex(eraseObjIndex),
|
||||
_eraseObjPointer(eraseObjPointer) {}
|
||||
|
||||
size_t arrayElementCount(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return static_cast<size_t>((target->*_countObjects)());
|
||||
}
|
||||
|
||||
Core::BaseObject *arrayObject(Core::BaseObject *object, int i) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return (target->*_getObj)(i);
|
||||
}
|
||||
|
||||
bool arrayAddObject(Core::BaseObject *object, Core::BaseObject *ch) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
U *child = U::Cast(ch);
|
||||
if ( !child ) throw Core::GeneralException("wrong child class type");
|
||||
|
||||
return (target->*_addObj)(child);
|
||||
}
|
||||
|
||||
bool arrayRemoveObject(Core::BaseObject *object, int i) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return (target->*_eraseObjIndex)(i);
|
||||
}
|
||||
|
||||
bool arrayRemoveObject(Core::BaseObject *object, Core::BaseObject *ch) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
U *child = U::Cast(ch);
|
||||
if ( !child ) throw Core::GeneralException("wrong child class type");
|
||||
|
||||
return (target->*_eraseObjPointer)(child);
|
||||
}
|
||||
|
||||
Core::BaseObject *createClass() const {
|
||||
return U::Create();
|
||||
}
|
||||
|
||||
private:
|
||||
FCOUNT _countObjects;
|
||||
FOBJ _getObj;
|
||||
FADD _addObj;
|
||||
FERASE1 _eraseObjIndex;
|
||||
FERASE2 _eraseObjPointer;
|
||||
};
|
||||
|
||||
|
||||
template <typename A, typename T, typename U, typename FCOUNT, typename FOBJ, typename FADD, typename FERASE1, typename FERASE2>
|
||||
class ArrayClassProperty : public Core::MetaClassProperty<A> {
|
||||
public:
|
||||
ArrayClassProperty(FCOUNT countObjects, FOBJ getObj, FADD addObj, FERASE1 eraseObjIndex, FERASE2 eraseObjPointer)
|
||||
: _countObjects(countObjects),
|
||||
_getObj(getObj),
|
||||
_addObj(addObj),
|
||||
_eraseObjIndex(eraseObjIndex),
|
||||
_eraseObjPointer(eraseObjPointer) {}
|
||||
|
||||
size_t arrayElementCount(const Core::BaseObject *object) const {
|
||||
const T *target = T::ConstCast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return static_cast<size_t>((target->*_countObjects)());
|
||||
}
|
||||
|
||||
Core::BaseObject *arrayObject(Core::BaseObject *object, int i) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return (target->*_getObj)(i);
|
||||
}
|
||||
|
||||
bool arrayAddObject(Core::BaseObject *object, Core::BaseObject *ch) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
U *child = U::Cast(ch);
|
||||
if ( !child ) throw Core::GeneralException("wrong child class type");
|
||||
|
||||
return (target->*_addObj)(child);
|
||||
}
|
||||
|
||||
bool arrayRemoveObject(Core::BaseObject *object, int i) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
return (target->*_eraseObjIndex)(i);
|
||||
}
|
||||
|
||||
bool arrayRemoveObject(Core::BaseObject *object, Core::BaseObject *ch) const {
|
||||
T *target = T::Cast(object);
|
||||
if ( !target ) throw Core::GeneralException("invalid object");
|
||||
|
||||
U *child = U::Cast(ch);
|
||||
if ( !child ) throw Core::GeneralException("wrong child class type");
|
||||
|
||||
return (target->*_eraseObjPointer)(child);
|
||||
}
|
||||
|
||||
private:
|
||||
FCOUNT _countObjects;
|
||||
FOBJ _getObj;
|
||||
FADD _addObj;
|
||||
FERASE1 _eraseObjIndex;
|
||||
FERASE2 _eraseObjPointer;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename T, typename U, typename F1, typename F2>
|
||||
class EnumProperty : public Generic::EnumPropertyBase<T, U, F1, F2, Core::Generic::is_optional<U>::value> {
|
||||
public:
|
||||
EnumProperty(F1 setter, F2 getter)
|
||||
: Generic::EnumPropertyBase<T, U, F1, F2, Core::Generic::is_optional<U>::value>(setter, getter) {}
|
||||
};
|
||||
|
||||
|
||||
template <class C, typename R1, typename T1, typename T2>
|
||||
Core::MetaPropertyHandle enumProperty(
|
||||
const std::string& name, const std::string& type,
|
||||
bool isIndex, bool isOptional,
|
||||
const Core::MetaEnum *enumeration,
|
||||
R1 (C::*setter)(T1), T2 (C::*getter)() const) {
|
||||
return Core::createProperty<EnumProperty>(
|
||||
name, type, false, false, isIndex,
|
||||
false, isOptional, true, enumeration,
|
||||
setter, getter);
|
||||
}
|
||||
|
||||
|
||||
template <typename A, typename T, typename U, typename F1, typename F2>
|
||||
class ObjectProperty : public Generic::BaseObjectPropertyBase<A, T, U, F1, F2, Core::Generic::is_optional<U>::value> {
|
||||
public:
|
||||
ObjectProperty(F1 setter, F2 getter)
|
||||
: Generic::BaseObjectPropertyBase<A, T, U, F1, F2, Core::Generic::is_optional<U>::value>(setter, getter) {}
|
||||
};
|
||||
|
||||
|
||||
template <typename A, typename C, typename R1, typename T1, typename T2>
|
||||
Core::MetaPropertyHandle objectProperty(
|
||||
const std::string& name, const std::string& type, bool isIndex, bool isReference, bool isOptional,
|
||||
R1 (C::*setter)(T1), T2 (C::*getter)()) {
|
||||
|
||||
typedef typename std::remove_const<
|
||||
typename std::remove_cv<
|
||||
typename std::remove_pointer<
|
||||
typename std::remove_reference<T1>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type T;
|
||||
|
||||
Core::MetaPropertyHandle h = Core::MetaPropertyHandle(new ObjectProperty<A, C, T, R1 (C::*)(T1), T2 (C::*)()>(setter, getter));
|
||||
h->setInfo(name, type, false, true, isIndex, isReference, isOptional, false, nullptr);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <template <typename, typename, typename, typename, typename, typename, typename> class P,
|
||||
class C, typename T>
|
||||
Core::MetaPropertyHandle createArrayProperty(const std::string& name, const std::string& type,
|
||||
size_t (C::*counter)() const,
|
||||
T* (C::*getter)(size_t) const,
|
||||
bool (C::*adder)(T *),
|
||||
bool (C::*indexRemove)(size_t),
|
||||
bool (C::*ptrRemove)(T *)) {
|
||||
Core::MetaPropertyHandle h = Core::MetaPropertyHandle(
|
||||
new P<C, T, size_t (C::*)() const, T* (C::*)(size_t i) const, bool (C::*)(T *), bool (C::*)(size_t i), bool (C::*)(T *)>(counter, getter ,adder, indexRemove, ptrRemove));
|
||||
h->setInfo(name, type, true, true, false, false, false, false, nullptr);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
template <typename A, template <typename ,typename, typename, typename, typename, typename, typename, typename> class P,
|
||||
class C, typename T>
|
||||
Core::MetaPropertyHandle createArrayClassProperty(const std::string& name,
|
||||
const std::string& type,
|
||||
size_t (C::*counter)() const,
|
||||
T* (C::*getter)(size_t) const,
|
||||
bool (C::*adder)(T *),
|
||||
bool (C::*indexRemove)(size_t),
|
||||
bool (C::*ptrRemove)(T *)) {
|
||||
Core::MetaPropertyHandle h = Core::MetaPropertyHandle(
|
||||
new P<A, C, T, size_t (C::*)() const, T* (C::*)(size_t i) const, bool (C::*)(T *), bool (C::*)(size_t i), bool (C::*)(T *)>(counter, getter ,adder, indexRemove, ptrRemove));
|
||||
h->setInfo(name, type, true, true, false, false, false, false, nullptr);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
template <typename C, typename T>
|
||||
Core::MetaPropertyHandle arrayObjectProperty(
|
||||
const std::string& name, const std::string& type,
|
||||
size_t (C::*counter)() const,
|
||||
T* (C::*getter)(size_t) const,
|
||||
bool (C::*adder)(T *),
|
||||
bool (C::*indexRemove)(size_t),
|
||||
bool (C::*ptrRemove)(T *)
|
||||
) {
|
||||
return createArrayProperty<Generic::ArrayProperty>(name, type, counter, getter, adder, indexRemove, ptrRemove);
|
||||
}
|
||||
|
||||
|
||||
template <typename A, typename C, typename T>
|
||||
Core::MetaPropertyHandle arrayClassProperty(
|
||||
const std::string& name, const std::string& type,
|
||||
size_t (C::*counter)() const,
|
||||
T* (C::*getter)(size_t) const,
|
||||
bool (C::*adder)(T *),
|
||||
bool (C::*indexRemove)(size_t),
|
||||
bool (C::*ptrRemove)(T *)
|
||||
) {
|
||||
return createArrayClassProperty<A, Generic::ArrayClassProperty>(name, type, counter, getter, adder, indexRemove, ptrRemove);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
320
include/seiscomp/datamodel/momenttensor.h
Normal file
320
include/seiscomp/datamodel/momenttensor.h
Normal file
@ -0,0 +1,320 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MOMENTTENSOR_H
|
||||
#define SEISCOMP_DATAMODEL_MOMENTTENSOR_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/tensor.h>
|
||||
#include <seiscomp/datamodel/sourcetimefunction.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/momenttensorphasesetting.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(MomentTensor);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(DataUsed);
|
||||
DEFINE_SMARTPOINTER(MomentTensorPhaseSetting);
|
||||
DEFINE_SMARTPOINTER(MomentTensorStationContribution);
|
||||
|
||||
class FocalMechanism;
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class represents a moment tensor solution for an
|
||||
* \brief event. It is an
|
||||
* \brief optional part of a FocalMechanism description.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API MomentTensor : public PublicObject {
|
||||
DECLARE_SC_CLASS(MomentTensor)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
MomentTensor();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
MomentTensor(const MomentTensor& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
MomentTensor(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~MomentTensor() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static MomentTensor* Create();
|
||||
static MomentTensor* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static MomentTensor* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
MomentTensor& operator=(const MomentTensor& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const MomentTensor& other) const;
|
||||
bool operator!=(const MomentTensor& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const MomentTensor& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Refers to the publicID of the Origin derived in the moment
|
||||
//! tensor inversion.
|
||||
void setDerivedOriginID(const std::string& derivedOriginID);
|
||||
const std::string& derivedOriginID() const;
|
||||
|
||||
//! Refers to the publicID of the Magnitude object which
|
||||
//! represents the derived moment
|
||||
//! magnitude.
|
||||
void setMomentMagnitudeID(const std::string& momentMagnitudeID);
|
||||
const std::string& momentMagnitudeID() const;
|
||||
|
||||
//! Scalar moment as derived in moment tensor inversion in Nm.
|
||||
void setScalarMoment(const OPT(RealQuantity)& scalarMoment);
|
||||
RealQuantity& scalarMoment();
|
||||
const RealQuantity& scalarMoment() const;
|
||||
|
||||
//! Tensor object holding the moment tensor elements.
|
||||
void setTensor(const OPT(Tensor)& tensor);
|
||||
Tensor& tensor();
|
||||
const Tensor& tensor() const;
|
||||
|
||||
//! Variance of moment tensor inversion.
|
||||
void setVariance(const OPT(double)& variance);
|
||||
double variance() const;
|
||||
|
||||
//! Variance reduction of moment tensor inversion, given in
|
||||
//! percent (Dreger 2003). This is a
|
||||
//! goodness-of-fit measure.
|
||||
void setVarianceReduction(const OPT(double)& varianceReduction);
|
||||
double varianceReduction() const;
|
||||
|
||||
//! Double couple parameter obtained from moment tensor
|
||||
//! inversion (decimal fraction between 0
|
||||
//! and 1).
|
||||
void setDoubleCouple(const OPT(double)& doubleCouple);
|
||||
double doubleCouple() const;
|
||||
|
||||
//! CLVD (compensated linear vector dipole) parameter obtained
|
||||
//! from moment tensor inversion (decimal
|
||||
//! fraction between 0 and 1).
|
||||
void setClvd(const OPT(double)& clvd);
|
||||
double clvd() const;
|
||||
|
||||
//! Isotropic part obtained from moment tensor inversion
|
||||
//! (decimal fraction between 0 and 1).
|
||||
void setIso(const OPT(double)& iso);
|
||||
double iso() const;
|
||||
|
||||
//! Resource identifier of the Green's function used in moment
|
||||
//! tensor inversion.
|
||||
void setGreensFunctionID(const std::string& greensFunctionID);
|
||||
const std::string& greensFunctionID() const;
|
||||
|
||||
//! Resource identifier of the filter setup used in moment
|
||||
//! tensor inversion.
|
||||
void setFilterID(const std::string& filterID);
|
||||
const std::string& filterID() const;
|
||||
|
||||
//! Source time function used in moment-tensor inversion.
|
||||
void setSourceTimeFunction(const OPT(SourceTimeFunction)& sourceTimeFunction);
|
||||
SourceTimeFunction& sourceTimeFunction();
|
||||
const SourceTimeFunction& sourceTimeFunction() const;
|
||||
|
||||
//! Resource identifier of the method used for moment-tensor
|
||||
//! inversion.
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Moment tensor method used.
|
||||
void setMethod(const OPT(MomentTensorMethod)& method);
|
||||
MomentTensorMethod method() const;
|
||||
|
||||
//! Status of moment tensor.
|
||||
void setStatus(const OPT(MomentTensorStatus)& status);
|
||||
MomentTensorStatus status() const;
|
||||
|
||||
void setCmtName(const std::string& cmtName);
|
||||
const std::string& cmtName() const;
|
||||
|
||||
void setCmtVersion(const std::string& cmtVersion);
|
||||
const std::string& cmtVersion() const;
|
||||
|
||||
//! CreationInfo for the MomentTensor object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
bool add(DataUsed* obj);
|
||||
bool add(MomentTensorPhaseSetting* obj);
|
||||
bool add(MomentTensorStationContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
bool remove(DataUsed* obj);
|
||||
bool remove(MomentTensorPhaseSetting* obj);
|
||||
bool remove(MomentTensorStationContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeDataUsed(size_t i);
|
||||
bool removeMomentTensorPhaseSetting(size_t i);
|
||||
bool removeMomentTensorPhaseSetting(const MomentTensorPhaseSettingIndex& i);
|
||||
bool removeMomentTensorStationContribution(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
size_t dataUsedCount() const;
|
||||
size_t momentTensorPhaseSettingCount() const;
|
||||
size_t momentTensorStationContributionCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
DataUsed* dataUsed(size_t i) const;
|
||||
|
||||
MomentTensorPhaseSetting* momentTensorPhaseSetting(size_t i) const;
|
||||
MomentTensorPhaseSetting* momentTensorPhaseSetting(const MomentTensorPhaseSettingIndex& i) const;
|
||||
MomentTensorStationContribution* momentTensorStationContribution(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
DataUsed* findDataUsed(DataUsed* dataUsed) const;
|
||||
MomentTensorStationContribution* findMomentTensorStationContribution(const std::string& publicID) const;
|
||||
|
||||
FocalMechanism* focalMechanism() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _derivedOriginID;
|
||||
std::string _momentMagnitudeID;
|
||||
OPT(RealQuantity) _scalarMoment;
|
||||
OPT(Tensor) _tensor;
|
||||
OPT(double) _variance;
|
||||
OPT(double) _varianceReduction;
|
||||
OPT(double) _doubleCouple;
|
||||
OPT(double) _clvd;
|
||||
OPT(double) _iso;
|
||||
std::string _greensFunctionID;
|
||||
std::string _filterID;
|
||||
OPT(SourceTimeFunction) _sourceTimeFunction;
|
||||
std::string _methodID;
|
||||
OPT(MomentTensorMethod) _method;
|
||||
OPT(MomentTensorStatus) _status;
|
||||
std::string _cmtName;
|
||||
std::string _cmtVersion;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<DataUsedPtr> _dataUseds;
|
||||
std::vector<MomentTensorPhaseSettingPtr> _momentTensorPhaseSettings;
|
||||
std::vector<MomentTensorStationContributionPtr> _momentTensorStationContributions;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(MomentTensor);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
196
include/seiscomp/datamodel/momenttensorcomponentcontribution.h
Normal file
196
include/seiscomp/datamodel/momenttensorcomponentcontribution.h
Normal file
@ -0,0 +1,196 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MOMENTTENSORCOMPONENTCONTRIBUTION_H
|
||||
#define SEISCOMP_DATAMODEL_MOMENTTENSORCOMPONENTCONTRIBUTION_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(MomentTensorComponentContribution);
|
||||
|
||||
class MomentTensorStationContribution;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API MomentTensorComponentContributionIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
MomentTensorComponentContributionIndex();
|
||||
MomentTensorComponentContributionIndex(const std::string& phaseCode,
|
||||
int component);
|
||||
|
||||
//! Copy constructor
|
||||
MomentTensorComponentContributionIndex(const MomentTensorComponentContributionIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const MomentTensorComponentContributionIndex&) const;
|
||||
bool operator!=(const MomentTensorComponentContributionIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string phaseCode;
|
||||
int component;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API MomentTensorComponentContribution : public Object {
|
||||
DECLARE_SC_CLASS(MomentTensorComponentContribution)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
MomentTensorComponentContribution();
|
||||
|
||||
//! Copy constructor
|
||||
MomentTensorComponentContribution(const MomentTensorComponentContribution& other);
|
||||
|
||||
//! Custom constructor
|
||||
MomentTensorComponentContribution(const std::string& phaseCode);
|
||||
MomentTensorComponentContribution(const std::string& phaseCode,
|
||||
int component,
|
||||
bool active,
|
||||
double weight,
|
||||
double timeShift,
|
||||
double dataTimeWindow,
|
||||
const OPT(double)& misfit = Seiscomp::Core::None,
|
||||
const OPT(double)& snr = Seiscomp::Core::None);
|
||||
|
||||
//! Destructor
|
||||
~MomentTensorComponentContribution() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
MomentTensorComponentContribution& operator=(const MomentTensorComponentContribution& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const MomentTensorComponentContribution& other) const;
|
||||
bool operator!=(const MomentTensorComponentContribution& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const MomentTensorComponentContribution& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setPhaseCode(const std::string& phaseCode);
|
||||
const std::string& phaseCode() const;
|
||||
|
||||
void setComponent(int component);
|
||||
int component() const;
|
||||
|
||||
void setActive(bool active);
|
||||
bool active() const;
|
||||
|
||||
void setWeight(double weight);
|
||||
double weight() const;
|
||||
|
||||
void setTimeShift(double timeShift);
|
||||
double timeShift() const;
|
||||
|
||||
void setDataTimeWindow(const std::vector< double >&);
|
||||
const std::vector< double >& dataTimeWindow() const;
|
||||
std::vector< double >& dataTimeWindow();
|
||||
|
||||
void setMisfit(const OPT(double)& misfit);
|
||||
double misfit() const;
|
||||
|
||||
void setSnr(const OPT(double)& snr);
|
||||
double snr() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const MomentTensorComponentContributionIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const MomentTensorComponentContribution* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
MomentTensorStationContribution* momentTensorStationContribution() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
MomentTensorComponentContributionIndex _index;
|
||||
|
||||
// Attributes
|
||||
bool _active;
|
||||
double _weight;
|
||||
double _timeShift;
|
||||
std::vector< double > _dataTimeWindow;
|
||||
OPT(double) _misfit;
|
||||
OPT(double) _snr;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
178
include/seiscomp/datamodel/momenttensorphasesetting.h
Normal file
178
include/seiscomp/datamodel/momenttensorphasesetting.h
Normal file
@ -0,0 +1,178 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MOMENTTENSORPHASESETTING_H
|
||||
#define SEISCOMP_DATAMODEL_MOMENTTENSORPHASESETTING_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(MomentTensorPhaseSetting);
|
||||
|
||||
class MomentTensor;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API MomentTensorPhaseSettingIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
MomentTensorPhaseSettingIndex();
|
||||
MomentTensorPhaseSettingIndex(const std::string& code);
|
||||
|
||||
//! Copy constructor
|
||||
MomentTensorPhaseSettingIndex(const MomentTensorPhaseSettingIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const MomentTensorPhaseSettingIndex&) const;
|
||||
bool operator!=(const MomentTensorPhaseSettingIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string code;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API MomentTensorPhaseSetting : public Object {
|
||||
DECLARE_SC_CLASS(MomentTensorPhaseSetting)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
MomentTensorPhaseSetting();
|
||||
|
||||
//! Copy constructor
|
||||
MomentTensorPhaseSetting(const MomentTensorPhaseSetting& other);
|
||||
|
||||
//! Custom constructor
|
||||
MomentTensorPhaseSetting(const std::string& code);
|
||||
MomentTensorPhaseSetting(const std::string& code,
|
||||
double lowerPeriod,
|
||||
double upperPeriod,
|
||||
const OPT(double)& minimumSNR = Seiscomp::Core::None,
|
||||
const OPT(double)& maximumTimeShift = Seiscomp::Core::None);
|
||||
|
||||
//! Destructor
|
||||
~MomentTensorPhaseSetting() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
MomentTensorPhaseSetting& operator=(const MomentTensorPhaseSetting& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const MomentTensorPhaseSetting& other) const;
|
||||
bool operator!=(const MomentTensorPhaseSetting& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const MomentTensorPhaseSetting& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setCode(const std::string& code);
|
||||
const std::string& code() const;
|
||||
|
||||
void setLowerPeriod(double lowerPeriod);
|
||||
double lowerPeriod() const;
|
||||
|
||||
void setUpperPeriod(double upperPeriod);
|
||||
double upperPeriod() const;
|
||||
|
||||
void setMinimumSNR(const OPT(double)& minimumSNR);
|
||||
double minimumSNR() const;
|
||||
|
||||
void setMaximumTimeShift(const OPT(double)& maximumTimeShift);
|
||||
double maximumTimeShift() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const MomentTensorPhaseSettingIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const MomentTensorPhaseSetting* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
MomentTensor* momentTensor() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
MomentTensorPhaseSettingIndex _index;
|
||||
|
||||
// Attributes
|
||||
double _lowerPeriod;
|
||||
double _upperPeriod;
|
||||
OPT(double) _minimumSNR;
|
||||
OPT(double) _maximumTimeShift;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
195
include/seiscomp/datamodel/momenttensorstationcontribution.h
Normal file
195
include/seiscomp/datamodel/momenttensorstationcontribution.h
Normal file
@ -0,0 +1,195 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_MOMENTTENSORSTATIONCONTRIBUTION_H
|
||||
#define SEISCOMP_DATAMODEL_MOMENTTENSORSTATIONCONTRIBUTION_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/momenttensorcomponentcontribution.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(MomentTensorStationContribution);
|
||||
DEFINE_SMARTPOINTER(MomentTensorComponentContribution);
|
||||
|
||||
class MomentTensor;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API MomentTensorStationContribution : public PublicObject {
|
||||
DECLARE_SC_CLASS(MomentTensorStationContribution)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
MomentTensorStationContribution();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
MomentTensorStationContribution(const MomentTensorStationContribution& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
MomentTensorStationContribution(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~MomentTensorStationContribution() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static MomentTensorStationContribution* Create();
|
||||
static MomentTensorStationContribution* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static MomentTensorStationContribution* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
MomentTensorStationContribution& operator=(const MomentTensorStationContribution& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const MomentTensorStationContribution& other) const;
|
||||
bool operator!=(const MomentTensorStationContribution& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const MomentTensorStationContribution& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setActive(bool active);
|
||||
bool active() const;
|
||||
|
||||
void setWaveformID(const OPT(WaveformStreamID)& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
void setWeight(const OPT(double)& weight);
|
||||
double weight() const;
|
||||
|
||||
void setTimeShift(const OPT(double)& timeShift);
|
||||
double timeShift() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(MomentTensorComponentContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(MomentTensorComponentContribution* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeMomentTensorComponentContribution(size_t i);
|
||||
bool removeMomentTensorComponentContribution(const MomentTensorComponentContributionIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t momentTensorComponentContributionCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
MomentTensorComponentContribution* momentTensorComponentContribution(size_t i) const;
|
||||
MomentTensorComponentContribution* momentTensorComponentContribution(const MomentTensorComponentContributionIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
MomentTensor* momentTensor() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
bool _active;
|
||||
OPT(WaveformStreamID) _waveformID;
|
||||
OPT(double) _weight;
|
||||
OPT(double) _timeShift;
|
||||
|
||||
// Aggregations
|
||||
std::vector<MomentTensorComponentContributionPtr> _momentTensorComponentContributions;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(MomentTensorStationContribution);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
301
include/seiscomp/datamodel/network.h
Normal file
301
include/seiscomp/datamodel/network.h
Normal file
@ -0,0 +1,301 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_NETWORK_H
|
||||
#define SEISCOMP_DATAMODEL_NETWORK_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/station.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Network);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(Station);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API NetworkIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
NetworkIndex();
|
||||
NetworkIndex(const std::string& code,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
NetworkIndex(const NetworkIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const NetworkIndex&) const;
|
||||
bool operator!=(const NetworkIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string code;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a network of seismic stations
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Network : public PublicObject {
|
||||
DECLARE_SC_CLASS(Network)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Network();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Network(const Network& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Network(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Network() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Network* Create();
|
||||
static Network* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Network* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Network& operator=(const Network& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Network& other) const;
|
||||
bool operator!=(const Network& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Network& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Network code (50.16)
|
||||
void setCode(const std::string& code);
|
||||
const std::string& code() const;
|
||||
|
||||
//! Start of network epoch in ISO datetime format. Needed
|
||||
//! primarily to identifytemorary networks that re-use network
|
||||
//! codes
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of station epoch. Empty string if the station is open
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! Network description (50.10)
|
||||
void setDescription(const std::string& description);
|
||||
const std::string& description() const;
|
||||
|
||||
//! Institution(s) operating the network
|
||||
void setInstitutions(const std::string& institutions);
|
||||
const std::string& institutions() const;
|
||||
|
||||
//! Region of the network (eg., euromed, global)
|
||||
void setRegion(const std::string& region);
|
||||
const std::string& region() const;
|
||||
|
||||
//! Type of the network (eg., VBB, SP)
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
//! ';p'; for permanent, ';t'; for temporary
|
||||
void setNetClass(const std::string& netClass);
|
||||
const std::string& netClass() const;
|
||||
|
||||
//! Archive/Datacenter ID (metadata authority)
|
||||
void setArchive(const std::string& archive);
|
||||
const std::string& archive() const;
|
||||
|
||||
//! Whether the network is "restricted"
|
||||
void setRestricted(const OPT(bool)& restricted);
|
||||
bool restricted() const;
|
||||
|
||||
//! Whether the metadata is synchronized with other datacenters
|
||||
void setShared(const OPT(bool)& shared);
|
||||
bool shared() const;
|
||||
|
||||
//! Any notes
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const NetworkIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Network* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
bool add(Station* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
bool remove(Station* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeStation(size_t i);
|
||||
bool removeStation(const StationIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
size_t stationCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
Station* station(size_t i) const;
|
||||
Station* station(const StationIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
Station* findStation(const std::string& publicID) const;
|
||||
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
NetworkIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
std::string _description;
|
||||
std::string _institutions;
|
||||
std::string _region;
|
||||
std::string _type;
|
||||
std::string _netClass;
|
||||
std::string _archive;
|
||||
OPT(bool) _restricted;
|
||||
OPT(bool) _shared;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<StationPtr> _stations;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Network);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
113
include/seiscomp/datamodel/nodalplane.h
Normal file
113
include/seiscomp/datamodel/nodalplane.h
Normal file
@ -0,0 +1,113 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_NODALPLANE_H
|
||||
#define SEISCOMP_DATAMODEL_NODALPLANE_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(NodalPlane);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes a nodal plane using the attributes
|
||||
* \brief strike, dip, and
|
||||
* \brief rake. For a definition of the angles see Aki and Richards
|
||||
* \brief (1980).
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API NodalPlane : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(NodalPlane)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
NodalPlane();
|
||||
|
||||
//! Copy constructor
|
||||
NodalPlane(const NodalPlane& other);
|
||||
|
||||
//! Destructor
|
||||
~NodalPlane() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
NodalPlane& operator=(const NodalPlane& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const NodalPlane& other) const;
|
||||
bool operator!=(const NodalPlane& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const NodalPlane& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Strike angle of nodal plane in degrees.
|
||||
void setStrike(const RealQuantity& strike);
|
||||
RealQuantity& strike();
|
||||
const RealQuantity& strike() const;
|
||||
|
||||
//! Dip angle of nodal plane in degrees.
|
||||
void setDip(const RealQuantity& dip);
|
||||
RealQuantity& dip();
|
||||
const RealQuantity& dip() const;
|
||||
|
||||
//! Rake angle of nodal plane in degrees.
|
||||
void setRake(const RealQuantity& rake);
|
||||
RealQuantity& rake();
|
||||
const RealQuantity& rake() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
RealQuantity _strike;
|
||||
RealQuantity _dip;
|
||||
RealQuantity _rake;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
112
include/seiscomp/datamodel/nodalplanes.h
Normal file
112
include/seiscomp/datamodel/nodalplanes.h
Normal file
@ -0,0 +1,112 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_NODALPLANES_H
|
||||
#define SEISCOMP_DATAMODEL_NODALPLANES_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/nodalplane.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(NodalPlanes);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes the nodal planes of a double-couple
|
||||
* \brief moment-tensor solution. The attribute preferredPlane
|
||||
* \brief can be used to define which plane is the preferred one.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API NodalPlanes : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(NodalPlanes)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
NodalPlanes();
|
||||
|
||||
//! Copy constructor
|
||||
NodalPlanes(const NodalPlanes& other);
|
||||
|
||||
//! Destructor
|
||||
~NodalPlanes() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
NodalPlanes& operator=(const NodalPlanes& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const NodalPlanes& other) const;
|
||||
bool operator!=(const NodalPlanes& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const NodalPlanes& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! First nodal plane of double-couple moment tensor solution.
|
||||
void setNodalPlane1(const OPT(NodalPlane)& nodalPlane1);
|
||||
NodalPlane& nodalPlane1();
|
||||
const NodalPlane& nodalPlane1() const;
|
||||
|
||||
//! Second nodal plane of double-couple moment tensor solution.
|
||||
void setNodalPlane2(const OPT(NodalPlane)& nodalPlane2);
|
||||
NodalPlane& nodalPlane2();
|
||||
const NodalPlane& nodalPlane2() const;
|
||||
|
||||
//! Indicator for preferred nodal plane of moment tensor
|
||||
//! solution. It can take integer values 1 or 2.
|
||||
void setPreferredPlane(const OPT(int)& preferredPlane);
|
||||
int preferredPlane() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
OPT(NodalPlane) _nodalPlane1;
|
||||
OPT(NodalPlane) _nodalPlane2;
|
||||
OPT(int) _preferredPlane;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
319
include/seiscomp/datamodel/notifier.h
Normal file
319
include/seiscomp/datamodel/notifier.h
Normal file
@ -0,0 +1,319 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_NOTIFIER_H__
|
||||
#define SEISCOMP_DATAMODEL_NOTIFIER_H__
|
||||
|
||||
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/genericmessage.h>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Notifier);
|
||||
// Full namespace specifier needed due to a bug (?) in SWIG >1.3.27
|
||||
DEFINE_MESSAGE_FOR(Seiscomp::DataModel::Notifier, NotifierMessage, SC_SYSTEM_CORE_API);
|
||||
|
||||
class SC_SYSTEM_CORE_API Notifier : public Seiscomp::Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Notifier);
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Enumerations
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
enum CompareResult {
|
||||
CR_DIFFERENT,
|
||||
CR_EQUAL,
|
||||
CR_OPPOSITE,
|
||||
CR_OVERRIDE,
|
||||
CR_QUANTITY
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Types
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
typedef std::list<NotifierPtr> Pool;
|
||||
typedef Pool::iterator PoolIterator;
|
||||
typedef Pool::const_iterator PoolConstIterator;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Constructs a notifier. This custom created notifier will not be
|
||||
* inserted into the notifier pool. The user is responsible for
|
||||
* sending the notifier in a message.
|
||||
*/
|
||||
Notifier(const std::string& parentID, Operation, Object* object);
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
Notifier();
|
||||
|
||||
public:
|
||||
//! Destructor
|
||||
~Notifier();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! Enables the notifier pool.
|
||||
static void Enable();
|
||||
|
||||
//! Disables the notifier pool. No notifications will be
|
||||
//! created at all.
|
||||
static void Disable();
|
||||
|
||||
//! Sets the state of the notifier pool
|
||||
static void SetEnabled(bool);
|
||||
|
||||
//! Returns the notification pool state.
|
||||
//! The default is TRUE.
|
||||
static bool IsEnabled();
|
||||
|
||||
//! Enables/disables checking previous inserted notifiers
|
||||
//! when a new notifiers is about to be queued. When
|
||||
//! enabled, and OP_ADD and OP_UPDATE of the same object
|
||||
//! results in only one OP_ADD notifier.
|
||||
static void SetCheckEnabled(bool);
|
||||
|
||||
//! Returns the current 'check' state
|
||||
static bool IsCheckEnabled();
|
||||
|
||||
|
||||
/**
|
||||
* Returns a message holding all notifications since the
|
||||
* last call. All stored notifications will be removed from
|
||||
* the notification pool.
|
||||
* @param allNotifier Defines whether to return one message
|
||||
* including all notifier or one message
|
||||
* including one notifier
|
||||
* @return The message object, if there is one. If each
|
||||
* notifier is send by its own message one should
|
||||
* call this method until it returns nullptr.
|
||||
*/
|
||||
static NotifierMessage* GetMessage(bool allNotifier = true);
|
||||
|
||||
//! Returns the size of the notifier objects currently stored.
|
||||
static size_t Size();
|
||||
|
||||
//! Clears all buffered notifiers.
|
||||
static void Clear();
|
||||
|
||||
/**
|
||||
* Creates a notifier object managed by the global notifier pool.
|
||||
* If the notifier pool is disabled no notifier instance will
|
||||
* be created.
|
||||
* @param parentID The publicId of the parent object that is target
|
||||
* of the operation
|
||||
* @param op The operation applied to the parent object
|
||||
* @param object The object that is the operation's "operand"
|
||||
* @return The notifier object. The returned object MUST NOT be
|
||||
* deleted by the caller explicitly. Nevertheless one can
|
||||
* store a smartpointer to the object.
|
||||
*/
|
||||
static Notifier* Create(const std::string& parentID,
|
||||
Operation op,
|
||||
Object* object);
|
||||
|
||||
/**
|
||||
* Creates a notifier object managed by the global notifier pool.
|
||||
* If the notifier pool is disabled no notifier instance will
|
||||
* be created.
|
||||
* @param parent The parent object that is target of the operation
|
||||
* @param op The operation applied to the parent object
|
||||
* @param object The object that is the operation's "operand"
|
||||
* @return The notifier object. The returned object MUST NOT be
|
||||
* deleted by the caller explicitly. Nevertheless one can
|
||||
* store a smartpointer to the object.
|
||||
*/
|
||||
static Notifier* Create(PublicObject* parent,
|
||||
Operation op,
|
||||
Object* object);
|
||||
|
||||
//! Apply the notification
|
||||
bool apply() const;
|
||||
|
||||
|
||||
//! Sets the publicID of the parent object
|
||||
void setParentID(const std::string &);
|
||||
|
||||
//! Returns publicId of the parent object
|
||||
const std::string& parentID() const;
|
||||
|
||||
|
||||
//! Sets the operation
|
||||
void setOperation(Operation);
|
||||
|
||||
//! Returns the operation defined for the notifier
|
||||
Operation operation() const;
|
||||
|
||||
|
||||
//! Sets the object regarding the operation
|
||||
void setObject(Object* object);
|
||||
|
||||
//! Returns the object regarding the operation
|
||||
Object* object() const;
|
||||
|
||||
/**
|
||||
* Compares to notifier by each other and returns the
|
||||
* result. Notifier can be EQUAL, that means they express
|
||||
* the same thing. They can be DIFFERENT, which means that
|
||||
* they do not have anything in common and they can be
|
||||
* OPPOSITE to each other meaning they neutralize each other.
|
||||
* E.g. n1 = ABCNotifier(OP_ADD, myObject)
|
||||
* n2 = ABCNotifier(OP_REMOVE, myObject)
|
||||
* n1.cmp(n2) = CR_OPPOSITE
|
||||
*/
|
||||
CompareResult cmp(const Notifier*) const;
|
||||
CompareResult cmp(const Notifier&) const;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
std::string _parentID;
|
||||
Operation _operation;
|
||||
ObjectPtr _object;
|
||||
|
||||
static boost::thread_specific_ptr<bool> _lock;
|
||||
static Pool _notifiers;
|
||||
static bool _checkOnCreate;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Notifier);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief A visitor that creates notifiers for a given subtree
|
||||
* \brief and appends them to the global notifier pool.
|
||||
*/
|
||||
class NotifierCreator : public Visitor {
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
NotifierCreator(Operation op);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
bool visit(PublicObject*);
|
||||
void visit(Object*);
|
||||
|
||||
private:
|
||||
Operation _operation;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief A visitor that creates notifiers for a given subtree
|
||||
* \brief and appends them to a local list
|
||||
*/
|
||||
template <class T>
|
||||
class NotifierStoreAppender : public Visitor {
|
||||
// ----------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
NotifierStoreAppender(T &store, Operation op, const std::string &parentID = "")
|
||||
: Visitor(op == OP_REMOVE?TM_BOTTOMUP:TM_TOPDOWN),
|
||||
_store(&store), _operation(op), _parentID(parentID) {}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
bool visit(PublicObject *po) {
|
||||
if ( po->parent() == nullptr ) {
|
||||
if ( _parentID.empty() )
|
||||
return false;
|
||||
_store->push_back(new Notifier(_parentID, _operation, po));
|
||||
}
|
||||
else
|
||||
_store->push_back(new Notifier(po->parent()->publicID(), _operation, po));
|
||||
return true;
|
||||
}
|
||||
|
||||
void visit(Object *o) {
|
||||
if ( o->parent() == nullptr ) {
|
||||
if ( _parentID.empty() )
|
||||
return;
|
||||
_store->push_back(new Notifier(_parentID, _operation, o));
|
||||
}
|
||||
else
|
||||
_store->push_back(new Notifier(o->parent()->publicID(), _operation, o));
|
||||
}
|
||||
|
||||
private:
|
||||
T *_store;
|
||||
Operation _operation;
|
||||
const std::string &_parentID;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void AppendNotifier(T &store, Operation op, Object *o, const std::string parentID = "") {
|
||||
// Remember the size of the store before any modifications
|
||||
size_t endPos = store.size();
|
||||
|
||||
// Create a store appender and visit all child objects
|
||||
NotifierStoreAppender<T> nsa(store, op, parentID);
|
||||
o->accept(&nsa);
|
||||
|
||||
// If a parent id was specified and elements have been added to the
|
||||
// store, override the parent id of the first object (o). Note: The
|
||||
// position of the Notifier of o depends on the operation
|
||||
// (OP_ADD vs. OP_REMOVE). It is either the first or the last element
|
||||
// added to the store.
|
||||
if ( !parentID.empty() && store.size() > endPos ) {
|
||||
size_t pos = op == OP_REMOVE ? store.size()-1 : endPos;
|
||||
NotifierPtr n = store.at(pos);
|
||||
n->setParentID(parentID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // of NS DataModel
|
||||
} // of NS Seiscomp
|
||||
|
||||
|
||||
#endif
|
||||
257
include/seiscomp/datamodel/object.h
Normal file
257
include/seiscomp/datamodel/object.h
Normal file
@ -0,0 +1,257 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_SCHEMEOBJECT_H__
|
||||
#define SEISCOMP_DATAMODEL_SCHEMEOBJECT_H__
|
||||
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core/enumeration.h>
|
||||
#include <seiscomp/core/metaobject.h>
|
||||
#include <seiscomp/core/metaproperty.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Object);
|
||||
DEFINE_SMARTPOINTER(Observer);
|
||||
DEFINE_SMARTPOINTER(Visitor);
|
||||
class PublicObject;
|
||||
class DatabaseArchive;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Observer : public Seiscomp::Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Observer);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected c'tor
|
||||
Observer();
|
||||
|
||||
public:
|
||||
//! D'tor
|
||||
virtual ~Observer() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! This method is called when a new child has been
|
||||
//! added to an object
|
||||
virtual void onObjectAdded(Object* parent,
|
||||
Object* newChild);
|
||||
|
||||
//! This method is triggered when a child has been
|
||||
//! removed from an object
|
||||
virtual void onObjectRemoved(Object* parent,
|
||||
Object* oldChild);
|
||||
|
||||
//! Whenever an objects gets updated this method will be called
|
||||
virtual void onObjectModified(Object* object);
|
||||
|
||||
//! Destruction callback
|
||||
virtual void onObjectDestroyed(Object* object);
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Visitor {
|
||||
public:
|
||||
enum TraversalMode {
|
||||
TM_TOPDOWN,
|
||||
TM_BOTTOMUP,
|
||||
TM_QUANTITY
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected c'tor
|
||||
Visitor(TraversalMode = TM_TOPDOWN);
|
||||
|
||||
public:
|
||||
//! D'tor
|
||||
virtual ~Visitor();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
TraversalMode traversal() const;
|
||||
|
||||
//! Callback when visiting a PublicObject.
|
||||
//! When this methods returns false and the traversal has to
|
||||
//! be done TOPDOWN, the traversion stops
|
||||
virtual bool visit(PublicObject*) = 0;
|
||||
virtual void visit(Object*) = 0;
|
||||
|
||||
//! If visit(PublicObject* po) returns true and traversal is
|
||||
//! done TOPDOWN this methods will be called when visiting 'po'
|
||||
//! has been finished
|
||||
virtual void finished() {}
|
||||
|
||||
private:
|
||||
TraversalMode _traversal;
|
||||
};
|
||||
|
||||
|
||||
MAKEENUM(
|
||||
Operation,
|
||||
EVALUES(
|
||||
OP_UNDEFINED,
|
||||
OP_ADD,
|
||||
OP_REMOVE,
|
||||
OP_UPDATE
|
||||
),
|
||||
ENAMES(
|
||||
"undefined",
|
||||
"add",
|
||||
"remove",
|
||||
"update"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
extern DECLARE_METAENUM(Operation, MetaOperation);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Object : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Object);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Enumerations
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
/*
|
||||
enum Operation {
|
||||
OP_UNDEFINED,
|
||||
OP_ADD,
|
||||
OP_REMOVE,
|
||||
OP_UPDATE,
|
||||
OP_QUANTITY
|
||||
};
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Constructor
|
||||
Object() = default;
|
||||
|
||||
//! Copy constructor
|
||||
Object(const Object& other);
|
||||
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~Object() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the parent object
|
||||
PublicObject* parent() const;
|
||||
|
||||
//! Sets the parent element
|
||||
bool setParent(PublicObject* parent);
|
||||
|
||||
static bool RegisterObserver(Observer*);
|
||||
static bool UnregisterObserver(Observer*);
|
||||
|
||||
//! Creates a notifier that updates this object
|
||||
void update();
|
||||
|
||||
//! Sets the last modification timestamp. This attribute is not part
|
||||
//! of a data model and will not be written to e.g. the database. Each
|
||||
//! archive may handle or may not handle that value.
|
||||
void setLastModifiedInArchive(const Core::Time &t);
|
||||
|
||||
//! Returns the last modification timestamp as read from the database
|
||||
//! column _last_modified. May be invalid if either the database does
|
||||
//! not support that column or the object has been created in memory.
|
||||
const Core::Time &lastModifiedInArchive() const;
|
||||
|
||||
//! Assign the metadata of 'other' to 'this'
|
||||
//! Returns true, if this and other are of same
|
||||
//! type, false else.
|
||||
virtual bool assign(Object* other) = 0;
|
||||
|
||||
//! Clones an object. If the clonee is a PublicObject
|
||||
//! it does not become registered in the global instance
|
||||
//! pool but receives exactly the same publicID like
|
||||
//! 'this'.
|
||||
virtual Object* clone() const = 0;
|
||||
|
||||
//! Adds the object to a parent. If it has already
|
||||
//! a parent, the method returns false.
|
||||
virtual bool attachTo(PublicObject* parent) = 0;
|
||||
//! Removes the object from a parent. If it has another or
|
||||
//! no parent, the method returns false.
|
||||
virtual bool detachFrom(PublicObject* parent) = 0;
|
||||
|
||||
//! Removes the object from its parent object
|
||||
virtual bool detach() = 0;
|
||||
|
||||
//! Visitor interface
|
||||
virtual void accept(Visitor*) = 0;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Protected interface
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! This methods has the be called in derived classes to
|
||||
//! notify registered observers
|
||||
void childAdded(Object*);
|
||||
void childRemoved(Object*);
|
||||
void modified();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Private members
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
PublicObject *_parent{nullptr};
|
||||
Core::Time _lastModifiedInArchive;
|
||||
|
||||
typedef std::vector<Observer*> ObserverList;
|
||||
static ObserverList _observers;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
338
include/seiscomp/datamodel/origin.h
Normal file
338
include/seiscomp/datamodel/origin.h
Normal file
@ -0,0 +1,338 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ORIGIN_H
|
||||
#define SEISCOMP_DATAMODEL_ORIGIN_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/timequantity.h>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/originquality.h>
|
||||
#include <seiscomp/datamodel/originuncertainty.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Origin);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
DEFINE_SMARTPOINTER(CompositeTime);
|
||||
DEFINE_SMARTPOINTER(Arrival);
|
||||
DEFINE_SMARTPOINTER(StationMagnitude);
|
||||
DEFINE_SMARTPOINTER(Magnitude);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class represents the focal time and geographical
|
||||
* \brief location of an
|
||||
* \brief earthquake hypocenter, as well as additional
|
||||
* \brief meta-information. Origin
|
||||
* \brief can have objects of type OriginUncertainty and Arrival as
|
||||
* \brief child elements.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Origin : public PublicObject {
|
||||
DECLARE_SC_CLASS(Origin)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Origin();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Origin(const Origin& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Origin(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Origin() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Origin* Create();
|
||||
static Origin* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Origin* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Origin& operator=(const Origin& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Origin& other) const;
|
||||
bool operator!=(const Origin& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Origin& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Focal time as TimeQuantity.
|
||||
void setTime(const TimeQuantity& time);
|
||||
TimeQuantity& time();
|
||||
const TimeQuantity& time() const;
|
||||
|
||||
//! Hypocenter latitude with respect to the World Geodetic
|
||||
//! System 1984
|
||||
//! (WGS84) reference system (National Imagery and Mapping
|
||||
//! Agency 2000)
|
||||
//! in degrees. Uncertainties are given in kilometers.
|
||||
void setLatitude(const RealQuantity& latitude);
|
||||
RealQuantity& latitude();
|
||||
const RealQuantity& latitude() const;
|
||||
|
||||
//! Hypocenter longitude with respect to the World Geodetic
|
||||
//! System 1984
|
||||
//! (WGS84) reference system (National Imagery and Mapping
|
||||
//! Agency 2000)
|
||||
//! in degrees. Uncertainties are given in kilometers.
|
||||
void setLongitude(const RealQuantity& longitude);
|
||||
RealQuantity& longitude();
|
||||
const RealQuantity& longitude() const;
|
||||
|
||||
//! Depth of hypocenter with respect to the nominal sea level
|
||||
//! given by the
|
||||
//! WGS84 geoid (Earth Gravitational Model, EGM96, Lemoine et
|
||||
//! al. 1998).
|
||||
//! Positive values indicate hypocenters below sea level. For
|
||||
//! shallow
|
||||
//! hypocenters, the depth value can be negative. The depth is
|
||||
//! defined
|
||||
//! in km.
|
||||
void setDepth(const OPT(RealQuantity)& depth);
|
||||
RealQuantity& depth();
|
||||
const RealQuantity& depth() const;
|
||||
|
||||
//! Type of depth determination.
|
||||
void setDepthType(const OPT(OriginDepthType)& depthType);
|
||||
OriginDepthType depthType() const;
|
||||
|
||||
//! Boolean flag. True if focal time was kept fixed for
|
||||
//! computation of the Origin.
|
||||
void setTimeFixed(const OPT(bool)& timeFixed);
|
||||
bool timeFixed() const;
|
||||
|
||||
//! Boolean flag. True if epicenter was kept fixed for
|
||||
//! computation of Origin.
|
||||
void setEpicenterFixed(const OPT(bool)& epicenterFixed);
|
||||
bool epicenterFixed() const;
|
||||
|
||||
//! Identifies the reference system used for hypocenter
|
||||
//! determination. This is only necessary if
|
||||
//! a modified version of the standard (with local extensions)
|
||||
//! is used that provides a non-standard coordinate
|
||||
//! system.
|
||||
void setReferenceSystemID(const std::string& referenceSystemID);
|
||||
const std::string& referenceSystemID() const;
|
||||
|
||||
//! Identifies the method used for locating the event.
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Identifies the earth model used in methodID.
|
||||
void setEarthModelID(const std::string& earthModelID);
|
||||
const std::string& earthModelID() const;
|
||||
|
||||
//! Additional parameters describing the quality of an Origin
|
||||
//! determination.
|
||||
void setQuality(const OPT(OriginQuality)& quality);
|
||||
OriginQuality& quality();
|
||||
const OriginQuality& quality() const;
|
||||
|
||||
//! Additional parameters describing the uncertainty of an
|
||||
//! Origin determination.
|
||||
void setUncertainty(const OPT(OriginUncertainty)& uncertainty);
|
||||
OriginUncertainty& uncertainty();
|
||||
const OriginUncertainty& uncertainty() const;
|
||||
|
||||
//! Describes the Origin type.
|
||||
void setType(const OPT(OriginType)& type);
|
||||
OriginType type() const;
|
||||
|
||||
//! Evaluation mode of Origin.
|
||||
void setEvaluationMode(const OPT(EvaluationMode)& evaluationMode);
|
||||
EvaluationMode evaluationMode() const;
|
||||
|
||||
//! Evaluation status of Origin.
|
||||
void setEvaluationStatus(const OPT(EvaluationStatus)& evaluationStatus);
|
||||
EvaluationStatus evaluationStatus() const;
|
||||
|
||||
//! CreationInfo for the Origin object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
bool add(CompositeTime* obj);
|
||||
bool add(Arrival* obj);
|
||||
bool add(StationMagnitude* obj);
|
||||
bool add(Magnitude* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
bool remove(CompositeTime* obj);
|
||||
bool remove(Arrival* obj);
|
||||
bool remove(StationMagnitude* obj);
|
||||
bool remove(Magnitude* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
bool removeCompositeTime(size_t i);
|
||||
bool removeArrival(size_t i);
|
||||
bool removeArrival(const ArrivalIndex& i);
|
||||
bool removeStationMagnitude(size_t i);
|
||||
bool removeMagnitude(size_t i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
size_t compositeTimeCount() const;
|
||||
size_t arrivalCount() const;
|
||||
size_t stationMagnitudeCount() const;
|
||||
size_t magnitudeCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
CompositeTime* compositeTime(size_t i) const;
|
||||
|
||||
Arrival* arrival(size_t i) const;
|
||||
Arrival* arrival(const ArrivalIndex& i) const;
|
||||
StationMagnitude* stationMagnitude(size_t i) const;
|
||||
Magnitude* magnitude(size_t i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
CompositeTime* findCompositeTime(CompositeTime* compositeTime) const;
|
||||
StationMagnitude* findStationMagnitude(const std::string& publicID) const;
|
||||
Magnitude* findMagnitude(const std::string& publicID) const;
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
TimeQuantity _time;
|
||||
RealQuantity _latitude;
|
||||
RealQuantity _longitude;
|
||||
OPT(RealQuantity) _depth;
|
||||
OPT(OriginDepthType) _depthType;
|
||||
OPT(bool) _timeFixed;
|
||||
OPT(bool) _epicenterFixed;
|
||||
std::string _referenceSystemID;
|
||||
std::string _methodID;
|
||||
std::string _earthModelID;
|
||||
OPT(OriginQuality) _quality;
|
||||
OPT(OriginUncertainty) _uncertainty;
|
||||
OPT(OriginType) _type;
|
||||
OPT(EvaluationMode) _evaluationMode;
|
||||
OPT(EvaluationStatus) _evaluationStatus;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
std::vector<CompositeTimePtr> _compositeTimes;
|
||||
std::vector<ArrivalPtr> _arrivals;
|
||||
std::vector<StationMagnitudePtr> _stationMagnitudes;
|
||||
std::vector<MagnitudePtr> _magnitudes;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Origin);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
171
include/seiscomp/datamodel/originquality.h
Normal file
171
include/seiscomp/datamodel/originquality.h
Normal file
@ -0,0 +1,171 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ORIGINQUALITY_H
|
||||
#define SEISCOMP_DATAMODEL_ORIGINQUALITY_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(OriginQuality);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type contains various attributes commonly used to
|
||||
* \brief describe the quality of an origin, e. g., errors, azimuthal
|
||||
* \brief coverage, etc. Origin objects have an optional attribute of
|
||||
* \brief the type OriginQuality.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API OriginQuality : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(OriginQuality)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
OriginQuality();
|
||||
|
||||
//! Copy constructor
|
||||
OriginQuality(const OriginQuality& other);
|
||||
|
||||
//! Destructor
|
||||
~OriginQuality() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
OriginQuality& operator=(const OriginQuality& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const OriginQuality& other) const;
|
||||
bool operator!=(const OriginQuality& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const OriginQuality& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Number of associated phases, regardless of their use for
|
||||
//! origin computation.
|
||||
void setAssociatedPhaseCount(const OPT(int)& associatedPhaseCount);
|
||||
int associatedPhaseCount() const;
|
||||
|
||||
//! Number of defining phases, i. e., phase observations that
|
||||
//! were actually used for computing
|
||||
//! the origin. Note that there may be more than one defining
|
||||
//! phase per station.
|
||||
void setUsedPhaseCount(const OPT(int)& usedPhaseCount);
|
||||
int usedPhaseCount() const;
|
||||
|
||||
//! Number of stations at which the event was observed.
|
||||
void setAssociatedStationCount(const OPT(int)& associatedStationCount);
|
||||
int associatedStationCount() const;
|
||||
|
||||
//! Number of stations from which data was used for origin
|
||||
//! computation.
|
||||
void setUsedStationCount(const OPT(int)& usedStationCount);
|
||||
int usedStationCount() const;
|
||||
|
||||
//! Number of depth phases (typically pP, sometimes sP) used in
|
||||
//! depth computation.
|
||||
void setDepthPhaseCount(const OPT(int)& depthPhaseCount);
|
||||
int depthPhaseCount() const;
|
||||
|
||||
//! RMS of the travel time residuals of the arrivals used for
|
||||
//! the origin computation
|
||||
//! in seconds.
|
||||
void setStandardError(const OPT(double)& standardError);
|
||||
double standardError() const;
|
||||
|
||||
//! Largest azimuthal gap in station distribution as seen from
|
||||
//! epicenter
|
||||
//! in degrees.
|
||||
void setAzimuthalGap(const OPT(double)& azimuthalGap);
|
||||
double azimuthalGap() const;
|
||||
|
||||
//! Secondary azimuthal gap in station distribution, i. e., the
|
||||
//! largest
|
||||
//! azimuthal gap a station closes in degrees.
|
||||
void setSecondaryAzimuthalGap(const OPT(double)& secondaryAzimuthalGap);
|
||||
double secondaryAzimuthalGap() const;
|
||||
|
||||
//! String describing ground-truth level, e. g. GT0, GT5, etc.
|
||||
//! It has a maximum length of 16
|
||||
//! characters.
|
||||
void setGroundTruthLevel(const std::string& groundTruthLevel);
|
||||
const std::string& groundTruthLevel() const;
|
||||
|
||||
//! Epicentral distance of station farthest from the epicenter
|
||||
//! in degrees.
|
||||
void setMaximumDistance(const OPT(double)& maximumDistance);
|
||||
double maximumDistance() const;
|
||||
|
||||
//! Epicentral distance of station closest to the epicenter in
|
||||
//! degrees.
|
||||
void setMinimumDistance(const OPT(double)& minimumDistance);
|
||||
double minimumDistance() const;
|
||||
|
||||
//! Median epicentral distance of used stations in degrees.
|
||||
void setMedianDistance(const OPT(double)& medianDistance);
|
||||
double medianDistance() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
OPT(int) _associatedPhaseCount;
|
||||
OPT(int) _usedPhaseCount;
|
||||
OPT(int) _associatedStationCount;
|
||||
OPT(int) _usedStationCount;
|
||||
OPT(int) _depthPhaseCount;
|
||||
OPT(double) _standardError;
|
||||
OPT(double) _azimuthalGap;
|
||||
OPT(double) _secondaryAzimuthalGap;
|
||||
std::string _groundTruthLevel;
|
||||
OPT(double) _maximumDistance;
|
||||
OPT(double) _minimumDistance;
|
||||
OPT(double) _medianDistance;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
155
include/seiscomp/datamodel/originreference.h
Normal file
155
include/seiscomp/datamodel/originreference.h
Normal file
@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ORIGINREFERENCE_H
|
||||
#define SEISCOMP_DATAMODEL_ORIGINREFERENCE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(OriginReference);
|
||||
|
||||
class Event;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API OriginReferenceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
OriginReferenceIndex();
|
||||
OriginReferenceIndex(const std::string& originID);
|
||||
|
||||
//! Copy constructor
|
||||
OriginReferenceIndex(const OriginReferenceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const OriginReferenceIndex&) const;
|
||||
bool operator!=(const OriginReferenceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string originID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API OriginReference : public Object {
|
||||
DECLARE_SC_CLASS(OriginReference)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
OriginReference();
|
||||
|
||||
//! Copy constructor
|
||||
OriginReference(const OriginReference& other);
|
||||
|
||||
//! Custom constructor
|
||||
OriginReference(const std::string& originID);
|
||||
|
||||
//! Destructor
|
||||
~OriginReference() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
OriginReference& operator=(const OriginReference& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const OriginReference& other) const;
|
||||
bool operator!=(const OriginReference& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const OriginReference& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setOriginID(const std::string& originID);
|
||||
const std::string& originID() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const OriginReferenceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const OriginReference* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Event* event() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
OriginReferenceIndex _index;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
140
include/seiscomp/datamodel/originuncertainty.h
Normal file
140
include/seiscomp/datamodel/originuncertainty.h
Normal file
@ -0,0 +1,140 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ORIGINUNCERTAINTY_H
|
||||
#define SEISCOMP_DATAMODEL_ORIGINUNCERTAINTY_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/confidenceellipsoid.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(OriginUncertainty);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes the location uncertainties of an
|
||||
* \brief origin. The uncertainty
|
||||
* \brief can be described either as a simple circular horizontal
|
||||
* \brief uncertainty, an
|
||||
* \brief uncertainty ellipse according to IMS1.0, or a confidence
|
||||
* \brief ellipsoid. If
|
||||
* \brief multiple uncertainty models are given, the preferred
|
||||
* \brief variant can be
|
||||
* \brief specified in the attribute preferredDescription.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API OriginUncertainty : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(OriginUncertainty)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
OriginUncertainty();
|
||||
|
||||
//! Copy constructor
|
||||
OriginUncertainty(const OriginUncertainty& other);
|
||||
|
||||
//! Destructor
|
||||
~OriginUncertainty() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
OriginUncertainty& operator=(const OriginUncertainty& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const OriginUncertainty& other) const;
|
||||
bool operator!=(const OriginUncertainty& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const OriginUncertainty& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Circular confidence region, given by single value of
|
||||
//! horizontal uncertainty in km.
|
||||
void setHorizontalUncertainty(const OPT(double)& horizontalUncertainty);
|
||||
double horizontalUncertainty() const;
|
||||
|
||||
//! Semi-minor axis of confidence ellipse in km.
|
||||
void setMinHorizontalUncertainty(const OPT(double)& minHorizontalUncertainty);
|
||||
double minHorizontalUncertainty() const;
|
||||
|
||||
//! Semi-major axis of confidence ellipse in km.
|
||||
void setMaxHorizontalUncertainty(const OPT(double)& maxHorizontalUncertainty);
|
||||
double maxHorizontalUncertainty() const;
|
||||
|
||||
//! Azimuth of major axis of confidence ellipse. Measured
|
||||
//! clockwise from
|
||||
//! South-North direction at epicenter in degrees.
|
||||
void setAzimuthMaxHorizontalUncertainty(const OPT(double)& azimuthMaxHorizontalUncertainty);
|
||||
double azimuthMaxHorizontalUncertainty() const;
|
||||
|
||||
//! Confidence ellipsoid.
|
||||
void setConfidenceEllipsoid(const OPT(ConfidenceEllipsoid)& confidenceEllipsoid);
|
||||
ConfidenceEllipsoid& confidenceEllipsoid();
|
||||
const ConfidenceEllipsoid& confidenceEllipsoid() const;
|
||||
|
||||
//! Preferred uncertainty description.
|
||||
void setPreferredDescription(const OPT(OriginUncertaintyDescription)& preferredDescription);
|
||||
OriginUncertaintyDescription preferredDescription() const;
|
||||
|
||||
//! Confidence level of the uncertainty, given in percent.
|
||||
void setConfidenceLevel(const OPT(double)& confidenceLevel);
|
||||
double confidenceLevel() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
OPT(double) _horizontalUncertainty;
|
||||
OPT(double) _minHorizontalUncertainty;
|
||||
OPT(double) _maxHorizontalUncertainty;
|
||||
OPT(double) _azimuthMaxHorizontalUncertainty;
|
||||
OPT(ConfidenceEllipsoid) _confidenceEllipsoid;
|
||||
OPT(OriginUncertaintyDescription) _preferredDescription;
|
||||
OPT(double) _confidenceLevel;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
174
include/seiscomp/datamodel/outage.h
Normal file
174
include/seiscomp/datamodel/outage.h
Normal file
@ -0,0 +1,174 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_OUTAGE_H
|
||||
#define SEISCOMP_DATAMODEL_OUTAGE_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Outage);
|
||||
|
||||
class QualityControl;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API OutageIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
OutageIndex();
|
||||
OutageIndex(const WaveformStreamID& waveformID,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
OutageIndex(const OutageIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const OutageIndex&) const;
|
||||
bool operator!=(const OutageIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
WaveformStreamID waveformID;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Outage : public Object {
|
||||
DECLARE_SC_CLASS(Outage)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Outage();
|
||||
|
||||
//! Copy constructor
|
||||
Outage(const Outage& other);
|
||||
|
||||
//! Destructor
|
||||
~Outage() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
Outage& operator=(const Outage& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Outage& other) const;
|
||||
bool operator!=(const Outage& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Outage& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setWaveformID(const WaveformStreamID& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
void setCreatorID(const std::string& creatorID);
|
||||
const std::string& creatorID() const;
|
||||
|
||||
void setCreated(Seiscomp::Core::Time created);
|
||||
Seiscomp::Core::Time created() const;
|
||||
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const OutageIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Outage* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
QualityControl* qualityControl() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
OutageIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _creatorID;
|
||||
Seiscomp::Core::Time _created;
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
186
include/seiscomp/datamodel/parameter.h
Normal file
186
include/seiscomp/datamodel/parameter.h
Normal file
@ -0,0 +1,186 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PARAMETER_H
|
||||
#define SEISCOMP_DATAMODEL_PARAMETER_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Parameter);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class ParameterSet;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Parameter : public PublicObject {
|
||||
DECLARE_SC_CLASS(Parameter)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Parameter();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Parameter(const Parameter& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Parameter(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Parameter() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Parameter* Create();
|
||||
static Parameter* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Parameter* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Parameter& operator=(const Parameter& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Parameter& other) const;
|
||||
bool operator!=(const Parameter& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Parameter& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
void setValue(const std::string& value);
|
||||
const std::string& value() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
ParameterSet* parameterSet() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _name;
|
||||
std::string _value;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Parameter);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
200
include/seiscomp/datamodel/parameterset.h
Normal file
200
include/seiscomp/datamodel/parameterset.h
Normal file
@ -0,0 +1,200 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PARAMETERSET_H
|
||||
#define SEISCOMP_DATAMODEL_PARAMETERSET_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ParameterSet);
|
||||
DEFINE_SMARTPOINTER(Parameter);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class Config;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ParameterSet : public PublicObject {
|
||||
DECLARE_SC_CLASS(ParameterSet)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ParameterSet();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ParameterSet(const ParameterSet& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ParameterSet(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ParameterSet() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ParameterSet* Create();
|
||||
static ParameterSet* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ParameterSet* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ParameterSet& operator=(const ParameterSet& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ParameterSet& other) const;
|
||||
bool operator!=(const ParameterSet& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ParameterSet& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setBaseID(const std::string& baseID);
|
||||
const std::string& baseID() const;
|
||||
|
||||
void setModuleID(const std::string& moduleID);
|
||||
const std::string& moduleID() const;
|
||||
|
||||
void setCreated(const OPT(Seiscomp::Core::Time)& created);
|
||||
Seiscomp::Core::Time created() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Parameter* obj);
|
||||
bool add(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Parameter* obj);
|
||||
bool remove(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeParameter(size_t i);
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t parameterCount() const;
|
||||
size_t commentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Parameter* parameter(size_t i) const;
|
||||
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
Parameter* findParameter(const std::string& publicID) const;
|
||||
|
||||
Config* config() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _baseID;
|
||||
std::string _moduleID;
|
||||
OPT(Seiscomp::Core::Time) _created;
|
||||
|
||||
// Aggregations
|
||||
std::vector<ParameterPtr> _parameters;
|
||||
std::vector<CommentPtr> _comments;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ParameterSet);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
107
include/seiscomp/datamodel/phase.h
Normal file
107
include/seiscomp/datamodel/phase.h
Normal file
@ -0,0 +1,107 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PHASE_H
|
||||
#define SEISCOMP_DATAMODEL_PHASE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Phase);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Generic and extensible phase description that currently
|
||||
* \brief contains the phase code only.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Phase : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(Phase)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
Phase();
|
||||
|
||||
//! Copy constructor
|
||||
Phase(const Phase& other);
|
||||
|
||||
//! Custom constructor
|
||||
Phase(const std::string& code);
|
||||
|
||||
//! Destructor
|
||||
~Phase() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
operator std::string&();
|
||||
operator const std::string&() const;
|
||||
|
||||
//! Copies the metadata of other to this
|
||||
Phase& operator=(const Phase& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Phase& other) const;
|
||||
bool operator!=(const Phase& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Phase& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Phase code as given in the IASPEI Standard Seismic Phase
|
||||
//! List
|
||||
//! (Storchak et al. 2003). String with a maximum length of 32
|
||||
//! characters.
|
||||
void setCode(const std::string& code);
|
||||
const std::string& code() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _code;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
271
include/seiscomp/datamodel/pick.h
Normal file
271
include/seiscomp/datamodel/pick.h
Normal file
@ -0,0 +1,271 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PICK_H
|
||||
#define SEISCOMP_DATAMODEL_PICK_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/timequantity.h>
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realquantity.h>
|
||||
#include <seiscomp/datamodel/types.h>
|
||||
#include <seiscomp/datamodel/phase.h>
|
||||
#include <seiscomp/datamodel/creationinfo.h>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Pick);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief A pick is the observation of an amplitude anomaly in a
|
||||
* \brief seismogram at a
|
||||
* \brief specific point in time. It is not necessarily related to a
|
||||
* \brief seismic event.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Pick : public PublicObject {
|
||||
DECLARE_SC_CLASS(Pick)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Pick();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Pick(const Pick& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Pick(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Pick() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Pick* Create();
|
||||
static Pick* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Pick* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Pick& operator=(const Pick& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Pick& other) const;
|
||||
bool operator!=(const Pick& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Pick& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Observed onset time of signal ("pick time").
|
||||
void setTime(const TimeQuantity& time);
|
||||
TimeQuantity& time();
|
||||
const TimeQuantity& time() const;
|
||||
|
||||
//! Identifes the waveform stream.
|
||||
void setWaveformID(const WaveformStreamID& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
//! Identifies the filter or filter setup used for filtering
|
||||
//! the waveform
|
||||
//! stream referenced by waveformID.
|
||||
void setFilterID(const std::string& filterID);
|
||||
const std::string& filterID() const;
|
||||
|
||||
//! Identifies the picker that produced the pick. This can be
|
||||
//! either a
|
||||
//! detection software program or a person.
|
||||
void setMethodID(const std::string& methodID);
|
||||
const std::string& methodID() const;
|
||||
|
||||
//! Observed horizontal slowness of the signal. Most relevant
|
||||
//! in array measurements
|
||||
//! in s/deg.
|
||||
void setHorizontalSlowness(const OPT(RealQuantity)& horizontalSlowness);
|
||||
RealQuantity& horizontalSlowness();
|
||||
const RealQuantity& horizontalSlowness() const;
|
||||
|
||||
//! Observed backazimuth of the signal. Most relevant in array
|
||||
//! measurements
|
||||
//! in degrees.
|
||||
void setBackazimuth(const OPT(RealQuantity)& backazimuth);
|
||||
RealQuantity& backazimuth();
|
||||
const RealQuantity& backazimuth() const;
|
||||
|
||||
//! Identifies the method that was used to determine the
|
||||
//! slowness.
|
||||
void setSlownessMethodID(const std::string& slownessMethodID);
|
||||
const std::string& slownessMethodID() const;
|
||||
|
||||
//! Flag that roughly categorizes the sharpness of the onset.
|
||||
void setOnset(const OPT(PickOnset)& onset);
|
||||
PickOnset onset() const;
|
||||
|
||||
//! Tentative phase identification as specified by the picker.
|
||||
void setPhaseHint(const OPT(Phase)& phaseHint);
|
||||
Phase& phaseHint();
|
||||
const Phase& phaseHint() const;
|
||||
|
||||
//! Indicates the polarity of first motion, usually from
|
||||
//! impulsive onsets.
|
||||
void setPolarity(const OPT(PickPolarity)& polarity);
|
||||
PickPolarity polarity() const;
|
||||
|
||||
//! Evaluation mode of Pick.
|
||||
void setEvaluationMode(const OPT(EvaluationMode)& evaluationMode);
|
||||
EvaluationMode evaluationMode() const;
|
||||
|
||||
//! Evaluation status of Pick.
|
||||
void setEvaluationStatus(const OPT(EvaluationStatus)& evaluationStatus);
|
||||
EvaluationStatus evaluationStatus() const;
|
||||
|
||||
//! CreationInfo for the Pick object.
|
||||
void setCreationInfo(const OPT(CreationInfo)& creationInfo);
|
||||
CreationInfo& creationInfo();
|
||||
const CreationInfo& creationInfo() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
TimeQuantity _time;
|
||||
WaveformStreamID _waveformID;
|
||||
std::string _filterID;
|
||||
std::string _methodID;
|
||||
OPT(RealQuantity) _horizontalSlowness;
|
||||
OPT(RealQuantity) _backazimuth;
|
||||
std::string _slownessMethodID;
|
||||
OPT(PickOnset) _onset;
|
||||
OPT(Phase) _phaseHint;
|
||||
OPT(PickPolarity) _polarity;
|
||||
OPT(EvaluationMode) _evaluationMode;
|
||||
OPT(EvaluationStatus) _evaluationStatus;
|
||||
OPT(CreationInfo) _creationInfo;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Pick);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
155
include/seiscomp/datamodel/pickreference.h
Normal file
155
include/seiscomp/datamodel/pickreference.h
Normal file
@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PICKREFERENCE_H
|
||||
#define SEISCOMP_DATAMODEL_PICKREFERENCE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(PickReference);
|
||||
|
||||
class Reading;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PickReferenceIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
PickReferenceIndex();
|
||||
PickReferenceIndex(const std::string& pickID);
|
||||
|
||||
//! Copy constructor
|
||||
PickReferenceIndex(const PickReferenceIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const PickReferenceIndex&) const;
|
||||
bool operator!=(const PickReferenceIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string pickID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PickReference : public Object {
|
||||
DECLARE_SC_CLASS(PickReference)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
PickReference();
|
||||
|
||||
//! Copy constructor
|
||||
PickReference(const PickReference& other);
|
||||
|
||||
//! Custom constructor
|
||||
PickReference(const std::string& pickID);
|
||||
|
||||
//! Destructor
|
||||
~PickReference() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
PickReference& operator=(const PickReference& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const PickReference& other) const;
|
||||
bool operator!=(const PickReference& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const PickReference& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setPickID(const std::string& pickID);
|
||||
const std::string& pickID() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const PickReferenceIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const PickReference* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Reading* reading() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
PickReferenceIndex _index;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
112
include/seiscomp/datamodel/principalaxes.h
Normal file
112
include/seiscomp/datamodel/principalaxes.h
Normal file
@ -0,0 +1,112 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PRINCIPALAXES_H
|
||||
#define SEISCOMP_DATAMODEL_PRINCIPALAXES_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/axis.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(PrincipalAxes);
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class describes the principal axes of a double-couple
|
||||
* \brief moment tensor solution. tAxis and pAxis are required,
|
||||
* \brief while nAxis is optional.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API PrincipalAxes : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(PrincipalAxes)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
PrincipalAxes();
|
||||
|
||||
//! Copy constructor
|
||||
PrincipalAxes(const PrincipalAxes& other);
|
||||
|
||||
//! Destructor
|
||||
~PrincipalAxes() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
PrincipalAxes& operator=(const PrincipalAxes& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const PrincipalAxes& other) const;
|
||||
bool operator!=(const PrincipalAxes& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const PrincipalAxes& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! T (tension) axis of a double-couple moment tensor solution.
|
||||
void setTAxis(const Axis& tAxis);
|
||||
Axis& tAxis();
|
||||
const Axis& tAxis() const;
|
||||
|
||||
//! P (pressure) axis of a double-couple moment tensor solution.
|
||||
void setPAxis(const Axis& pAxis);
|
||||
Axis& pAxis();
|
||||
const Axis& pAxis() const;
|
||||
|
||||
//! N (neutral) axis of a double-couple moment tensor solution.
|
||||
void setNAxis(const OPT(Axis)& nAxis);
|
||||
Axis& nAxis();
|
||||
const Axis& nAxis() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
Axis _tAxis;
|
||||
Axis _pAxis;
|
||||
OPT(Axis) _nAxis;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
262
include/seiscomp/datamodel/publicobject.h
Normal file
262
include/seiscomp/datamodel/publicobject.h
Normal file
@ -0,0 +1,262 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PUBLICOBJECT_H__
|
||||
#define SEISCOMP_DATAMODEL_PUBLICOBJECT_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(PublicObject);
|
||||
|
||||
namespace _private { struct Resolver; }
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PublicObject : public Object {
|
||||
DECLARE_SC_CLASS(PublicObject);
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public types
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
typedef std::map<std::string, PublicObject*> PublicObjectMap;
|
||||
typedef PublicObjectMap::const_iterator Iterator;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Constructors
|
||||
PublicObject();
|
||||
PublicObject(const std::string& publicID);
|
||||
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~PublicObject() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Assigns 'this' the publicID of other if and only if 'this'
|
||||
//! does not have a valid publicID.
|
||||
//! No registration will be done, so 'this' cannot be found
|
||||
//! in the global instance pool via Find(publicID).
|
||||
//! If 'this' has been registered already this method
|
||||
//! does nothing.
|
||||
PublicObject& operator=(const PublicObject& other);
|
||||
|
||||
public:
|
||||
bool operator==(const PublicObject&) const;
|
||||
bool operator!=(const PublicObject&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the objects publicID
|
||||
const std::string& publicID() const;
|
||||
|
||||
//! Sets the publicID for an PublicObject. Usually it
|
||||
//! is done automatically by an data reader or within
|
||||
//! PublicObject::Create. Anyway to support custom data
|
||||
//! readers it is necessary to enable setting the
|
||||
//! publicID from outside.
|
||||
//! This function returns true when the object is registered
|
||||
//! after changing the publicID and false otherwise.
|
||||
bool setPublicID(const std::string &);
|
||||
|
||||
//! Returns whether the object is registered or not
|
||||
//! If it is not registered, it cannot be found when
|
||||
//! using Find(publicID).
|
||||
//! There are two reasons why an object is not registered:
|
||||
//! 1. Its publicID is invalid (empty)
|
||||
//! 2. Another object with the same publicID has been
|
||||
//! registered already
|
||||
bool registered() const;
|
||||
|
||||
/**
|
||||
* @brief Registers this instances publicID and links it with
|
||||
* this instance that it can be found with Find(publicID).
|
||||
* @return success flag
|
||||
*/
|
||||
bool registerMe();
|
||||
|
||||
/**
|
||||
* @brief Deregisters this instances publicID and unlinks it with
|
||||
* this instance that it cannot be found with Find(publicID).
|
||||
* @return success flag
|
||||
*/
|
||||
bool deregisterMe();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns whether the object has a valid publicID or not
|
||||
bool validId() const;
|
||||
|
||||
/**
|
||||
* Returns the object with the given 'publicID'.
|
||||
* The returned object must not be deleted.
|
||||
* If no object can be found with the given Id, nullptr is
|
||||
* returned.
|
||||
*/
|
||||
static PublicObject* Find(const std::string& publicID);
|
||||
|
||||
/**
|
||||
* Returns the size of the static PublicObject registration map
|
||||
*/
|
||||
static size_t ObjectCount();
|
||||
|
||||
/**
|
||||
* Returns an iterator to the first element of
|
||||
* the static PublicObject registration map
|
||||
*/
|
||||
static Iterator Begin();
|
||||
|
||||
/**
|
||||
* Returns an iterator behind the last element of
|
||||
* the static PublicObject registration map
|
||||
*/
|
||||
static Iterator End();
|
||||
|
||||
/**
|
||||
* Locks registration of PublicObjects and allows syncrhonized access
|
||||
* to Begin() and End() iterators.
|
||||
*/
|
||||
static void Lock();
|
||||
|
||||
/**
|
||||
* Unlocks the registration of PublicObjects.
|
||||
*/
|
||||
static void Unlock();
|
||||
|
||||
/**
|
||||
* Enables/disabled the automatic publicID generation during
|
||||
* serialization.
|
||||
* This feature is useful to generate publicID when no publicID
|
||||
* is given in an older archive.
|
||||
*/
|
||||
static void SetIdGeneration(bool);
|
||||
|
||||
/**
|
||||
* Sets the pattern used to generate a publicID.
|
||||
* There are several placeholder that can be used
|
||||
* to create a hopefully unique Id. Each placeholder
|
||||
* has to be enclosed with '@'.
|
||||
* Placeholders:
|
||||
* classname - The classname of the object
|
||||
* id - The number of PublicObject instances created since
|
||||
* program start
|
||||
* globalid - The number of existing Core::BaseObject instances
|
||||
* time - The current GMT time. The used format can be appended
|
||||
* after a slash.
|
||||
* Example:
|
||||
*
|
||||
* smi://de.gfz-potsdam.sc/@classname@#@time/%Y%m%d%H%M%S.%f@.@id@
|
||||
*
|
||||
* results in
|
||||
*
|
||||
* smi://de.gfz-potsdam.sc/Pick#20061213121443.138624.1204
|
||||
*
|
||||
* @param pattern The used pattern
|
||||
*/
|
||||
static void SetIdPattern(const std::string& pattern);
|
||||
|
||||
/**
|
||||
* Generates a publicID for an object.
|
||||
* @param object The object thats publicID is going to be
|
||||
* generated.
|
||||
* @return The unchanged object pointer passed as parameter.
|
||||
*/
|
||||
static PublicObject* GenerateId(PublicObject* object);
|
||||
|
||||
/**
|
||||
* Generates a publicID for an object.
|
||||
* @param object The object thats publicID is going to be
|
||||
* generated.
|
||||
* @param pattern The generation pattern to be used.
|
||||
* @return The unchanged object pointer passed as parameter.
|
||||
*/
|
||||
static PublicObject* GenerateId(PublicObject* object,
|
||||
const std::string &pattern);
|
||||
|
||||
/**
|
||||
* Enables/Disables the registration of PublicObjects with their
|
||||
* publicID in a global registration map. This influences only
|
||||
* objects created after this call.
|
||||
* @param enable true or false
|
||||
*/
|
||||
static void SetRegistrationEnabled(bool enable);
|
||||
static bool IsRegistrationEnabled();
|
||||
|
||||
//! Updates a child object
|
||||
//! a parent, the method returns false.
|
||||
virtual bool updateChild(Object*) = 0;
|
||||
|
||||
//! Visitor interface
|
||||
virtual void accept(Visitor*) = 0;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
void generateId(const std::string &pattern);
|
||||
|
||||
|
||||
private:
|
||||
std::string _publicID;
|
||||
bool _registered;
|
||||
|
||||
static PublicObjectMap _publicObjects;
|
||||
|
||||
static bool _generateIds;
|
||||
static std::string _idPattern;
|
||||
static unsigned long _publicObjectId;
|
||||
|
||||
//static bool _registerObjects;
|
||||
static boost::thread_specific_ptr<bool> _registerObjects;
|
||||
|
||||
friend class Object;
|
||||
friend struct _private::Resolver;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
339
include/seiscomp/datamodel/publicobjectcache.h
Normal file
339
include/seiscomp/datamodel/publicobjectcache.h
Normal file
@ -0,0 +1,339 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PUBLICOBJECT_CACHE_H__
|
||||
#define SEISCOMP_DATAMODEL_PUBLICOBJECT_CACHE_H__
|
||||
|
||||
|
||||
#include <seiscomp/core/timewindow.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <queue>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseArchive);
|
||||
|
||||
struct SC_SYSTEM_CORE_API CachePopCallback {
|
||||
virtual void handle(PublicObject *obj) {}
|
||||
virtual ~CachePopCallback() {}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The PublicObjectCache class implements an PublicObject store to
|
||||
* prevent PublicObjects from de-registration when they go out of scope.
|
||||
*
|
||||
* The global registraty of PublicObject and the database access are common
|
||||
* patterns in user code. To simplify the following code sequence:
|
||||
*
|
||||
* @code
|
||||
* auto po = PublicObject::Find(publicID);
|
||||
* if ( !po ) {
|
||||
* po = _archive->getObject(Pick::TypeInfo(), publicID)
|
||||
* }
|
||||
* auto pick = Pick::Cast(po);
|
||||
* if ( pick ) {
|
||||
* // Do something
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* The cache encapsulates this code in a single function and can implement
|
||||
* several strategies for storing objects in memory. Currently a cache size
|
||||
* based strategy and a time span based strategy are implemented.
|
||||
*
|
||||
* The cache receives an optional pointer to the database archive to load
|
||||
* objects from database if required. That makes the object lookup a breeze:
|
||||
*
|
||||
* @code
|
||||
* auto pick = _cache.get<Pick>(publicID);
|
||||
* if ( pick ) {
|
||||
* // Do something
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* The following two code examples illustrate the mode of operation of the
|
||||
* cache:
|
||||
*
|
||||
* @code
|
||||
* // A pick is being created and registered in the global object pool.
|
||||
* PickPtr pick = Pick::Create();
|
||||
* string publicID = pick->publicID();
|
||||
*
|
||||
* // Although the pick has never been added to the cache it will be found
|
||||
* // through the global object registry. And it will be added to the cache
|
||||
* // automatically for later retrieval.
|
||||
* auto cachedPick = _cache.get<Pick>(publicID);
|
||||
* cachedPick = nullptr; // Just drop the reference
|
||||
*
|
||||
* // Even if the pick pointer is set to nullptr which should cause the
|
||||
* // pick to be disposed (-> SmartPointer) it is not the case. The cache still
|
||||
* // manages a smart pointer to the pick and prevents it from being destroyed
|
||||
* // until it will be removed from the cache.
|
||||
* pick = nullptr;
|
||||
*
|
||||
* // The following lookup will succeed because the cache is still holding the
|
||||
* // pick.
|
||||
* cachedPick = _cache.get<Pick>(publicID);
|
||||
* @endcode
|
||||
*
|
||||
* Continuing from the above code snippet, a totally different part of the code
|
||||
* might want to lookup the object through the global registry. Due to the
|
||||
* cache storage, it will success:
|
||||
*
|
||||
* @code
|
||||
* // The pick is still registered globally because the cache is still holding
|
||||
* // it.
|
||||
* Pick *pick = PublicObject::Find(publicID);
|
||||
* @endcode
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API PublicObjectCache : public Core::BaseObject {
|
||||
private:
|
||||
struct CacheItem;
|
||||
|
||||
typedef std::map<std::string, CacheItem*> CacheLookup;
|
||||
|
||||
// Simple double linked list
|
||||
struct CacheItem {
|
||||
PublicObjectPtr object;
|
||||
time_t timestamp;
|
||||
CacheItem *prev;
|
||||
CacheItem *next;
|
||||
CacheLookup::iterator lookup;
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
typedef std::function<void (PublicObject*)> PopCallback;
|
||||
typedef std::function<void (PublicObject*)> PushCallback;
|
||||
|
||||
|
||||
public:
|
||||
class const_iterator {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
const_iterator();
|
||||
//! Copy c'tor
|
||||
const_iterator(const const_iterator &it);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
PublicObject* operator*();
|
||||
|
||||
const_iterator &operator=(const const_iterator &it);
|
||||
const_iterator &operator++();
|
||||
const_iterator operator++(int);
|
||||
|
||||
bool operator==(const const_iterator &it);
|
||||
bool operator!=(const const_iterator &it);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
time_t timeStamp() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
const_iterator(CacheItem *);
|
||||
|
||||
CacheItem *_item;
|
||||
|
||||
friend class PublicObjectCache;
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
PublicObjectCache();
|
||||
PublicObjectCache(DatabaseArchive *ar);
|
||||
~PublicObjectCache() override;
|
||||
|
||||
public:
|
||||
using BaseObject::typeInfo;
|
||||
|
||||
void setDatabaseArchive(DatabaseArchive *);
|
||||
|
||||
void setPopCallback(const PopCallback &);
|
||||
void setPopCallback(CachePopCallback *);
|
||||
|
||||
void removePopCallback();
|
||||
|
||||
/**
|
||||
* Insert a new object into the cache.
|
||||
* @param po The PublicObject pointer to insert
|
||||
* @return True or False
|
||||
*/
|
||||
virtual bool feed(PublicObject *po) = 0;
|
||||
|
||||
/**
|
||||
* Removes an object from the cache. This function
|
||||
* can be quite time consuming since its a linear search.
|
||||
* @param po The PublicObject pointer to be removed
|
||||
* @return True or False
|
||||
*/
|
||||
bool remove(PublicObject *po);
|
||||
|
||||
//! Clears the cache.
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @brief Retrieves the type information of a public object which
|
||||
* is either globally registered or stored in the cache.
|
||||
*
|
||||
* A database lookup will not be performed!
|
||||
*
|
||||
* @param publicID The publicID of the PublicObject
|
||||
* @return The RTTI pointer if found, nullptr otherwise.
|
||||
*/
|
||||
const Core::RTTI *typeInfo(const std::string &publicID) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves an object by publicID.
|
||||
*
|
||||
* If the object is not in the cache and not globally registered it
|
||||
* will be fetched from the database and inserted into the cache.
|
||||
* Please note that any object retrieved will be fed again to the
|
||||
* cache to raise its priority.
|
||||
*
|
||||
* @param classType The required class type of the searched objects.
|
||||
* If the object is not the same type or derived from
|
||||
* it then nullptr will be returned.
|
||||
* @param publicID The publicID of the PublicObject to be
|
||||
* retrieved
|
||||
* @return The PublicObject pointer or nullptr
|
||||
*/
|
||||
PublicObject *find(const Core::RTTI &classType,
|
||||
const std::string &publicID);
|
||||
|
||||
/**
|
||||
* Returns the cached state the the last object returned by find.
|
||||
* This function was introduced in API 1.1.
|
||||
* @return Whether an already cached object has been returned or not
|
||||
*/
|
||||
bool cached() const { return _cached; }
|
||||
|
||||
//! Time window currently in buffer
|
||||
Core::TimeWindow timeWindow() const;
|
||||
|
||||
template <typename T>
|
||||
typename Core::SmartPointer<T>::Impl
|
||||
get(const std::string &publicID) {
|
||||
return static_cast<T*>(find(T::TypeInfo(), publicID));
|
||||
}
|
||||
|
||||
//! Returns the time of the oldest entry
|
||||
Core::Time oldest() const;
|
||||
|
||||
//! Returns whether the cache is empty or not
|
||||
bool empty() const { return _front == nullptr; }
|
||||
|
||||
//! Returns the number of cached elements
|
||||
size_t size() const { return _size; }
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
/**
|
||||
* @brief Checks if the passed object pointer is part of the cache.
|
||||
* @param object The object to be checked
|
||||
* @return true if part of this cache, false otherwise
|
||||
*/
|
||||
bool contains(PublicObject *object) const;
|
||||
|
||||
/**
|
||||
* @brief Checks if an instance with the passed publicID is part of
|
||||
* the cache.
|
||||
* @param publicID The publicID of the object that is part of the cache.
|
||||
* @return true if part of this cache, false otherwise
|
||||
*/
|
||||
bool contains(const std::string &publicID) const;
|
||||
|
||||
|
||||
protected:
|
||||
void pop();
|
||||
void push(PublicObject *obj);
|
||||
|
||||
void setCached(bool cached) { _cached = cached; }
|
||||
DatabaseArchive *databaseArchive() { return _archive.get(); }
|
||||
|
||||
|
||||
private:
|
||||
DatabaseArchivePtr _archive;
|
||||
size_t _size;
|
||||
CacheItem *_front;
|
||||
CacheItem *_back;
|
||||
CacheLookup _lookup;
|
||||
bool _cached;
|
||||
|
||||
PushCallback _pushCallback;
|
||||
PopCallback _popCallback;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PublicObjectRingBuffer : public PublicObjectCache {
|
||||
public:
|
||||
PublicObjectRingBuffer();
|
||||
PublicObjectRingBuffer(DatabaseArchive *ar,
|
||||
size_t bufferSize);
|
||||
|
||||
public:
|
||||
bool setBufferSize(size_t bufferSize);
|
||||
|
||||
bool feed(PublicObject *po) override;
|
||||
|
||||
private:
|
||||
size_t _bufferSize;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PublicObjectTimeSpanBuffer : public PublicObjectCache {
|
||||
public:
|
||||
PublicObjectTimeSpanBuffer();
|
||||
PublicObjectTimeSpanBuffer(DatabaseArchive *ar,
|
||||
const Core::TimeSpan &length);
|
||||
|
||||
public:
|
||||
bool setTimeSpan(const Core::TimeSpan &);
|
||||
|
||||
bool feed(PublicObject *po) override;
|
||||
|
||||
private:
|
||||
Core::TimeSpan _timeSpan;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
203
include/seiscomp/datamodel/qclog.h
Normal file
203
include/seiscomp/datamodel/qclog.h
Normal file
@ -0,0 +1,203 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_QCLOG_H
|
||||
#define SEISCOMP_DATAMODEL_QCLOG_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/waveformstreamid.h>
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(QCLog);
|
||||
|
||||
class QualityControl;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API QCLogIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
QCLogIndex();
|
||||
QCLogIndex(Seiscomp::Core::Time start,
|
||||
const WaveformStreamID& waveformID);
|
||||
|
||||
//! Copy constructor
|
||||
QCLogIndex(const QCLogIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const QCLogIndex&) const;
|
||||
bool operator!=(const QCLogIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Seiscomp::Core::Time start;
|
||||
WaveformStreamID waveformID;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API QCLog : public PublicObject {
|
||||
DECLARE_SC_CLASS(QCLog)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
QCLog();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
QCLog(const QCLog& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
QCLog(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~QCLog() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static QCLog* Create();
|
||||
static QCLog* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static QCLog* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
QCLog& operator=(const QCLog& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const QCLog& other) const;
|
||||
bool operator!=(const QCLog& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const QCLog& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setWaveformID(const WaveformStreamID& waveformID);
|
||||
WaveformStreamID& waveformID();
|
||||
const WaveformStreamID& waveformID() const;
|
||||
|
||||
void setCreatorID(const std::string& creatorID);
|
||||
const std::string& creatorID() const;
|
||||
|
||||
void setCreated(Seiscomp::Core::Time created);
|
||||
Seiscomp::Core::Time created() const;
|
||||
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
void setEnd(Seiscomp::Core::Time end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
void setMessage(const std::string& message);
|
||||
const std::string& message() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const QCLogIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const QCLog* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
QualityControl* qualityControl() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
QCLogIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _creatorID;
|
||||
Seiscomp::Core::Time _created;
|
||||
Seiscomp::Core::Time _end;
|
||||
std::string _message;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(QCLog);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
170
include/seiscomp/datamodel/qualitycontrol.h
Normal file
170
include/seiscomp/datamodel/qualitycontrol.h
Normal file
@ -0,0 +1,170 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_QUALITYCONTROL_H
|
||||
#define SEISCOMP_DATAMODEL_QUALITYCONTROL_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/qclog.h>
|
||||
#include <seiscomp/datamodel/waveformquality.h>
|
||||
#include <seiscomp/datamodel/outage.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(QualityControl);
|
||||
DEFINE_SMARTPOINTER(QCLog);
|
||||
DEFINE_SMARTPOINTER(WaveformQuality);
|
||||
DEFINE_SMARTPOINTER(Outage);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API QualityControl : public PublicObject {
|
||||
DECLARE_SC_CLASS(QualityControl)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
QualityControl();
|
||||
|
||||
//! Copy constructor
|
||||
QualityControl(const QualityControl& other);
|
||||
|
||||
//! Destructor
|
||||
~QualityControl() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
QualityControl& operator=(const QualityControl& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const QualityControl& other) const;
|
||||
bool operator!=(const QualityControl& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const QualityControl& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(QCLog* obj);
|
||||
bool add(WaveformQuality* obj);
|
||||
bool add(Outage* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(QCLog* obj);
|
||||
bool remove(WaveformQuality* obj);
|
||||
bool remove(Outage* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeQCLog(size_t i);
|
||||
bool removeQCLog(const QCLogIndex& i);
|
||||
bool removeWaveformQuality(size_t i);
|
||||
bool removeWaveformQuality(const WaveformQualityIndex& i);
|
||||
bool removeOutage(size_t i);
|
||||
bool removeOutage(const OutageIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t qCLogCount() const;
|
||||
size_t waveformQualityCount() const;
|
||||
size_t outageCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
QCLog* qCLog(size_t i) const;
|
||||
QCLog* qCLog(const QCLogIndex& i) const;
|
||||
|
||||
WaveformQuality* waveformQuality(size_t i) const;
|
||||
WaveformQuality* waveformQuality(const WaveformQualityIndex& i) const;
|
||||
|
||||
Outage* outage(size_t i) const;
|
||||
Outage* outage(const OutageIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
QCLog* findQCLog(const std::string& publicID) const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<QCLogPtr> _qCLogs;
|
||||
std::vector<WaveformQualityPtr> _waveformQualitys;
|
||||
std::vector<OutagePtr> _outages;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(QualityControl);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
31
include/seiscomp/datamodel/qualitycontrol_package.h
Normal file
31
include/seiscomp/datamodel/qualitycontrol_package.h
Normal file
@ -0,0 +1,31 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_QUALITYCONTROL_PACKAGE_H__
|
||||
#define SEISCOMP_DATAMODEL_QUALITYCONTROL_PACKAGE_H__
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/qclog.h>
|
||||
#include <seiscomp/datamodel/waveformquality.h>
|
||||
#include <seiscomp/datamodel/outage.h>
|
||||
#include <seiscomp/datamodel/qualitycontrol.h>
|
||||
|
||||
|
||||
#endif
|
||||
187
include/seiscomp/datamodel/reading.h
Normal file
187
include/seiscomp/datamodel/reading.h
Normal file
@ -0,0 +1,187 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_READING_H
|
||||
#define SEISCOMP_DATAMODEL_READING_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/pickreference.h>
|
||||
#include <seiscomp/datamodel/amplitudereference.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Reading);
|
||||
DEFINE_SMARTPOINTER(PickReference);
|
||||
DEFINE_SMARTPOINTER(AmplitudeReference);
|
||||
|
||||
class EventParameters;
|
||||
|
||||
|
||||
/**
|
||||
* \brief This class groups Pick and Amplitude elements which are
|
||||
* \brief thought to belong
|
||||
* \brief to the same event, but for which the event identification
|
||||
* \brief is not known.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Reading : public PublicObject {
|
||||
DECLARE_SC_CLASS(Reading)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Reading();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Reading(const Reading& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Reading(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Reading() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Reading* Create();
|
||||
static Reading* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Reading* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Reading& operator=(const Reading& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Reading& other) const;
|
||||
bool operator!=(const Reading& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Reading& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(PickReference* obj);
|
||||
bool add(AmplitudeReference* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(PickReference* obj);
|
||||
bool remove(AmplitudeReference* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removePickReference(size_t i);
|
||||
bool removePickReference(const PickReferenceIndex& i);
|
||||
bool removeAmplitudeReference(size_t i);
|
||||
bool removeAmplitudeReference(const AmplitudeReferenceIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t pickReferenceCount() const;
|
||||
size_t amplitudeReferenceCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
PickReference* pickReference(size_t i) const;
|
||||
PickReference* pickReference(const PickReferenceIndex& i) const;
|
||||
|
||||
AmplitudeReference* amplitudeReference(size_t i) const;
|
||||
AmplitudeReference* amplitudeReference(const AmplitudeReferenceIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
EventParameters* eventParameters() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Aggregations
|
||||
std::vector<PickReferencePtr> _pickReferences;
|
||||
std::vector<AmplitudeReferencePtr> _amplitudeReferences;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Reading);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
94
include/seiscomp/datamodel/realarray.h
Normal file
94
include/seiscomp/datamodel/realarray.h
Normal file
@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_REALARRAY_H
|
||||
#define SEISCOMP_DATAMODEL_REALARRAY_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(RealArray);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API RealArray : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(RealArray)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RealArray();
|
||||
|
||||
//! Copy constructor
|
||||
RealArray(const RealArray& other);
|
||||
|
||||
//! Destructor
|
||||
~RealArray() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
RealArray& operator=(const RealArray& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const RealArray& other) const;
|
||||
bool operator!=(const RealArray& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const RealArray& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setContent(const std::vector< double >&);
|
||||
const std::vector< double >& content() const;
|
||||
std::vector< double >& content();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::vector< double > _content;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
126
include/seiscomp/datamodel/realpdf1d.h
Normal file
126
include/seiscomp/datamodel/realpdf1d.h
Normal file
@ -0,0 +1,126 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_REALPDF1D_H
|
||||
#define SEISCOMP_DATAMODEL_REALPDF1D_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(RealPDF1D);
|
||||
|
||||
|
||||
/**
|
||||
* \brief A probability density function description. It can be used
|
||||
* \brief in three
|
||||
* \brief different modes:
|
||||
* \brief
|
||||
* \brief 1) "raw samples mode"
|
||||
* \brief
|
||||
* \brief variable is a list of M values, no probability. The values
|
||||
* \brief represent
|
||||
* \brief samples, no binning/probabilities made.
|
||||
* \brief
|
||||
* \brief 2) "implicitly binned PDF"
|
||||
* \brief
|
||||
* \brief variable and probabilty arrays have length N. variable
|
||||
* \brief values to be
|
||||
* \brief interpreted as "bin centers" (or representative values),
|
||||
* \brief no bin edges given.
|
||||
* \brief
|
||||
* \brief 3) "explicitly binned PDF"
|
||||
* \brief
|
||||
* \brief variable has length N+1, probability has length N. variable
|
||||
* \brief values
|
||||
* \brief describe bin edges (upper bin edge is lower edge of next
|
||||
* \brief bin).
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API RealPDF1D : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(RealPDF1D)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RealPDF1D();
|
||||
|
||||
//! Copy constructor
|
||||
RealPDF1D(const RealPDF1D& other);
|
||||
|
||||
//! Destructor
|
||||
~RealPDF1D() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
RealPDF1D& operator=(const RealPDF1D& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const RealPDF1D& other) const;
|
||||
bool operator!=(const RealPDF1D& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const RealPDF1D& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! List of values
|
||||
void setVariable(const RealArray& variable);
|
||||
RealArray& variable();
|
||||
const RealArray& variable() const;
|
||||
|
||||
//! List of probabilities
|
||||
void setProbability(const RealArray& probability);
|
||||
RealArray& probability();
|
||||
const RealArray& probability() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
RealArray _variable;
|
||||
RealArray _probability;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
154
include/seiscomp/datamodel/realquantity.h
Normal file
154
include/seiscomp/datamodel/realquantity.h
Normal file
@ -0,0 +1,154 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_REALQUANTITY_H
|
||||
#define SEISCOMP_DATAMODEL_REALQUANTITY_H
|
||||
|
||||
|
||||
#include <seiscomp/datamodel/realpdf1d.h>
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(RealQuantity);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Physical quantities expressed as floating point numbers are
|
||||
* \brief represented by their
|
||||
* \brief measured or computed values and optional values for
|
||||
* \brief symmetric or upper
|
||||
* \brief and lower uncertainties. The interpretation of these
|
||||
* \brief uncertainties is
|
||||
* \brief not defined in the standard. They can contain statistically
|
||||
* \brief well-defined
|
||||
* \brief error measures, but the mechanism can also be used to
|
||||
* \brief simply describe a
|
||||
* \brief possible value range. If the confidence level of the
|
||||
* \brief uncertainty is known,
|
||||
* \brief it can be listed in the optional attribute confidenceLevel.
|
||||
* \brief Note that uncertainty, upperUncertainty, and
|
||||
* \brief lowerUncertainty are given as absolute values of the
|
||||
* \brief deviation
|
||||
* \brief from the main value.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API RealQuantity : public Core::BaseObject {
|
||||
DECLARE_SC_CLASS(RealQuantity)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RealQuantity();
|
||||
|
||||
//! Copy constructor
|
||||
RealQuantity(const RealQuantity& other);
|
||||
|
||||
//! Custom constructor
|
||||
RealQuantity(double value,
|
||||
const OPT(double)& uncertainty = Seiscomp::Core::None,
|
||||
const OPT(double)& lowerUncertainty = Seiscomp::Core::None,
|
||||
const OPT(double)& upperUncertainty = Seiscomp::Core::None,
|
||||
const OPT(double)& confidenceLevel = Seiscomp::Core::None,
|
||||
const OPT(RealPDF1D)& pdf = Seiscomp::Core::None);
|
||||
|
||||
//! Destructor
|
||||
~RealQuantity() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
operator double&();
|
||||
operator double() const;
|
||||
|
||||
//! Copies the metadata of other to this
|
||||
RealQuantity& operator=(const RealQuantity& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const RealQuantity& other) const;
|
||||
bool operator!=(const RealQuantity& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const RealQuantity& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Value of the quantity. The unit is implicitly defined and
|
||||
//! depends on the context.
|
||||
void setValue(double value);
|
||||
double value() const;
|
||||
|
||||
//! Uncertainty as the absolute value of symmetric deviation
|
||||
//! from the main value.
|
||||
void setUncertainty(const OPT(double)& uncertainty);
|
||||
double uncertainty() const;
|
||||
|
||||
//! Uncertainty as the absolute value of deviation from the
|
||||
//! main value towards smaller values.
|
||||
void setLowerUncertainty(const OPT(double)& lowerUncertainty);
|
||||
double lowerUncertainty() const;
|
||||
|
||||
//! Uncertainty as the absolute value of deviation from the
|
||||
//! main value towards larger values.
|
||||
void setUpperUncertainty(const OPT(double)& upperUncertainty);
|
||||
double upperUncertainty() const;
|
||||
|
||||
//! Confidence level of the uncertainty, given in percent.
|
||||
void setConfidenceLevel(const OPT(double)& confidenceLevel);
|
||||
double confidenceLevel() const;
|
||||
|
||||
//! Probability density function of the quantity.
|
||||
void setPdf(const OPT(RealPDF1D)& pdf);
|
||||
RealPDF1D& pdf();
|
||||
const RealPDF1D& pdf() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
double _value;
|
||||
OPT(double) _uncertainty;
|
||||
OPT(double) _lowerUncertainty;
|
||||
OPT(double) _upperUncertainty;
|
||||
OPT(double) _confidenceLevel;
|
||||
OPT(RealPDF1D) _pdf;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
217
include/seiscomp/datamodel/responsefap.h
Normal file
217
include/seiscomp/datamodel/responsefap.h
Normal file
@ -0,0 +1,217 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_RESPONSEFAP_H
|
||||
#define SEISCOMP_DATAMODEL_RESPONSEFAP_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ResponseFAP);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ResponseFAPIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ResponseFAPIndex();
|
||||
ResponseFAPIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
ResponseFAPIndex(const ResponseFAPIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ResponseFAPIndex&) const;
|
||||
bool operator!=(const ResponseFAPIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a sensor response composed of
|
||||
* \brief frequency/amplitude/phase angle tuples. According to the
|
||||
* \brief SEED manual (blockette 55) this description alone is not an
|
||||
* \brief acceptable response description.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ResponseFAP : public PublicObject {
|
||||
DECLARE_SC_CLASS(ResponseFAP)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ResponseFAP();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ResponseFAP(const ResponseFAP& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ResponseFAP(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ResponseFAP() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseFAP* Create();
|
||||
static ResponseFAP* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseFAP* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ResponseFAP& operator=(const ResponseFAP& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ResponseFAP& other) const;
|
||||
bool operator!=(const ResponseFAP& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ResponseFAP& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique response name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Gain of response (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
//! The number of fap tuples in the response
|
||||
void setNumberOfTuples(const OPT(int)& numberOfTuples);
|
||||
int numberOfTuples() const;
|
||||
|
||||
//! The tuples organized as linear array. The array size must
|
||||
//! be numberOfTuples * 3. Each tuple consists of frequency (in
|
||||
//! Hz), amplitude and phase angle (in degree).
|
||||
void setTuples(const OPT(RealArray)& tuples);
|
||||
RealArray& tuples();
|
||||
const RealArray& tuples() const;
|
||||
|
||||
//! Optional remark
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ResponseFAPIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ResponseFAP* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ResponseFAPIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
OPT(int) _numberOfTuples;
|
||||
OPT(RealArray) _tuples;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ResponseFAP);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
231
include/seiscomp/datamodel/responsefir.h
Normal file
231
include/seiscomp/datamodel/responsefir.h
Normal file
@ -0,0 +1,231 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_RESPONSEFIR_H
|
||||
#define SEISCOMP_DATAMODEL_RESPONSEFIR_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ResponseFIR);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ResponseFIRIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ResponseFIRIndex();
|
||||
ResponseFIRIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
ResponseFIRIndex(const ResponseFIRIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ResponseFIRIndex&) const;
|
||||
bool operator!=(const ResponseFIRIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a finite impulse response filter
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ResponseFIR : public PublicObject {
|
||||
DECLARE_SC_CLASS(ResponseFIR)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ResponseFIR();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ResponseFIR(const ResponseFIR& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ResponseFIR(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ResponseFIR() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseFIR* Create();
|
||||
static ResponseFIR* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseFIR* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ResponseFIR& operator=(const ResponseFIR& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ResponseFIR& other) const;
|
||||
bool operator!=(const ResponseFIR& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ResponseFIR& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique response name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Gain of response (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
//! Decimation factor (47.06/57.05)
|
||||
void setDecimationFactor(const OPT(int)& decimationFactor);
|
||||
int decimationFactor() const;
|
||||
|
||||
//! Estimated delay (47.08/57.07)
|
||||
void setDelay(const OPT(double)& delay);
|
||||
double delay() const;
|
||||
|
||||
//! Applied correction (47.09/57.08)
|
||||
void setCorrection(const OPT(double)& correction);
|
||||
double correction() const;
|
||||
|
||||
//! Number of coefficients (41.08/61.08)
|
||||
void setNumberOfCoefficients(const OPT(int)& numberOfCoefficients);
|
||||
int numberOfCoefficients() const;
|
||||
|
||||
//! Symmetry code (41.05/61.05)
|
||||
void setSymmetry(const std::string& symmetry);
|
||||
const std::string& symmetry() const;
|
||||
|
||||
//! Coefficients normalized to gain=1.0 (41.09/61.09)
|
||||
void setCoefficients(const OPT(RealArray)& coefficients);
|
||||
RealArray& coefficients();
|
||||
const RealArray& coefficients() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ResponseFIRIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ResponseFIR* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ResponseFIRIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
OPT(int) _decimationFactor;
|
||||
OPT(double) _delay;
|
||||
OPT(double) _correction;
|
||||
OPT(int) _numberOfCoefficients;
|
||||
std::string _symmetry;
|
||||
OPT(RealArray) _coefficients;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ResponseFIR);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
244
include/seiscomp/datamodel/responseiir.h
Normal file
244
include/seiscomp/datamodel/responseiir.h
Normal file
@ -0,0 +1,244 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_RESPONSEIIR_H
|
||||
#define SEISCOMP_DATAMODEL_RESPONSEIIR_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ResponseIIR);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ResponseIIRIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ResponseIIRIndex();
|
||||
ResponseIIRIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
ResponseIIRIndex(const ResponseIIRIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ResponseIIRIndex&) const;
|
||||
bool operator!=(const ResponseIIRIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a infinite impulse response filter
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ResponseIIR : public PublicObject {
|
||||
DECLARE_SC_CLASS(ResponseIIR)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ResponseIIR();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ResponseIIR(const ResponseIIR& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ResponseIIR(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ResponseIIR() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseIIR* Create();
|
||||
static ResponseIIR* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponseIIR* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ResponseIIR& operator=(const ResponseIIR& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ResponseIIR& other) const;
|
||||
bool operator!=(const ResponseIIR& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ResponseIIR& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique response name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Response type (43.05/53.03/54.03): A - Laplace transform
|
||||
//! analog response in rad/sec, B - Analog response in Hz, C -
|
||||
//! Composite (currently undefined), D - Digital (Z - transform)
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
//! Gain of response (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
//! Decimation factor (47.06/57.05)
|
||||
void setDecimationFactor(const OPT(int)& decimationFactor);
|
||||
int decimationFactor() const;
|
||||
|
||||
//! Estimated delay (47.08/57.07)
|
||||
void setDelay(const OPT(double)& delay);
|
||||
double delay() const;
|
||||
|
||||
//! Applied correction (47.09/57.08)
|
||||
void setCorrection(const OPT(double)& correction);
|
||||
double correction() const;
|
||||
|
||||
//! Number of numerators (54.07)
|
||||
void setNumberOfNumerators(const OPT(int)& numberOfNumerators);
|
||||
int numberOfNumerators() const;
|
||||
|
||||
//! Number of denominators (54.10)
|
||||
void setNumberOfDenominators(const OPT(int)& numberOfDenominators);
|
||||
int numberOfDenominators() const;
|
||||
|
||||
//! Numerators (54.08-09)
|
||||
void setNumerators(const OPT(RealArray)& numerators);
|
||||
RealArray& numerators();
|
||||
const RealArray& numerators() const;
|
||||
|
||||
//! Denominators (54.11-12)
|
||||
void setDenominators(const OPT(RealArray)& denominators);
|
||||
RealArray& denominators();
|
||||
const RealArray& denominators() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ResponseIIRIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ResponseIIR* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ResponseIIRIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _type;
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
OPT(int) _decimationFactor;
|
||||
OPT(double) _delay;
|
||||
OPT(double) _correction;
|
||||
OPT(int) _numberOfNumerators;
|
||||
OPT(int) _numberOfDenominators;
|
||||
OPT(RealArray) _numerators;
|
||||
OPT(RealArray) _denominators;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ResponseIIR);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
254
include/seiscomp/datamodel/responsepaz.h
Normal file
254
include/seiscomp/datamodel/responsepaz.h
Normal file
@ -0,0 +1,254 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_RESPONSEPAZ_H
|
||||
#define SEISCOMP_DATAMODEL_RESPONSEPAZ_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/complexarray.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ResponsePAZ);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ResponsePAZIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ResponsePAZIndex();
|
||||
ResponsePAZIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
ResponsePAZIndex(const ResponsePAZIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ResponsePAZIndex&) const;
|
||||
bool operator!=(const ResponsePAZIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a sensor response using poles and zeros
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ResponsePAZ : public PublicObject {
|
||||
DECLARE_SC_CLASS(ResponsePAZ)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ResponsePAZ();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ResponsePAZ(const ResponsePAZ& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ResponsePAZ(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ResponsePAZ() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponsePAZ* Create();
|
||||
static ResponsePAZ* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponsePAZ* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ResponsePAZ& operator=(const ResponsePAZ& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ResponsePAZ& other) const;
|
||||
bool operator!=(const ResponsePAZ& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ResponsePAZ& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique response name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Response type (43.05/53.03): A - Laplace transform analog
|
||||
//! response in rad/sec, B - Analog response in Hz, C -
|
||||
//! Composite (currently undefined), D - Digital (Z - transform)
|
||||
void setType(const std::string& type);
|
||||
const std::string& type() const;
|
||||
|
||||
//! Gain of response (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
//! A0 normalization factor (43.08/53.07)
|
||||
void setNormalizationFactor(const OPT(double)& normalizationFactor);
|
||||
double normalizationFactor() const;
|
||||
|
||||
//! Normalization frequency (43.09/53.08)
|
||||
void setNormalizationFrequency(const OPT(double)& normalizationFrequency);
|
||||
double normalizationFrequency() const;
|
||||
|
||||
//! Number of zeros (43.10/53.09)
|
||||
void setNumberOfZeros(const OPT(int)& numberOfZeros);
|
||||
int numberOfZeros() const;
|
||||
|
||||
//! Number of poles (43.15/53.14)
|
||||
void setNumberOfPoles(const OPT(int)& numberOfPoles);
|
||||
int numberOfPoles() const;
|
||||
|
||||
//! Zeros (43.16-19/53.10-13)
|
||||
void setZeros(const OPT(ComplexArray)& zeros);
|
||||
ComplexArray& zeros();
|
||||
const ComplexArray& zeros() const;
|
||||
|
||||
//! Poles (43.11-14/53.15-18)
|
||||
void setPoles(const OPT(ComplexArray)& poles);
|
||||
ComplexArray& poles();
|
||||
const ComplexArray& poles() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
//! Decimation factor (47.06/57.05)
|
||||
void setDecimationFactor(const OPT(int)& decimationFactor);
|
||||
int decimationFactor() const;
|
||||
|
||||
//! Estimated delay (47.08/57.07)
|
||||
void setDelay(const OPT(double)& delay);
|
||||
double delay() const;
|
||||
|
||||
//! Applied correction (47.09/57.08)
|
||||
void setCorrection(const OPT(double)& correction);
|
||||
double correction() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ResponsePAZIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ResponsePAZ* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ResponsePAZIndex _index;
|
||||
|
||||
// Attributes
|
||||
std::string _type;
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
OPT(double) _normalizationFactor;
|
||||
OPT(double) _normalizationFrequency;
|
||||
OPT(int) _numberOfZeros;
|
||||
OPT(int) _numberOfPoles;
|
||||
OPT(ComplexArray) _zeros;
|
||||
OPT(ComplexArray) _poles;
|
||||
OPT(Blob) _remark;
|
||||
OPT(int) _decimationFactor;
|
||||
OPT(double) _delay;
|
||||
OPT(double) _correction;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ResponsePAZ);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
242
include/seiscomp/datamodel/responsepolynomial.h
Normal file
242
include/seiscomp/datamodel/responsepolynomial.h
Normal file
@ -0,0 +1,242 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_RESPONSEPOLYNOMIAL_H
|
||||
#define SEISCOMP_DATAMODEL_RESPONSEPOLYNOMIAL_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/realarray.h>
|
||||
#include <seiscomp/datamodel/blob.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ResponsePolynomial);
|
||||
|
||||
class Inventory;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API ResponsePolynomialIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
ResponsePolynomialIndex();
|
||||
ResponsePolynomialIndex(const std::string& name);
|
||||
|
||||
//! Copy constructor
|
||||
ResponsePolynomialIndex(const ResponsePolynomialIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const ResponsePolynomialIndex&) const;
|
||||
bool operator!=(const ResponsePolynomialIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes a sensor response using a polynomial
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API ResponsePolynomial : public PublicObject {
|
||||
DECLARE_SC_CLASS(ResponsePolynomial)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
ResponsePolynomial();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
ResponsePolynomial(const ResponsePolynomial& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
ResponsePolynomial(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~ResponsePolynomial() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponsePolynomial* Create();
|
||||
static ResponsePolynomial* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static ResponsePolynomial* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
ResponsePolynomial& operator=(const ResponsePolynomial& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const ResponsePolynomial& other) const;
|
||||
bool operator!=(const ResponsePolynomial& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const ResponsePolynomial& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Unique response name
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
//! Gain of response (48.05/58.04)
|
||||
void setGain(const OPT(double)& gain);
|
||||
double gain() const;
|
||||
|
||||
//! Gain frequency (48.06/58.05)
|
||||
void setGainFrequency(const OPT(double)& gainFrequency);
|
||||
double gainFrequency() const;
|
||||
|
||||
//! A single character describing valid frequency units
|
||||
//! (42.09/62.08): A - rad/s, B - Hz
|
||||
void setFrequencyUnit(const std::string& frequencyUnit);
|
||||
const std::string& frequencyUnit() const;
|
||||
|
||||
//! A single character describing the type of polynomial
|
||||
//! approximation (42.08/62.07): M - MacLaurin
|
||||
void setApproximationType(const std::string& approximationType);
|
||||
const std::string& approximationType() const;
|
||||
|
||||
//! Lower bound of approximation (42.12/62.11)
|
||||
void setApproximationLowerBound(const OPT(double)& approximationLowerBound);
|
||||
double approximationLowerBound() const;
|
||||
|
||||
//! Upper bound of approximation (42.13/62.12)
|
||||
void setApproximationUpperBound(const OPT(double)& approximationUpperBound);
|
||||
double approximationUpperBound() const;
|
||||
|
||||
//! The maximum absolute error of the polynomial approximation
|
||||
//! (42.14/62.13; Put 0.0 if the value is unknown or actually
|
||||
//! zero)
|
||||
void setApproximationError(const OPT(double)& approximationError);
|
||||
double approximationError() const;
|
||||
|
||||
//! The number of coefficients in the polynomial approximation
|
||||
//! (42.15/62.14; one more than the degree of the polynomial
|
||||
void setNumberOfCoefficients(const OPT(int)& numberOfCoefficients);
|
||||
int numberOfCoefficients() const;
|
||||
|
||||
//! The polynomial coefficients, lowest order first
|
||||
//! (42.16/62.15)
|
||||
void setCoefficients(const OPT(RealArray)& coefficients);
|
||||
RealArray& coefficients();
|
||||
const RealArray& coefficients() const;
|
||||
|
||||
void setRemark(const OPT(Blob)& remark);
|
||||
Blob& remark();
|
||||
const Blob& remark() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const ResponsePolynomialIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const ResponsePolynomial* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Inventory* inventory() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
ResponsePolynomialIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(double) _gain;
|
||||
OPT(double) _gainFrequency;
|
||||
std::string _frequencyUnit;
|
||||
std::string _approximationType;
|
||||
OPT(double) _approximationLowerBound;
|
||||
OPT(double) _approximationUpperBound;
|
||||
OPT(double) _approximationError;
|
||||
OPT(int) _numberOfCoefficients;
|
||||
OPT(RealArray) _coefficients;
|
||||
OPT(Blob) _remark;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(ResponsePolynomial);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
256
include/seiscomp/datamodel/route.h
Normal file
256
include/seiscomp/datamodel/route.h
Normal file
@ -0,0 +1,256 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ROUTE_H
|
||||
#define SEISCOMP_DATAMODEL_ROUTE_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/routearclink.h>
|
||||
#include <seiscomp/datamodel/routeseedlink.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Route);
|
||||
DEFINE_SMARTPOINTER(RouteArclink);
|
||||
DEFINE_SMARTPOINTER(RouteSeedlink);
|
||||
|
||||
class Routing;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API RouteIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RouteIndex();
|
||||
RouteIndex(const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
const std::string& locationCode,
|
||||
const std::string& streamCode);
|
||||
|
||||
//! Copy constructor
|
||||
RouteIndex(const RouteIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const RouteIndex&) const;
|
||||
bool operator!=(const RouteIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string networkCode;
|
||||
std::string stationCode;
|
||||
std::string locationCode;
|
||||
std::string streamCode;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes an ArcLink route (collection of servers
|
||||
* \brief that provide specific datastreams)
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Route : public PublicObject {
|
||||
DECLARE_SC_CLASS(Route)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Route();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Route(const Route& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Route(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Route() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Route* Create();
|
||||
static Route* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Route* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Route& operator=(const Route& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Route& other) const;
|
||||
bool operator!=(const Route& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Route& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Network code
|
||||
void setNetworkCode(const std::string& networkCode);
|
||||
const std::string& networkCode() const;
|
||||
|
||||
//! Station code (empty for any station)
|
||||
void setStationCode(const std::string& stationCode);
|
||||
const std::string& stationCode() const;
|
||||
|
||||
//! Location code (empty for any location)
|
||||
void setLocationCode(const std::string& locationCode);
|
||||
const std::string& locationCode() const;
|
||||
|
||||
//! Stream (Channel) code (empty for any stream)
|
||||
void setStreamCode(const std::string& streamCode);
|
||||
const std::string& streamCode() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const RouteIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const Route* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(RouteArclink* obj);
|
||||
bool add(RouteSeedlink* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(RouteArclink* obj);
|
||||
bool remove(RouteSeedlink* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeRouteArclink(size_t i);
|
||||
bool removeRouteArclink(const RouteArclinkIndex& i);
|
||||
bool removeRouteSeedlink(size_t i);
|
||||
bool removeRouteSeedlink(const RouteSeedlinkIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t routeArclinkCount() const;
|
||||
size_t routeSeedlinkCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
RouteArclink* routeArclink(size_t i) const;
|
||||
RouteArclink* routeArclink(const RouteArclinkIndex& i) const;
|
||||
|
||||
RouteSeedlink* routeSeedlink(size_t i) const;
|
||||
RouteSeedlink* routeSeedlink(const RouteSeedlinkIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
Routing* routing() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
RouteIndex _index;
|
||||
|
||||
// Aggregations
|
||||
std::vector<RouteArclinkPtr> _routeArclinks;
|
||||
std::vector<RouteSeedlinkPtr> _routeSeedlinks;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Route);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
175
include/seiscomp/datamodel/routearclink.h
Normal file
175
include/seiscomp/datamodel/routearclink.h
Normal file
@ -0,0 +1,175 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ROUTEARCLINK_H
|
||||
#define SEISCOMP_DATAMODEL_ROUTEARCLINK_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/core/datetime.h>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(RouteArclink);
|
||||
|
||||
class Route;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API RouteArclinkIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RouteArclinkIndex();
|
||||
RouteArclinkIndex(const std::string& address,
|
||||
Seiscomp::Core::Time start);
|
||||
|
||||
//! Copy constructor
|
||||
RouteArclinkIndex(const RouteArclinkIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const RouteArclinkIndex&) const;
|
||||
bool operator!=(const RouteArclinkIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string address;
|
||||
Seiscomp::Core::Time start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes an ArcLink route (data source)
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API RouteArclink : public Object {
|
||||
DECLARE_SC_CLASS(RouteArclink)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RouteArclink();
|
||||
|
||||
//! Copy constructor
|
||||
RouteArclink(const RouteArclink& other);
|
||||
|
||||
//! Destructor
|
||||
~RouteArclink() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
RouteArclink& operator=(const RouteArclink& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const RouteArclink& other) const;
|
||||
bool operator!=(const RouteArclink& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const RouteArclink& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Server address in ip:port format
|
||||
void setAddress(const std::string& address);
|
||||
const std::string& address() const;
|
||||
|
||||
//! Start of data
|
||||
void setStart(Seiscomp::Core::Time start);
|
||||
Seiscomp::Core::Time start() const;
|
||||
|
||||
//! End of data
|
||||
void setEnd(const OPT(Seiscomp::Core::Time)& end);
|
||||
Seiscomp::Core::Time end() const;
|
||||
|
||||
//! priority (1 is highest)
|
||||
void setPriority(const OPT(int)& priority);
|
||||
int priority() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const RouteArclinkIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const RouteArclink* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Route* route() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
RouteArclinkIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(Seiscomp::Core::Time) _end;
|
||||
OPT(int) _priority;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
163
include/seiscomp/datamodel/routeseedlink.h
Normal file
163
include/seiscomp/datamodel/routeseedlink.h
Normal file
@ -0,0 +1,163 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_ROUTESEEDLINK_H
|
||||
#define SEISCOMP_DATAMODEL_ROUTESEEDLINK_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/datamodel/object.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(RouteSeedlink);
|
||||
|
||||
class Route;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API RouteSeedlinkIndex {
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RouteSeedlinkIndex();
|
||||
RouteSeedlinkIndex(const std::string& address);
|
||||
|
||||
//! Copy constructor
|
||||
RouteSeedlinkIndex(const RouteSeedlinkIndex&);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
bool operator==(const RouteSeedlinkIndex&) const;
|
||||
bool operator!=(const RouteSeedlinkIndex&) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Attributes
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
std::string address;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief This type describes an SeedLink route (data source)
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API RouteSeedlink : public Object {
|
||||
DECLARE_SC_CLASS(RouteSeedlink)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Constructor
|
||||
RouteSeedlink();
|
||||
|
||||
//! Copy constructor
|
||||
RouteSeedlink(const RouteSeedlink& other);
|
||||
|
||||
//! Destructor
|
||||
~RouteSeedlink() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
RouteSeedlink& operator=(const RouteSeedlink& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const RouteSeedlink& other) const;
|
||||
bool operator!=(const RouteSeedlink& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const RouteSeedlink& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Server address in ip:port format
|
||||
void setAddress(const std::string& address);
|
||||
const std::string& address() const;
|
||||
|
||||
//! priority (1 is highest)
|
||||
void setPriority(const OPT(int)& priority);
|
||||
int priority() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Index management
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Returns the object's index
|
||||
const RouteSeedlinkIndex& index() const;
|
||||
|
||||
//! Checks two objects for equality regarding their index
|
||||
bool equalIndex(const RouteSeedlink* lhs) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
Route* route() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Index
|
||||
RouteSeedlinkIndex _index;
|
||||
|
||||
// Attributes
|
||||
OPT(int) _priority;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user