|
neic-glass3
1.4.6
|
glasscore pick list class More...
#include <PickList.h>


Public Member Functions | |
| CPickList (int numThreads=1, int sleepTime=50, int checkInterval=300) | |
| CPickList constructor. More... | |
| ~CPickList () | |
| CPickList destructor. More... | |
| void | clear () override |
| CPickList clear function. More... | |
| bool | receiveExternalMessage (std::shared_ptr< json::Object > com) |
| CPickList communication receiving function. More... | |
| bool | addPick (std::shared_ptr< json::Object > pick) |
| CPickList add pick function. More... | |
| std::shared_ptr< CPick > | getDuplicate (double newTPick, std::string newSCNL, double tDuration) |
| Checks if the provided pick time is a duplicate. More... | |
| bool | scavenge (std::shared_ptr< CHypo > hyp, double tWindow=CHypoList::k_nHypoSearchPastDurationForPick) |
| Search for any associable picks that match hypo. More... | |
| const CSiteList * | getSiteList () const |
| Get the CSiteList pointer used by this pick list for site lookups. More... | |
| void | setSiteList (CSiteList *siteList) |
| Set the CSiteList pointer used by this pick list for site lookups. More... | |
| int | getMaxAllowablePickCount () const |
| Get the maximum allowed size of this pick list. More... | |
| void | setMaxAllowablePickCount (int pickMax) |
| Set the maximum allowed size of this pick list. More... | |
| int | getCountOfTotalPicksProcessed () const |
| Get the total number of picks processed by this list. More... | |
| int | length () const |
| Get the current number of picks contained in this list. More... | |
| std::vector< std::weak_ptr< CPick > > | getPicks (double t1, double t2) |
| Get a vector of picks that fall within a time window. More... | |
| glass3::util::WorkState | work () override |
| PickList work function. More... | |
Public Member Functions inherited from glass3::util::ThreadBaseClass | |
| ThreadBaseClass () | |
| ThreadBaseClass constructor. More... | |
| ThreadBaseClass (std::string threadName, int sleepTimeMS=100, int numThreads=1, int checkInterval=300) | |
| An advanced constructor that sets up the ThreadBaseClass with a provided thread name, sleep between work time duration, number of threads, and statsus check interval. More... | |
| ~ThreadBaseClass () | |
| ThreadBaseClass destructor. More... | |
| virtual bool | start () |
| work thread start function More... | |
| virtual bool | stop () |
| work thread stop function More... | |
| int | getNumThreads () |
| Retrieves the number of work threads. More... | |
| void | setNumThreads (int numThreads) |
| Sets the number of work threads. More... | |
| void | setThreadHealth (bool health=true) |
| Function to set thread health. More... | |
| virtual bool | healthCheck () |
| work threads check function More... | |
| void | setSleepTime (int sleepTimeMS) |
| Sets the time to sleep between work() calls. More... | |
| int | getSleepTime () |
| Retrieves the time to sleep between work() calls. More... | |
| glass3::util::ThreadState | getWorkThreadsState () |
| Function to get the work threads state. More... | |
| void | setHealthCheckInterval (int interval) |
| Function to set work threads health check interval. More... | |
| int | getHealthCheckInterval () |
| Function to retrieve the work threads health check interval. More... | |
| bool | getTerminate () |
| Function to retrieve whether the thread should terminate. More... | |
| const std::string & | getThreadName () |
| Function to retrieve the name of the work threads. More... | |
| std::time_t | getAllLastHealthy (size_t *pThreadId) |
| Function to retrieve the oldest time any of the work threads last updated their health status as healthy. More... | |
Public Member Functions inherited from glass3::util::BaseClass | |
| BaseClass () | |
| BaseClass constructor. More... | |
| virtual | ~BaseClass () |
| BaseClass destructor. More... | |
| virtual bool | setup (std::shared_ptr< const json::Object > config) |
| BaseClass configuration function. More... | |
| const std::shared_ptr< const json::Object > | getConfig () |
| bool | getSetup () |
| Retrieves the class member boolean flag indicating whether the class has been setup, set to true if setup was successful. More... | |
| const std::string & | getDefaultAgencyId () |
| Function to retrieve the name of the default agency id. More... | |
| void | setDefaultAgencyId (const std::string &id) |
| Function to set the name of the default agency id. More... | |
| const std::string & | getDefaultAuthor () |
| Function to retrieve the name of the default author. More... | |
| void | setDefaultAuthor (const std::string &author) |
| Function to set the name of the default author. More... | |
Protected Member Functions | |
| void | updatePosition (std::shared_ptr< CPick > pick) |
| A PickList function that updates the position of the given pick in the multiset. More... | |
| void | eraseFromMultiset (std::shared_ptr< CPick > pick) |
| A PickList function that removes the given pick from the multiset. More... | |
Protected Member Functions inherited from glass3::util::ThreadBaseClass | |
| void | setWorkThreadsState (glass3::util::ThreadState state) |
| Function to set threads state. More... | |
| void | workLoop () |
| ThreadBaseClass work loop function. More... | |
| void | setLastHealthy (std::time_t now) |
| Function to set the last time the work thread was healthy. More... | |
Additional Inherited Members | |
Protected Attributes inherited from glass3::util::ThreadBaseClass | |
| std::vector< std::thread > | m_WorkThreads |
| the std::vector that contains the work std::thread objects More... | |
| std::map< std::thread::id, std::atomic< int > > | m_ThreadHealthMap |
| A std::map containing the epoch times as std::atomic<double>> that each work thread was last marked as healthy, identified by the thread id. More... | |
Protected Attributes inherited from glass3::util::BaseClass | |
| std::shared_ptr< const json::Object > | m_Config |
| A shared pointer to the json::Object that holds the configuration. More... | |
| std::atomic< bool > | m_bIsSetup |
| the boolean flag indicating whether the class has been setup, set to true if setup was successful. More... | |
| std::string | m_DefaultAgencyID |
| A std::string containing the default agency id to use in parsing if one is not provided. More... | |
| std::string | m_DefaultAuthor |
| A std::string containing the default author to use in parsing if one is not provided. More... | |
glasscore pick list class
The CPickList class is the class that maintains a std::multiset of all the waveform arrival picks being considered by glasscore.
CPickList contains functions to support pick parsing, scavenging, and nucleation.
CPickList uses smart pointers (std::shared_ptr).
|
explicit |
CPickList constructor.
The constructor for the CPickList class.
| numThreads | - An integer containing the number of threads in the pool. Default 1 |
| sleepTime | - An integer containing the amount of time to sleep in milliseconds between jobs. Default 50 |
| checkInterval | - An integer containing the amount of time in seconds between status checks. -1 to disable status checks. Default 300. |
| bool glasscore::CPickList::addPick | ( | std::shared_ptr< json::Object > | pick | ) |
CPickList add pick function.
The function used by CPickList to add a pick to the multiset, if the new pick causes the number of picks in the multiset to exceed the configured maximum, remove the oldest pick from the multiset, as well as try to remove it from the shorter list of picks in CSite.
This function will generate a json formatted request for site (station) information if the pick is from an unknown site via the CSiteList getSite() function.
This function will first attempt to associate the pick with an existing hypocenter via calling the CHypoList::associate() function. If association is unsuccessful, the pick is nucleated using the CPick::Nucleate() function.
| pick | - A pointer to a json::object containing the pick. |
|
overridevirtual |
CPickList clear function.
Reimplemented from glass3::util::BaseClass.
|
protected |
A PickList function that removes the given pick from the multiset.
| pick | - A shared_ptr to the pick to be removed |
| int glasscore::CPickList::getCountOfTotalPicksProcessed | ( | ) | const |
Get the total number of picks processed by this list.
| std::shared_ptr< CPick > glasscore::CPickList::getDuplicate | ( | double | newTPick, |
| std::string | newSCNL, | ||
| double | tDuration | ||
| ) |
Checks if the provided pick time is a duplicate.
Compares the given pick time with the existing pick list times, in order to determine whether the given pick is a duplicate of an existing pick.
| newTPick | - A double containing the arrival time of the pick |
| newSCNL | - A std::string containing the scnl of the new pick |
| tDuration | - A double containing the allowable matching time window duration in seconds |
| int glasscore::CPickList::getMaxAllowablePickCount | ( | ) | const |
Get the maximum allowed size of this pick list.
| std::vector< std::weak_ptr< CPick > > glasscore::CPickList::getPicks | ( | double | t1, |
| double | t2 | ||
| ) |
Get a vector of picks that fall within a time window.
Get a vector of picks that fall within the provided time window from t1 to t2
| 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 |
| const CSiteList * glasscore::CPickList::getSiteList | ( | ) | const |
| int glasscore::CPickList::length | ( | ) | const |
Get the current number of picks contained in this list.
| bool glasscore::CPickList::receiveExternalMessage | ( | std::shared_ptr< json::Object > | com | ) |
CPickList communication receiving function.
The function used by CPickList to receive communication (such as configuration or input data), from outside the glasscore library, or it's parent CGlass.
Supports Pick (add pick data to list) input.
| com | - A pointer to a json::object containing the communication. |
| bool glasscore::CPickList::scavenge | ( | std::shared_ptr< CHypo > | hyp, |
| double | tWindow = CHypoList::k_nHypoSearchPastDurationForPick |
||
| ) |
Search for any associable picks that match hypo.
Search through all picks within a provided number seconds from the origin time of the given hypocenter, adding any picks that meet association criteria to the given hypocenter.
| 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 3600.0 |
| void glasscore::CPickList::setMaxAllowablePickCount | ( | int | pickMax | ) |
Set the maximum allowed size of this pick list.
| pickMax | - an integer containing the maximum allowed size of this pick list |
| void glasscore::CPickList::setSiteList | ( | CSiteList * | siteList | ) |
|
protected |
A PickList function that updates the position of the given pick in the multiset.
| pick | - A shared_ptr to the pick that needs a position update |
|
overridevirtual |
PickList work function.
Attempts to associate and nuclate the next pick on the queue.
Implements glass3::util::ThreadBaseClass.
1.8.11