Thunderbots Project
Loading...
Searching...
No Matches
threaded_proto_udp_sender.hpp
1#pragma once
2
3#include <boost/asio.hpp>
4#include <boost/bind.hpp>
5#include <optional>
6#include <string>
7
8#include "software/networking/udp/threaded_udp_sender.h"
9
10template <class SendProto>
12{
13 public:
30 ThreadedProtoUdpSender(const std::string& ip_address, unsigned short port,
31 const std::string& interface, bool multicast);
32
38 std::string getInterface() const;
39
45 std::string getIpAddress() const;
46
55 void sendProto(const SendProto& message, bool async = false);
56
57
58 private:
59 std::string data_buffer;
60};
61
62template <class SendProto>
64 unsigned short port,
65 const std::string& interface,
66 bool multicast)
67 : ThreadedUdpSender(ip_address, port, interface, multicast)
68{
69}
70
71template <class SendProto>
76
77template <class SendProto>
82
83template <class SendProto>
84void ThreadedProtoUdpSender<SendProto>::sendProto(const SendProto& message, bool async)
85{
86 message.SerializeToString(&data_buffer);
87 sendString(data_buffer, async);
88}
Definition threaded_proto_udp_sender.hpp:12
std::string getIpAddress() const
Definition threaded_proto_udp_sender.hpp:78
void sendProto(const SendProto &message, bool async=false)
Definition threaded_proto_udp_sender.hpp:84
ThreadedProtoUdpSender(const std::string &ip_address, unsigned short port, const std::string &interface, bool multicast)
Definition threaded_proto_udp_sender.hpp:63
std::string getInterface() const
Definition threaded_proto_udp_sender.hpp:72
Definition threaded_udp_sender.h:10
std::string getIpAddress() const
Definition threaded_udp_sender.cpp:31
std::string getInterface() const
Definition threaded_udp_sender.cpp:26