Fawkes API  Fawkes Development Version
gex_receiver_thread.h
1 
2 /***************************************************************************
3  * gex_receiver_thread.h - Gossip Example Plugin - Receiver
4  *
5  * Created: Thu Mar 06 10:39:53 2014
6  * Copyright 2006-2014 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef _PLUGINS_GOSSIP_EXAMPLE_GEX_RECEIVER_THREAD_H_
23 #define _PLUGINS_GOSSIP_EXAMPLE_GEX_RECEIVER_THREAD_H_
24 
25 #include <aspect/blocked_timing.h>
26 #include <aspect/clock.h>
27 #include <aspect/logging.h>
28 #include <core/threading/thread.h>
29 #include <plugins/gossip/aspect/gossip.h>
30 #include <plugins/gossip/gossip/gossip_group.h>
31 
33  public fawkes::ClockAspect,
34  public fawkes::LoggingAspect,
37 {
38 public:
41 
42  virtual void init();
43  virtual void loop();
44  virtual void finalize();
45 
46  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
47 protected:
48  virtual void
49  run()
50  {
51  Thread::run();
52  }
53 
54 private:
55  void handle_peer_msg(boost::asio::ip::udp::endpoint & endpoint,
56  uint16_t component_id,
57  uint16_t msg_type,
58  std::shared_ptr<google::protobuf::Message> msg);
59  void handle_peer_recv_error(boost::asio::ip::udp::endpoint &endpoint, std::string msg);
60  void handle_peer_send_error(std::string msg);
61 
62 private:
63  boost::signals2::connection sig_rcvd_conn_;
64  boost::signals2::connection sig_recv_error_conn_;
65  boost::signals2::connection sig_send_error_conn_;
66 };
67 
68 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:33
virtual void loop()
Code to execute in the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:45
Thread aspect to communicate with a group of robots.
Definition: gossip.h:37
virtual void init()
Initialize the thread.
virtual ~GossipExampleReceiverThread()
Destructor.
Thread aspect to use blocked timing.
Thread aspect to log output.
Definition: logging.h:32
Gossip Example Plugin Thread - Receiver.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void finalize()
Finalize the thread.