qnode.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef NODE_HPP_
00013 #define NODE_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #ifndef Q_MOC_RUN
00020 #include <ros/ros.h>
00021 #endif
00022 
00023 #include <string>
00024 #include <QThread>
00025 #include <QStringListModel>
00026 
00027 /*****************************************************************************
00028 ** Class
00029 *****************************************************************************/
00030 
00031 class QNode : public QThread {
00032 Q_OBJECT
00033 
00034 public:
00035         QNode(int argc, char** argv, const std::string &name );
00036         virtual ~QNode();
00037 
00038         bool on_init();
00039         bool on_init(const std::string &master_url, const std::string &host_url);
00040         void shutdown();
00041         virtual void run() = 0;
00042 
00043         QStringListModel* loggingModel() { return &logging; }
00044         const std::string& nodeName() { return node_name; }
00045 
00046 Q_SIGNALS:
00047         void loggingUpdated();
00048         void rosShutdown();
00049 
00050 protected:
00051         virtual void ros_comms_init() = 0;
00052         int init_argc;
00053         char** init_argv;
00054     QStringListModel logging;
00055     const std::string node_name;
00056 };
00057 
00058 #endif /* NODE_HPP_ */


qt_tutorials
Author(s): Daniel Stonier
autogenerated on Fri Aug 28 2015 12:16:20