neic-glass3  1.4.6
Public Member Functions | List of all members
glasscore::CCorrelationList Class Reference

glasscore correlation list class More...

#include <CorrelationList.h>

Collaboration diagram for glasscore::CCorrelationList:
Collaboration graph

Public Member Functions

 CCorrelationList ()
 CCorrelationList constructor. More...
 
 ~CCorrelationList ()
 CCorrelationList destructor. More...
 
void clear ()
 CCorrelationList clear function. More...
 
bool receiveExternalMessage (std::shared_ptr< json::Object > com)
 CCorrelationList communication receiving function. More...
 
bool addCorrelationFromJSON (std::shared_ptr< json::Object > com)
 CCorrelationList add correlation function. More...
 
bool checkDuplicate (CCorrelation *newCorrelation, double tWindow, double xWindow)
 Checks if the provided correlation is sduplicate. More...
 
bool scavenge (std::shared_ptr< CHypo > hyp, double tWindow=2.5)
 Search for any associable correlations that match hypo. More...
 
const CSiteListgetSiteList () const
 Get the CSiteList pointer used by this correlation list for site lookups. More...
 
void setSiteList (CSiteList *siteList)
 Set the CSiteList pointer used by this correlation list for site lookups. More...
 
int getMaxAllowableCorrelationCount () const
 Get the maximum allowed size of this correlation list. More...
 
void setMaxAllowableCorrelationCount (int correlationMax)
 Set the maximum allowed size of this correlation list. More...
 
int getCountOfTotalCorrelationsProcessed () const
 Get the total number of correlations processed by this list. More...
 
int length () const
 Get the current number of correlations contained in this list. More...
 
std::vector< std::weak_ptr< CCorrelation > > getCorrelations (double t1, double t2)
 Get a vector of correlations that fall within a time window. More...
 

Detailed Description

glasscore correlation list class

The CCorrelationList class is the class that maintains a std::multiset of all the correlations being considered by glasscore.

CCorrelationList contains functions to support correlation parsing, scavenging, and the creation of a new event hypocenter based on the correlation.

CCorrelationList uses smart pointers (std::shared_ptr).

Constructor & Destructor Documentation

glasscore::CCorrelationList::CCorrelationList ( )

CCorrelationList constructor.

glasscore::CCorrelationList::~CCorrelationList ( )

CCorrelationList destructor.

Member Function Documentation

bool glasscore::CCorrelationList::addCorrelationFromJSON ( std::shared_ptr< json::Object >  com)

CCorrelationList add correlation function.

The function used by CCorrelationList to add a correlation to multiset, if the new correlation causes the number of correlations in the multiset to exceed the configured maximum, remove the oldest correlation from the multiset.

This function will generate a json formatted request for site (station) information if the correlation is from an unknown site via the CSiteList getSite() function.

This function will first attempt to associate the correlation with an existing hypocenter via calling the CHypoList::associate() function. If association is unsuccessful, the correlation creates a new hypocenter

Parameters
com- A pointer to a json::object containing the correlation.
Returns
Returns true if the correlation was usable and added by CCorrelationList, false otherwise
bool glasscore::CCorrelationList::checkDuplicate ( CCorrelation newCorrelation,
double  tWindow,
double  xWindow 
)

Checks if the provided correlation is sduplicate.

Compares the given correlation with the existing correlation list, in order to determine whether the given correlation is a duplicate of an existing correlation.

Parameters
newCorrelation- A shared pointer to the correlation to check
tWindow- A double containing the allowable matching time window in seconds
xWindow- A double containing the allowable matching distance window in degrees returns true if correlation is a duplicate, false otherwise
void glasscore::CCorrelationList::clear ( )

CCorrelationList clear function.

std::vector< std::weak_ptr< CCorrelation > > glasscore::CCorrelationList::getCorrelations ( double  t1,
double  t2 
)

Get a vector of correlations that fall within a time window.

Get a vector of correlations that fall within the provided time window from t1 to t2

Parameters
t1- A double value containing the beginning of the time window in Gregorian seconds
t2- A double value containing the end of the time window in Gregorian seconds
Returns
Return a std::vector of std::weak_ptrs to the correlations within the time window
int glasscore::CCorrelationList::getCountOfTotalCorrelationsProcessed ( ) const

Get the total number of correlations processed by this list.

Returns
Return an integer containing the total number of correlations processed by this list
int glasscore::CCorrelationList::getMaxAllowableCorrelationCount ( ) const

Get the maximum allowed size of this correlation list.

Returns
Return an integer containing the maximum allowed size of this correlation list
const CSiteList * glasscore::CCorrelationList::getSiteList ( ) const

Get the CSiteList pointer used by this correlation list for site lookups.

Returns
Return a pointer to the CSiteList class used by this correlation list
int glasscore::CCorrelationList::length ( ) const

Get the current number of correlations contained in this list.

Returns
Return an integer containing the current number of correlations contained in this list
bool glasscore::CCorrelationList::receiveExternalMessage ( std::shared_ptr< json::Object >  com)

CCorrelationList communication receiving function.

The function used by CCorrelationList to receive communication (such as configuration or input data), from outside the glasscore library, or it's parent CGlass.

Supports processing Correlation messages

Parameters
com- A pointer to a json::object containing the communication.
Returns
Returns true if the communication was handled by CCorrelationList, false otherwise
bool glasscore::CCorrelationList::scavenge ( std::shared_ptr< CHypo hyp,
double  tWindow = 2.5 
)

Search for any associable correlations that match hypo.

Search through all correlations within a provided number seconds from the origin time of the given hypocenter, adding any correlations that meet association criteria to the given hypocenter.

Parameters
hyp- A shared_ptr to a CHypo object containing the hypocenter to attempt to associate to.
tWindow- A double value containing the window to search picks from origin time in seconds, defaults to 2.5
Returns
Returns true if any picks were associated to the hypocenter, false otherwise.
void glasscore::CCorrelationList::setMaxAllowableCorrelationCount ( int  correlationMax)

Set the maximum allowed size of this correlation list.

Parameters
correlationMax- an integer containing the maximum allowed size of this correlation list
void glasscore::CCorrelationList::setSiteList ( CSiteList siteList)

Set the CSiteList pointer used by this correlation list for site lookups.

Parameters
siteList- a pointer to the CSiteList class used by this correlation list

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