Thunderbots Project
Loading...
Searching...
No Matches
threaded_proto_unix_sender.hpp
1#pragma once
2
3#include <boost/asio.hpp>
4#include <boost/bind.hpp>
5#include <string>
6
7#include "software/networking/unix/threaded_unix_sender.h"
8
9template <class SendProto>
11{
12 public:
18 ThreadedProtoUnixSender(const std::string& unix_path,
19 const std::shared_ptr<ProtoLogger>& proto_logger = nullptr)
20 : ThreadedUnixSender(unix_path), proto_logger(proto_logger)
21 {
22 }
23
30 void sendProto(const SendProto& message);
31
32 private:
33 std::string data_buffer;
34
35 std::shared_ptr<ProtoLogger> proto_logger;
36};
37
38template <class SendProtoT>
40{
41 message.SerializeToString(&data_buffer);
42 sendString(data_buffer);
43
44 if (proto_logger)
45 {
46 proto_logger->saveSerializedProto<SendProtoT>(data_buffer);
47 }
48}
Definition threaded_proto_unix_sender.hpp:11
void sendProto(const SendProto &message)
Definition threaded_proto_unix_sender.hpp:39
ThreadedProtoUnixSender(const std::string &unix_path, const std::shared_ptr< ProtoLogger > &proto_logger=nullptr)
Definition threaded_proto_unix_sender.hpp:18
Definition threaded_unix_sender.h:10