UMPS
The University of Utah Seismograph Stations Message Passing System.
UMPS::Modules::IModule Class Reference

This is a generic base class module. It will implement some, but not all, generic module activities. Of course, any and all routines can be overridden as necessary. More...

#include "umps/modules/module.hpp"

Public Member Functions

 IModule ()
 Constructor.
 
virtual void start ()
 Starts the threads handling the heartbeating and commands.
 
virtual void stop ()
 Stops the threads handling the heartbeating and commands.
 
bool keepRunning () const noexcept
 
void disconnect ()
 Disconnects from the status and.
 
virtual ~IModule ()
 Destructor.
 
IModuleoperator= (const IModule &)=delete
 
IModuleoperator= (IModule &&) noexcept=delete
 
 IModule (const IModule &)=delete
 
 IModule (IModule &&) noexcept=delete
 
Initialization
virtual void parseInitializationFile (const std::string &initializationFile)
 Parses an initialization file and extracts the uOperator information from the uOperator section, standard general module information from the module General section, and the heartbeat broadcast, and command information. Typical general items are the module name, verbosity, and log directory. Typical heartbeat properties are the heartbeat interval and, if necessary, the heartbeat broadcast name. More...
 
virtual void setName (const std::string &name)
 Sets the module's name.
 
virtual std::string getName () const noexcept
 
virtual void setOperatorAddress (const std::string &address)
 Sets the operator address. More...
 
virtual std::string getOperatorAddress () const
 
virtual bool haveOperatorAddress () const noexcept
 
virtual void setZAPOptions (const UMPS::Authentication::ZAPOptions &options) noexcept
 Sets the ZeroMQ authentication options. More...
 
virtual UMPS::Authentication::ZAPOptions getZAPOptions () const noexcept
 
virtual void setHeartbeatBroadcastName (const std::string &name)
 Sets the name of the heartbeat broadcast. More...
 
virtual std::string getHeartbeatBroadcastName () const noexcept
 
virtual void setHeartbeatInterval (const std::chrono::seconds &interval)
 Sets the interval between status messages in the heartbeat broadcast. More...
 
std::chrono::seconds getHeartbeatInterval () const noexcept
 
virtual void setVerbosity (UMPS::Logging::Level verbosity) noexcept
 Sets the module verbosity. More...
 
virtual UMPS::Logging::Level getVerbosity () const noexcept
 
virtual void setLogFileDirectory (const std::string &directory)
 Sets the log file directory. More...
 
virtual std::string getLogFileDirectory () const noexcept
 
virtual void setLogger (std::shared_ptr< UMPS::Logging::ILog > &logger)
 Sets the application's logger. More...
 
virtual std::shared_ptr< UMPS::Logging::ILoggetLogger () const noexcept
 
Connect
virtual void connect ()
 This will establish a connection to the. More...
 
virtual bool isConnected () const noexcept
 
std::shared_ptr< UMPS::Services::ConnectionInformation::RequestorgetConnectionInformationRequestor () const
 

Detailed Description

This is a generic base class module. It will implement some, but not all, generic module activities. Of course, any and all routines can be overridden as necessary.

Member Function Documentation

◆ connect()

virtual void UMPS::Modules::IModule::connect ( )
virtual

This will establish a connection to the.

Exceptions
std::runtime_errorif haveSetOperatorAddress() is false.
std::runtime_errorif there are issues connecting to uOperator.

◆ getConnectionInformationRequestor()

std::shared_ptr<UMPS::Services::ConnectionInformation::Requestor> UMPS::Modules::IModule::getConnectionInformationRequestor ( ) const
Returns
A pointer to the connection information requestor. From this, uOperator can be queried for other connection information.
Exceptions
std::runtime_errorif isConnected() is false.

◆ getHeartbeatBroadcastName()

virtual std::string UMPS::Modules::IModule::getHeartbeatBroadcastName ( ) const
virtualnoexcept
Returns
The name of the heartbeat broadcast. By default the broadcast is named Heartbeat and this will always be made available by the

◆ getHeartbeatInterval()

std::chrono::seconds UMPS::Modules::IModule::getHeartbeatInterval ( ) const
noexcept
Returns
The interval between status messages in the heartbeat broadcast.

