|
neic-glass3
1.4.6
|
glasscore site list class More...
#include <SiteList.h>


Public Member Functions | |
| CSiteList (int numThreads=1, int sleepTime=100, int checkInterval=60) | |
| CSiteList constructor. More... | |
| ~CSiteList () | |
| CSiteList destructor. More... | |
| void | clear () override |
| CSiteList clear function. More... | |
| bool | receiveExternalMessage (std::shared_ptr< json::Object > com) |
| CSiteList communication receiving function. More... | |
| bool | addSiteFromJSON (std::shared_ptr< json::Object > com) |
| CSiteList add/update site function. More... | |
| bool | addListOfSitesFromJSON (std::shared_ptr< json::Object > com) |
| CSiteList add list of sites function. More... | |
| bool | addSite (std::shared_ptr< CSite > site) |
| CSiteList add/update site function. More... | |
| int | size () const |
| CSiteList Site count function. More... | |
| std::shared_ptr< CSite > | getSite (std::string scnl) |
| Get site by scnl. More... | |
| std::shared_ptr< CSite > | getSite (std::string site, std::string comp, std::string net, std::string loc) |
| Get site by station, component, network, and location. More... | |
| std::vector< std::shared_ptr< CSite > > | getListOfSites () |
| Get current list of sites. More... | |
| std::shared_ptr< json::Object > | generateSiteListMessage (bool send=true) |
| Generate SiteList message. More... | |
| int | getMaxHoursWithoutPicking () const |
| Get the maximum hours without picking before a site is declared nonresponsive and unused, a -1 disables this metric. More... | |
| void | setMaxHoursWithoutPicking (int hoursWithoutPicking) |
| Set the maximum hours without picking before a site is declared nonresponsive and unused, a -1 disables this metric. More... | |
| int | getHoursBeforeLookingUp () const |
| Get the maximum hours between requesting site information from outside glasscore, a -1 disables this process. More... | |
| void | setHoursBeforeLookingUp (int hoursBeforeLookingUp) |
| Set the maximum hours between requesting site information from outside glasscore, a -1 disables this process. If enabled, glass will always re-request the coordinates and properties of this station every hoursBeforeLookingUp hours, regardless if the site is currently known. More... | |
| int | getMaxPicksPerHour () const |
| Get the maximum picks per hour before a site is declared too noisy to use, a -1 disables this metric. More... | |
| void | setMaxPicksPerHour (int maxPicksPerHour) |
| Set the maximum picks per hour before a site is declared too noisy to use, a -1 disables this metric. More... | |
| int | getLastUpdated () const |
| Get last time in epoch seconds the site list was modified. More... | |
| glass3::util::WorkState | work () override |
| SiteList 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... | |
Additional Inherited Members | |
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... | |
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 site list class
The CSiteList class is the class that maintains a vector and :map of all the seismic stations used by glasscore.
CSiteList also maintains a std::vector mapping the string SCNL id to CSite objects
CSiteList contains functions to support new data input and clearing the list
CSiteList uses smart pointers (std::shared_ptr).
|
explicit |
| bool glasscore::CSiteList::addListOfSitesFromJSON | ( | std::shared_ptr< json::Object > | com | ) |
| bool glasscore::CSiteList::addSite | ( | std::shared_ptr< CSite > | site | ) |
| bool glasscore::CSiteList::addSiteFromJSON | ( | std::shared_ptr< json::Object > | com | ) |
|
overridevirtual |
CSiteList clear function.
Reimplemented from glass3::util::BaseClass.
| std::shared_ptr< json::Object > glasscore::CSiteList::generateSiteListMessage | ( | bool | send = true | ) |
Generate SiteList message.
Generate a json object representing all thie sites in this SiteList in the "SiteList" format and optionally send a pointer to this object to CGlass (and out of glasscore) using the CGlass send function (pGlass->send)
| send | - A boolean flag indicating that in addition to generating the "SiteList" format message, the function should also send it. Defaults to true |
| int glasscore::CSiteList::getHoursBeforeLookingUp | ( | ) | const |
Get the maximum hours between requesting site information from outside glasscore, a -1 disables this process.
| int glasscore::CSiteList::getLastUpdated | ( | ) | const |
Get last time in epoch seconds the site list was modified.
| std::vector< std::shared_ptr< CSite > > glasscore::CSiteList::getListOfSites | ( | ) |
Get current list of sites.
Gets the current list of sites contained within this sitelist
| int glasscore::CSiteList::getMaxHoursWithoutPicking | ( | ) | const |
Get the maximum hours without picking before a site is declared nonresponsive and unused, a -1 disables this metric.
| int glasscore::CSiteList::getMaxPicksPerHour | ( | ) | const |
Get the maximum picks per hour before a site is declared too noisy to use, a -1 disables this metric.
| std::shared_ptr< CSite > glasscore::CSiteList::getSite | ( | std::string | scnl | ) |
Get site by scnl.
Gets a specific site using the given scnl id.
| scnl | - A std::string containing the scnl |
| std::shared_ptr< CSite > glasscore::CSiteList::getSite | ( | std::string | site, |
| std::string | comp, | ||
| std::string | net, | ||
| std::string | loc | ||
| ) |
Get site by station, component, network, and location.
Gets a specific site using the given station, component, network, and location
| site | - A std::string containing the station |
| comp | - A std::string containing the component |
| net | - A std::string containing the network |
| loc | - A std::string containing the location |
| bool glasscore::CSiteList::receiveExternalMessage | ( | std::shared_ptr< json::Object > | com | ) |
CSiteList communication receiving function.
The function used by CSiteList to receive communication (such as configuration or input data), from outside the glasscore library, or it's parent CGlass.
Supports Site (add site data to list) SiteUse (enable or disable a site) and ClearGlass (clear all Site data) inputs.
| com | - A pointer to a json::object containing the communication. |
| void glasscore::CSiteList::setHoursBeforeLookingUp | ( | int | hoursBeforeLookingUp | ) |
Set the maximum hours between requesting site information from outside glasscore, a -1 disables this process. If enabled, glass will always re-request the coordinates and properties of this station every hoursBeforeLookingUp hours, regardless if the site is currently known.
| hoursBeforeLookingUp | - an integer containing the maximum hours between requesting site information |
| void glasscore::CSiteList::setMaxHoursWithoutPicking | ( | int | hoursWithoutPicking | ) |
Set the maximum hours without picking before a site is declared nonresponsive and unused, a -1 disables this metric.
| hoursWithoutPicking | - an integer containing the maximum hours without picking allowed |
| void glasscore::CSiteList::setMaxPicksPerHour | ( | int | maxPicksPerHour | ) |
Set the maximum picks per hour before a site is declared too noisy to use, a -1 disables this metric.
| maxPicksPerHour | - an integer containing the maximum picks per hour allowed |
| int glasscore::CSiteList::size | ( | ) | const |
|
overridevirtual |
SiteList work function.
checks sites
Implements glass3::util::ThreadBaseClass.
1.8.11