UMPS
The University of Utah Seismograph Stations Message Passing System.
module.hpp
1 #ifndef UMPS_MODULES_MODULE_HPP
2 #define UMPS_MODULES_MODULE_HPP
3 #include <memory>
4 #include <chrono>
5 #include "umps/logging/level.hpp"
6 namespace UMPS
7 {
8  namespace Authentication
9  {
10  class ZAPOptions;
11  }
12  namespace Services
13  {
14  namespace ConnectionInformation
15  {
16  class Requestor;
17  }
18  }
19  namespace Logging
20  {
21  class ILog;
22  }
23  namespace Modules
24  {
25  class IProcess;
26  }
27 }
28 namespace UMPS::Modules
29 {
36 class IModule
37 {
38 public:
41 
44 
54  virtual void parseInitializationFile(const std::string &initializationFile);
55 
57  virtual void setName(const std::string &name);
59  virtual std::string getName() const noexcept;
60 
63  virtual void setOperatorAddress(const std::string &address);
66  [[nodiscard]] virtual std::string getOperatorAddress() const;
68  [[nodiscard]] virtual bool haveOperatorAddress() const noexcept;
69 
72  virtual void setZAPOptions(const UMPS::Authentication::ZAPOptions &options) noexcept;
74  [[nodiscard]] virtual UMPS::Authentication::ZAPOptions getZAPOptions() const noexcept;
75 
79  virtual void setHeartbeatBroadcastName(const std::string &name);
83  [[nodiscard]] virtual std::string getHeartbeatBroadcastName() const noexcept;
84 
89  virtual void setHeartbeatInterval(const std::chrono::seconds &interval);
91  [[nodiscard]] std::chrono::seconds getHeartbeatInterval() const noexcept;
92 
95  virtual void setVerbosity(UMPS::Logging::Level verbosity) noexcept;
97  [[nodiscard]] virtual UMPS::Logging::Level getVerbosity() const noexcept;
98 
102  virtual void setLogFileDirectory(const std::string &directory);
104  [[nodiscard]] virtual std::string getLogFileDirectory() const noexcept;
105 
108  virtual void setLogger(std::shared_ptr<UMPS::Logging::ILog> &logger);
111  [[nodiscard]] virtual std::shared_ptr<UMPS::Logging::ILog> getLogger() const noexcept;
113 
114 
117 
121  virtual void connect();
123  [[nodiscard]] virtual bool isConnected() const noexcept;
124 
129  [[nodiscard]] std::shared_ptr<UMPS::Services::ConnectionInformation::Requestor> getConnectionInformationRequestor() const;
130 
132 
134  virtual void start();
136  virtual void stop();
138  [[nodiscard]] bool keepRunning() const noexcept;
139  //void sendStatus( );
141  void disconnect();
142 
143 
145  virtual ~IModule();
146 
147  IModule& operator=(const IModule &) = delete;
148  IModule& operator=(IModule &&) noexcept = delete;
149  IModule(const IModule &) = delete;
150  IModule(IModule &&) noexcept = delete;
151 private:
152  class IModuleImpl;
153  std::unique_ptr<IModuleImpl> pImpl;
154 };
155 }
156 #endif
Defines the logging level.
This is a generic base class module. It will implement some, but not all, generic module activities....
Definition: module.hpp:37
virtual void setHeartbeatBroadcastName(const std::string &name)
Sets the name of the heartbeat broadcast.
virtual void setLogger(std::shared_ptr< UMPS::Logging::ILog > &logger)
Sets the application's logger.
virtual void setName(const std::string &name)
Sets the module's name.
virtual bool haveOperatorAddress() const noexcept
virtual void setLogFileDirectory(const std::string &directory)
Sets the log file directory.
virtual std::string getLogFileDirectory() const noexcept
virtual void connect()
This will establish a connection to the.
virtual void start()
Starts the threads handling the heartbeating and commands.
virtual void stop()
Stops the threads handling the heartbeating and commands.
std::shared_ptr< UMPS::Services::ConnectionInformation::Requestor > getConnectionInformationRequestor() const
std::chrono::seconds getHeartbeatInterval() const noexcept
virtual std::string getHeartbeatBroadcastName() const noexcept
virtual void parseInitializationFile(const std::string &initializationFile)
Parses an initialization file and extracts the uOperator information from the uOperator section,...
virtual std::string getName() const noexcept
void disconnect()
Disconnects from the status and.
virtual void setZAPOptions(const UMPS::Authentication::ZAPOptions &options) noexcept
Sets the ZeroMQ authentication options.
virtual bool isConnected() const noexcept
IModule()
Constructor.
virtual std::string getOperatorAddress() const
virtual UMPS::Authentication::ZAPOptions getZAPOptions() const noexcept
virtual void setOperatorAddress(const std::string &address)
Sets the operator address.
virtual UMPS::Logging::Level getVerbosity() const noexcept
virtual std::shared_ptr< UMPS::Logging::ILog > getLogger() const noexcept
virtual void setVerbosity(UMPS::Logging::Level verbosity) noexcept
Sets the module verbosity.
virtual void setHeartbeatInterval(const std::chrono::seconds &interval)
Sets the interval between status messages in the heartbeat broadcast.
bool keepRunning() const noexcept