node.h
Go to the documentation of this file.
1 // Launch configuration for a single Node
2 // Author: Max Schwarz <max.schwarz@uni-bonn.de>
3 
4 #ifndef ROSMON_LAUNCH_NODE_H
5 #define ROSMON_LAUNCH_NODE_H
6 
7 #include <string>
8 #include <map>
9 #include <memory>
10 #include <vector>
11 
12 #include <ros/time.h>
13 
14 namespace rosmon
15 {
16 
17 namespace launch
18 {
19 
20 class Node
21 {
22 public:
23  typedef std::shared_ptr<Node> Ptr;
24  typedef std::shared_ptr<const Node> ConstPtr;
25 
26  Node(std::string name, std::string package, std::string type);
27 
28  void setRemappings(const std::map<std::string, std::string>& remappings);
29  void addExtraArguments(const std::string& argString);
30  void setNamespace(const std::string& ns);
31  void setExtraEnvironment(const std::map<std::string, std::string>& env);
32  void setCoredumpsEnabled(bool on);
33 
34  void setRespawn(bool respawn);
38 
39  void setLaunchPrefix(const std::string& launchPrefix);
40 
41  void setWorkingDirectory(const std::string& workingDirectory);
42 
43  void setClearParams(bool on);
44 
45  void setStopTimeout(double timeout);
46 
47  void setMemoryLimit(uint64_t memoryLimitByte);
48 
49  void setCPULimit(double cpuLimit);
50 
51  void setMuted(bool muted);
52  void setStdoutDisplayed(bool showStdout);
53 
54  std::string name() const
55  { return m_name; }
56 
57  std::string package() const
58  { return m_package; }
59 
60  std::string type() const
61  { return m_type; }
62 
63  std::string executable() const
64  { return m_executable; }
65 
66  std::string namespaceString() const
67  { return m_namespace; }
68 
69  std::map<std::string, std::string> remappings() const
70  { return m_remappings; }
71 
72  std::vector<std::string> extraArguments() const
73  { return m_extraArgs; }
74 
75  std::map<std::string, std::string> extraEnvironment() const
76  { return m_extraEnvironment; }
77 
78  bool respawn() const
79  { return m_respawn; }
80 
82  { return m_respawnDelay; }
83 
84  int numRespawnsAllowed() const
85  { return m_numRespawnsAllowed; }
86 
88  { return m_spawnDelay; }
89 
90  void setRequired(bool required);
91 
92  bool required() const
93  { return m_required; }
94 
95  std::vector<std::string> launchPrefix() const
96  { return m_launchPrefix; }
97 
98  bool coredumpsEnabled() const
99  { return m_coredumpsEnabled; }
100 
101  std::string workingDirectory() const
102  { return m_workingDirectory; }
103 
104  bool clearParams() const
105  { return m_clearParams; }
106 
107  double stopTimeout() const
108  { return m_stopTimeout; }
109 
110  uint64_t memoryLimitByte() const
111  { return m_memoryLimitByte;}
112 
113  double cpuLimit() const
114  { return m_cpuLimit; }
115 
116  bool isMuted() const
117  { return m_muted; }
118 
119  bool stdoutDisplayed() const
120  { return m_stdoutDisplayed; }
121 private:
122  std::string m_name;
123  std::string m_package;
124  std::string m_type;
125 
126  std::string m_executable;
127 
128  std::string m_namespace;
129 
130  std::map<std::string, std::string> m_remappings;
131  std::vector<std::string> m_extraArgs;
132 
133  std::map<std::string, std::string> m_extraEnvironment;
134 
135  bool m_respawn;
137  int m_numRespawnsAllowed = 0; // Will warn on any respawn by default
139 
141 
142  std::vector<std::string> m_launchPrefix;
143 
145 
146  std::string m_workingDirectory;
147 
149 
151 
153  double m_cpuLimit;
154 
155  bool m_muted;
157 };
158 
159 }
160 
161 }
162 
163 #endif
Node(std::string name, std::string package, std::string type)
Definition: node.cpp:28
std::shared_ptr< const Node > ConstPtr
Definition: node.h:24
std::string package() const
Definition: node.h:57
std::string m_name
Definition: node.h:122
std::string name() const
Definition: node.h:54
void setCPULimit(double cpuLimit)
Definition: node.cpp:165
std::string m_type
Definition: node.h:124
void setCoredumpsEnabled(bool on)
Definition: node.cpp:140
int numRespawnsAllowed() const
Definition: node.h:84
std::string m_namespace
Definition: node.h:128
std::map< std::string, std::string > m_remappings
Definition: node.h:130
std::shared_ptr< Node > Ptr
Definition: node.h:23
void setNumRespawnsAllowed(int numRespawnsAllowed)
Definition: node.cpp:105
std::string m_executable
Definition: node.h:126
std::string namespaceString() const
Definition: node.h:66
void setStopTimeout(double timeout)
Definition: node.cpp:155
std::map< std::string, std::string > m_extraEnvironment
Definition: node.h:133
bool stdoutDisplayed() const
Definition: node.h:119
int m_numRespawnsAllowed
Definition: node.h:137
void setMemoryLimit(uint64_t memoryLimitByte)
Definition: node.cpp:160
std::string m_workingDirectory
Definition: node.h:146
bool respawn() const
Definition: node.h:78
bool clearParams() const
Definition: node.h:104
bool required() const
Definition: node.h:92
ros::WallDuration m_respawnDelay
Definition: node.h:136
std::string type() const
Definition: node.h:60
void setLaunchPrefix(const std::string &launchPrefix)
Definition: node.cpp:115
void setMuted(bool muted)
Definition: node.cpp:170
std::string workingDirectory() const
Definition: node.h:101
bool m_clearParams
Definition: node.h:148
void setRemappings(const std::map< std::string, std::string > &remappings)
Definition: node.cpp:50
void setRequired(bool required)
Definition: node.cpp:90
std::string executable() const
Definition: node.h:63
std::map< std::string, std::string > remappings() const
Definition: node.h:69
bool m_stdoutDisplayed
Definition: node.h:156
void setStdoutDisplayed(bool showStdout)
Definition: node.cpp:175
bool m_coredumpsEnabled
Definition: node.h:144
std::string env(const std::string &name)
void setClearParams(bool on)
Definition: node.cpp:150
ros::WallDuration spawnDelay() const
Definition: node.h:87
double cpuLimit() const
Definition: node.h:113
std::vector< std::string > m_extraArgs
Definition: node.h:131
bool isMuted() const
Definition: node.h:116
void addExtraArguments(const std::string &argString)
Definition: node.cpp:55
bool coredumpsEnabled() const
Definition: node.h:98
std::string m_package
Definition: node.h:123
ros::WallDuration m_spawnDelay
Definition: node.h:138
double m_cpuLimit
Definition: node.h:153
std::vector< std::string > launchPrefix() const
Definition: node.h:95
ros::WallDuration respawnDelay() const
Definition: node.h:81
uint64_t m_memoryLimitByte
Definition: node.h:152
std::map< std::string, std::string > extraEnvironment() const
Definition: node.h:75
uint64_t memoryLimitByte() const
Definition: node.h:110
double stopTimeout() const
Definition: node.h:107
void setExtraEnvironment(const std::map< std::string, std::string > &env)
Definition: node.cpp:85
void setWorkingDirectory(const std::string &workingDirectory)
Definition: node.cpp:145
void setSpawnDelay(const ros::WallDuration &spawnDelay)
Definition: node.cpp:110
void setNamespace(const std::string &ns)
Definition: node.cpp:80
void setRespawn(bool respawn)
Definition: node.cpp:95
std::vector< std::string > m_launchPrefix
Definition: node.h:142
std::vector< std::string > extraArguments() const
Definition: node.h:72
double m_stopTimeout
Definition: node.h:150
void setRespawnDelay(const ros::WallDuration &respawnDelay)
Definition: node.cpp:100


rosmon_core
Author(s): Max Schwarz
autogenerated on Fri Jun 16 2023 02:15:06