qnode.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef NODE_HPP_
13 #define NODE_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #ifndef Q_MOC_RUN
20 #include <ros/ros.h>
21 #endif
22 
23 #include <string>
24 #include <QThread>
25 #include <QStringListModel>
26 
27 /*****************************************************************************
28 ** Class
29 *****************************************************************************/
30 
31 class QNode : public QThread {
32 Q_OBJECT
33 
34 public:
35  QNode(int argc, char** argv, const std::string &name );
36  virtual ~QNode();
37 
38  bool on_init();
39  bool on_init(const std::string &master_url, const std::string &host_url);
40  void shutdown();
41  virtual void run() = 0;
42 
43  QStringListModel* loggingModel() { return &logging; }
44  const std::string& nodeName() { return node_name; }
45 
46 Q_SIGNALS:
47  void loggingUpdated();
48  void rosShutdown();
49 
50 protected:
51  virtual void ros_comms_init() = 0;
52  int init_argc;
53  char** init_argv;
54  QStringListModel logging;
55  const std::string node_name;
56 };
57 
58 #endif /* NODE_HPP_ */
QNode(int argc, char **argv, const std::string &name)
Definition: qnode.cpp:24
QStringListModel logging
Definition: qnode.hpp:54
virtual void run()=0
void rosShutdown()
virtual void ros_comms_init()=0
void loggingUpdated()
QStringListModel * loggingModel()
Definition: qnode.hpp:43
const std::string node_name
Definition: qnode.hpp:55
bool on_init()
Definition: qnode.cpp:45
virtual ~QNode()
Definition: qnode.cpp:30
char ** init_argv
Definition: qnode.hpp:53
void shutdown()
Definition: qnode.cpp:37
Definition: qnode.hpp:31
const std::string & nodeName()
Definition: qnode.hpp:44
int init_argc
Definition: qnode.hpp:52


qt_tutorials
Author(s): Daniel Stonier
autogenerated on Wed Mar 11 2020 03:12:20