◆ getLogFileDirectory()

virtual std::string UMPS::Modules::IModule::getLogFileDirectory ( ) const
virtualnoexcept
Returns
The log file directory. By default this will be /var/log/umps.

◆ getLogger()

virtual std::shared_ptr<UMPS::Logging::ILog> UMPS::Modules::IModule::getLogger ( ) const
virtualnoexcept
Returns
A pointer to the application's logger.
Note
By default this is a stdout logger.

◆ getName()

virtual std::string UMPS::Modules::IModule::getName ( ) const
virtualnoexcept
Returns
The module's name.

◆ getOperatorAddress()

virtual std::string UMPS::Modules::IModule::getOperatorAddress ( ) const
virtual
Returns
The operator address.
Exceptions
std::runtime_errorif the operator address was not set.

◆ getVerbosity()

virtual UMPS::Logging::Level UMPS::Modules::IModule::getVerbosity ( ) const
virtualnoexcept
Returns
The module's verbosity.

◆ getZAPOptions()

virtual UMPS::Authentication::ZAPOptions UMPS::Modules::IModule::getZAPOptions ( ) const
virtualnoexcept
Returns
The ZAP options.

◆ haveOperatorAddress()

virtual bool UMPS::Modules::IModule::haveOperatorAddress ( ) const
virtualnoexcept
Returns
True indicates the operator address was set.

◆ isConnected()

virtual bool UMPS::Modules::IModule::isConnected ( ) const
virtualnoexcept
Returns
True indicates that the uOperator connection is established.

◆ keepRunning()

bool UMPS::Modules::IModule::keepRunning ( ) const
noexcept
Returns
True indicates the modules should continue to run.

◆ parseInitializationFile()

virtual void UMPS::Modules::IModule::parseInitializationFile ( const std::string &  initializationFile)
virtual

Parses an initialization file and extracts the uOperator information from the uOperator section, standard general module information from the module General section, and the heartbeat broadcast, and command information. Typical general items are the module name, verbosity, and log directory. Typical heartbeat properties are the heartbeat interval and, if necessary, the heartbeat broadcast name.

Parameters
[in]initializationFileThe name of the initialization file.

◆ setHeartbeatBroadcastName()

virtual void UMPS::Modules::IModule::setHeartbeatBroadcastName ( const std::string &  name)
virtual

Sets the name of the heartbeat broadcast.

Parameters
[in]nameThe name of the heartbeat broadcast.
Exceptions
std::invalid_argumentif the name is empty.

◆ setHeartbeatInterval()

virtual void UMPS::Modules::IModule::setHeartbeatInterval ( const std::chrono::seconds &  interval)
virtual

Sets the interval between status messages in the heartbeat broadcast.

Parameters
[in]intervalThe interval in seconds. This must be positive.
Exceptions
std::invalid_argumentif the interval is not positive.

◆ setLogFileDirectory()

virtual void UMPS::Modules::IModule::setLogFileDirectory ( const std::string &  directory)
virtual

Sets the log file directory.

Parameters
[in]directoryThe file directory.
Exceptions
std::runtime_errorif the log file directory cannot be created.

◆ setLogger()

virtual void UMPS::Modules::IModule::setLogger ( std::shared_ptr< UMPS::Logging::ILog > &  logger)
virtual

Sets the application's logger.

Parameters
[in]loggerA pointer to the application's logger.

◆ setOperatorAddress()

virtual void UMPS::Modules::IModule::setOperatorAddress ( const std::string &  address)
virtual

Sets the operator address.

Parameters
[in]addressThe uOperator address - e.g., tcp://127.0.0.1:8080

◆ setVerbosity()

virtual void UMPS::Modules::IModule::setVerbosity ( UMPS::Logging::Level  verbosity)
virtualnoexcept

Sets the module verbosity.

Parameters
[in]verbosityThe logging leve.

◆ setZAPOptions()

virtual void UMPS::Modules::IModule::setZAPOptions ( const UMPS::Authentication::ZAPOptions options)
virtualnoexcept

Sets the ZeroMQ authentication options.

Parameters
[in]optionsThe ZAP options.

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