MADARA  3.2.3
BasicASIOTransport.h
Go to the documentation of this file.
1 #ifndef _MADARA_BASIC_ASIO_TRANSPORT_H_
2 #define _MADARA_BASIC_ASIO_TRANSPORT_H_
3 
4 #include <string>
5 
6 #include "madara/MadaraExport.h"
15 #include "madara/Boost.h"
16 
17 namespace madara
18 {
19  namespace transport
20  {
21  namespace asio = boost::asio;
22  namespace ip = boost::asio::ip;
24 
25  class MADARA_EXPORT BasicASIOTransport : public Base
26  {
27  public:
28  BasicASIOTransport (const std::string & id,
30  TransportSettings & config);
31 
32  ~BasicASIOTransport () = 0;
33 
34  void close () override;
35 
36  int setup () override;
37 
38  static const double default_read_hertz;
39 
40  protected:
41  virtual int setup_socket (udp::socket &socket);
42  virtual int setup_read_socket ();
43  virtual int setup_write_socket ();
44  virtual int setup_sockets ();
45 
46  virtual int setup_read_threads ();
47  virtual int setup_read_thread (double hertz, const std::string &name) = 0;
48 
51 
53  asio::io_service io_service_;
54 
57 
59  std::vector<udp::endpoint> addresses_;
60 
62  udp::socket socket_{io_service_};
63 
64  friend class UdpTransportReadThread;
66  };
67  }
68 }
69 
70 #endif
knowledge::KnowledgeBase knowledge_
knowledge base for threads to use
This class stores variables and their values for use by any entity needing state information in a thr...
Thread for reading knowledge updates through a Multicast datagram socket.
Holds basic transport settings.
static struct madara::knowledge::tags::string_t string
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
asio::io_service io_service_
Boost::ASIO IO context.
std::vector< udp::endpoint > addresses_
holds all multicast addresses we are sending to
Starts threads with first class support of MADARA contexts.
Definition: Threader.h:35
threads::Threader read_threads_
threads for reading knowledge updates
Copyright (c) 2015 Carnegie Mellon University.
Base class from which all transports must be derived.
Definition: Transport.h:45
Thread for reading knowledge updates through a UDP socket.
boost::asio::ip::udp udp