neic-glass3  1.4.6
Correlation.h
Go to the documentation of this file.
1 /*****************************************
2  * This file is documented for Doxygen.
3  * If you modify this file please update
4  * the comments so that Doxygen will still
5  * be able to work.
6  ****************************************/
7 #ifndef CORRELATION_H
8 #define CORRELATION_H
9 
10 #include <json.h>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 #include <mutex>
15 #include <atomic>
16 
17 namespace glasscore {
18 
19 // forward declarations
20 class CSite;
21 class CSiteList;
22 class CHypo;
23 
45 class CCorrelation {
46  public:
53  CCorrelation();
54 
76  CCorrelation(std::shared_ptr<CSite> correlationSite, double correlationTime,
77  std::string correlationIdString, std::string phase,
78  double orgTime, double orgLat, double orgLon, double orgZ,
79  double corrVal);
80 
94  CCorrelation(std::shared_ptr<json::Object> correlation,
95  CSiteList *pSiteList);
96 
100  ~CCorrelation();
101 
105  void clear();
106 
128  bool initialize(std::shared_ptr<CSite> correlationSite,
129  double correlationTime, std::string correlationIdString,
130  std::string phase, double orgTime, double orgLat,
131  double orgLon, double orgZ, double corrVal);
132 
150  void addHypoReference(std::shared_ptr<CHypo> hyp, bool force = false);
151 
165  void removeHypoReference(std::shared_ptr<CHypo> hyp);
166 
179  void removeHypoReference(std::string pid);
180 
190  void clearHypoReference();
191 
196  double getCorrelation() const;
197 
203  double getLatitude() const;
204 
210  double getLongitude() const;
211 
217  double getDepth() const;
218 
224  double getTOrigin() const;
225 
231  const std::shared_ptr<json::Object>& getJSONCorrelation() const;
232 
243  const std::shared_ptr<CHypo> getHypoReference() const;
244 
250  const std::shared_ptr<CSite> getSite() const;
251 
256  const std::string& getPhaseName() const;
257 
262  const std::string& getID() const;
263 
268  double getTCorrelation() const;
269 
274  double getTCreate() const;
275 
276  private:
282  std::weak_ptr<CSite> m_wpSite;
283 
290  std::weak_ptr<CHypo> m_wpHypo;
291 
295  std::string m_sPhaseName;
296 
300  std::string m_sID;
301 
305  std::atomic<double> m_tCorrelation;
306 
311  std::atomic<double> m_tOrigin;
312 
316  std::atomic<double> m_dLatitude;
317 
321  std::atomic<double> m_dLongitude;
322 
327  std::atomic<double> m_dDepth;
328 
332  std::atomic<double> m_dCorrelation;
333 
338  std::atomic<double> m_tCreate;
339 
345  std::shared_ptr<json::Object> m_JSONCorrelation;
346 
354  mutable std::recursive_mutex m_CorrelationMutex;
355 };
356 } // namespace glasscore
357 #endif // CORRELATION_H
void clearHypoReference()
Remove hypo reference to this correlation.
Definition: Correlation.cpp:406
double getLongitude() const
Get the correlation source longitude for this correlation.
Definition: Correlation.cpp:422
~CCorrelation()
CCorrelation destructor.
Definition: Correlation.cpp:302
const std::shared_ptr< json::Object > & getJSONCorrelation() const
Get input JSON correlation message.
Definition: Correlation.cpp:432
glasscore site list class
Definition: SiteList.h:40
double getTOrigin() const
Get the correlation source origin time for this correlation.
Definition: Correlation.cpp:468
void addHypoReference(std::shared_ptr< CHypo > hyp, bool force=false)
Add a hypo reference to this correlation.
Definition: Correlation.cpp:358
double getCorrelation() const
Get the correlation value for this correlation.
Definition: Correlation.cpp:412
CCorrelation()
CCorrelation default constructor.
Definition: Correlation.cpp:20
const std::string & getID() const
Get the ID of this correlation.
Definition: Correlation.cpp:453
void removeHypoReference(std::shared_ptr< CHypo > hyp)
Remove hypo specific reference to this correlation.
Definition: Correlation.cpp:378
double getLatitude() const
Get the correlation source latitude for this correlation.
Definition: Correlation.cpp:417
double getTCorrelation() const
Get the arrival time for this correlation.
Definition: Correlation.cpp:458
glasscore correlation class
Definition: Correlation.h:45
const std::shared_ptr< CHypo > getHypoReference() const
Get the current hypo reference to this correlation.
Definition: Correlation.cpp:437
glasscore hypocenter class
Definition: Hypo.h:75
void clear()
CCorrelation clear function.
Definition: Correlation.cpp:306
const std::shared_ptr< CSite > getSite() const
Get the site for this correlation.
Definition: Correlation.cpp:443
bool initialize(std::shared_ptr< CSite > correlationSite, double correlationTime, std::string correlationIdString, std::string phase, double orgTime, double orgLat, double orgLon, double orgZ, double corrVal)
CCorrelation initialization function.
Definition: Correlation.cpp:326
The namespace containing the core algorithm.
Definition: Correlation.h:17
const std::string & getPhaseName() const
Get the phase name for this correlation.
Definition: Correlation.cpp:448
glasscore site (station) class
Definition: Site.h:69
double getDepth() const
Get the correlation source depth for this correlation.
Definition: Correlation.cpp:427
double getTCreate() const
Get the creation (insertion) time of this correlation.
Definition: Correlation.cpp:463