neic-glass3  1.4.6
Public Member Functions | Protected Member Functions | List of all members
glass3::process::Associator Class Reference

glass association class More...

#include <associator.h>

Inheritance diagram for glass3::process::Associator:
Inheritance graph
Collaboration diagram for glass3::process::Associator:
Collaboration graph

Public Member Functions

 Associator (glass3::util::iInput *inputint, glass3::util::iOutput *outputint)
 associator constructor More...
 
 ~Associator ()
 associator destructor More...
 
bool setup (std::shared_ptr< const json::Object > config) override
 Associator configuration function. More...
 
void clear () override
 associator clear function More...
 
void recieveGlassMessage (std::shared_ptr< json::Object > communication) override
 glasscore message receiver function More...
 
void sendToAssociator (std::shared_ptr< json::Object > &message) override
 glasscore message sending function More...
 
bool healthCheck () override
 associator heath check 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...
 
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...
 
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

glass3::util::WorkState work () override
 associator work function 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...
 

Detailed Description

glass association class

The glass association class is a thread class hosting the glass core association and nucleation engine. The associator class pulls input data from the input class, and sends it into glasscore. It also routes any results to the output class. The class also sends any configuration into glasscore.

associator inherits from the glass3::util::ThreadBaseClass class.

associator implements the glasscore::IGlassSend and glass3::util::iAssociator interfaces.

Constructor & Destructor Documentation

glass3::process::Associator::Associator ( glass3::util::iInput inputint,
glass3::util::iOutput outputint 
)

associator constructor

Parameterized constructor for the associator class, which: Initializes members to default values. Sets the interface pointers to other classes

Parameters
inputint- A glass3::util::iinput pointer to the input class.
outputint- A glass3::util::ioutput pointer to the output class.
glass3::process::Associator::~Associator ( )

associator destructor

The destructor for the associator class.

Member Function Documentation

void glass3::process::Associator::clear ( )
overridevirtual

associator clear function

The clear function for the associator class. Clears all configuration, clears and reallocates the message queue and glasscore instance

Reimplemented from glass3::util::BaseClass.

bool glass3::process::Associator::healthCheck ( )
overridevirtual

associator heath check function

Overrides ThreadBaseClass::healthCheck to add monitoring glasscore. Uses ThreadBaseClass::healthCheck to monitor worker thread

Returns
returns true if glasscore and worker thread are still running.

Reimplemented from glass3::util::ThreadBaseClass.

void glass3::process::Associator::recieveGlassMessage ( std::shared_ptr< json::Object >  communication)
overridevirtual

glasscore message receiver function

The function (from IGlassSend) used to receive communication from the glasscore library.

Parameters
communication- A shared_ptr a to json::Object containing the message from glasscore.

Implements glasscore::IGlassSend.

void glass3::process::Associator::sendToAssociator ( std::shared_ptr< json::Object > &  message)
overridevirtual

glasscore message sending function

The function (from iassociator) used to send communication to glasscore.

Parameters
message- A shared_ptr to a json::Object containing the message to send to the glasscore library.

Implements glass3::util::iAssociator.

bool glass3::process::Associator::setup ( std::shared_ptr< const json::Object >  config)
overridevirtual

Associator configuration function.

The this function configures the Associator class i.e. configures glasscore. The setup() function can be called multiple times, in order to reload or update configuration information.

Parameters
config- A shared_ptr to a json::Object containing to the configuration to pass to glasscore.
Returns
returns true if successful.

Reimplemented from glass3::util::BaseClass.

glass3::util::WorkState glass3::process::Associator::work ( )
overrideprotectedvirtual

associator work function

The function (from threadclassbase) used to do work. For Associator, this includes sending configuration, messages, and input data to the glasscore library

Returns
returns true if work was successful, false otherwise.

Implements glass3::util::ThreadBaseClass.


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