UMPS
The University of Utah Seismograph Stations Message Passing System.
processManager.hpp
1 #ifndef UMPS_MODULES_PROCESSMANAGER_HPP
2 #define UMPS_MODULES_PROCESSMANAGER_HPP
3 #include <memory>
4 namespace UMPS
5 {
6  namespace Logging
7  {
8  class ILog;
9  }
10  namespace Modules
11  {
12  class IProcess;
13  }
14 }
15 namespace UMPS::Modules
16 {
23 {
24 public:
27 
32  explicit ProcessManager(std::shared_ptr<UMPS::Logging::ILog> &logger);
34 
41  void insert(std::unique_ptr<IProcess> &&process);
44  [[nodiscard]] bool contains(const IProcess &process) const noexcept;
46  [[nodiscard]] bool contains(const std::string &name) const noexcept;
47 
49  void start();
53  [[nodiscard]] bool isRunning() const noexcept;
55  void stop();
56 
59 
63 
64  ProcessManager(const ProcessManager &) = delete;
65  ProcessManager& operator=(const ProcessManager &) = delete;
66 private:
67  class ProcessManagerImpl;
68  std::unique_ptr<ProcessManagerImpl> pImpl;
69 };
70 }
71 #endif
A module is typically comprised of multiple processes. This defines the essential qualities that cons...
Definition: process.hpp:13
This is a collection of processes. By adding processes to this module, all processes can be started a...
Definition: processManager.hpp:23
void start()
Attempts to start all processes.
void handleMainThread()
The main thread waits until a stop command is issued by a process.
void stop()
Attempts to stop all processes.
bool contains(const IProcess &process) const noexcept
bool isRunning() const noexcept
bool contains(const std::string &name) const noexcept
ProcessManager(std::shared_ptr< UMPS::Logging::ILog > &logger)
Constructs a process manager with a given logger.
void insert(std::unique_ptr< IProcess > &&process)
Adds a process to the manager.