monitor.h
Go to the documentation of this file.
1 // Monitors execution of a launch file
2 // Author: Max Schwarz <max.schwarz@uni-bonn.de>
3 
4 #ifndef ROSMON_MONITOR_MONITOR_H
5 #define ROSMON_MONITOR_MONITOR_H
6 
7 #include "../fd_watcher.h"
8 #include "../launch/launch_config.h"
9 
10 #include "node_monitor.h"
11 #include "linux_process_info.h"
12 
13 #include <boost/signals2.hpp>
14 
15 #include <ros/node_handle.h>
16 
17 namespace rosmon
18 {
19 
20 namespace monitor
21 {
22 
23 class Monitor
24 {
25 public:
26 public:
28 
29  void setParameters();
30  void start();
31  void shutdown();
32  void forceExit();
33  bool allShutdown();
34 
35  double shutdownTimeout();
36 
37  inline bool ok() const
38  { return m_ok; }
39 
40  const std::vector<NodeMonitor::Ptr>& nodes() const
41  { return m_nodes; }
42  std::vector<NodeMonitor::Ptr>& nodes()
43  { return m_nodes; }
44 
46  { return m_config; }
47 
48  boost::signals2::signal<void(std::string,std::string)> logMessageSignal;
49 private:
50  struct ProcessInfo
51  {
53  bool active;
54  };
55 
56  template<typename... Args>
57  void log(const char* fmt, const Args& ... args);
58 
59  void handleRequiredNodeExit(const std::string& name);
60 
61  void updateStats();
62 
64 
67 
68  std::vector<NodeMonitor::Ptr> m_nodes;
69 
70  bool m_ok;
71 
72 #if HAVE_STEADYTIMER
74 #else
76 #endif
77 
78  std::map<int, ProcessInfo> m_processInfos;
79 };
80 
81 }
82 
83 }
84 
85 #endif
ros::WallTimer m_statTimer
Definition: monitor.h:75
const std::vector< NodeMonitor::Ptr > & nodes() const
Definition: monitor.h:40
std::map< int, ProcessInfo > m_processInfos
Definition: monitor.h:78
process_info::ProcessStat stat
Definition: monitor.h:52
std::vector< NodeMonitor::Ptr > & nodes()
Definition: monitor.h:42
boost::signals2::signal< void(std::string, std::string)> logMessageSignal
Definition: monitor.h:48
std::vector< NodeMonitor::Ptr > m_nodes
Definition: monitor.h:68
Monitor(launch::LaunchConfig::ConstPtr config, FDWatcher::Ptr watcher)
Definition: monitor.cpp:35
bool ok() const
Definition: monitor.h:37
ros::NodeHandle m_nh
Definition: monitor.h:65
FDWatcher::Ptr m_fdWatcher
Definition: monitor.h:66
std::shared_ptr< const LaunchConfig > ConstPtr
launch::LaunchConfig::ConstPtr config() const
Definition: monitor.h:45
void handleRequiredNodeExit(const std::string &name)
Definition: monitor.cpp:150
launch::LaunchConfig::ConstPtr m_config
Definition: monitor.h:63
void log(const char *fmt, const Args &...args)
Definition: monitor.cpp:157


rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Jul 10 2019 03:10:12