24#ifndef GOBY_MIDDLEWARE_IO_COBS_TCP_SERVER_H
25#define GOBY_MIDDLEWARE_IO_COBS_TCP_SERVER_H
32#include <boost/asio/ip/tcp.hpp>
33#include <boost/asio/read_until.hpp>
34#include <boost/asio/streambuf.hpp>
35#include <boost/system/error_code.hpp>
58template <
typename TCPServerThreadType>
62 TCPSessionCOBS(boost::asio::ip::tcp::socket socket, TCPServerThreadType& server)
67 template <
class Thread>
69 std::shared_ptr<const goby::middleware::protobuf::IOData> io_msg);
71 template <
class Thread,
class ThreadBase>
75 void async_read()
override
77 auto self(this->shared_from_this());
81 void async_write(std::shared_ptr<const goby::middleware::protobuf::IOData> io_msg)
override
87 boost::asio::streambuf buffer_;
98 bool use_indexed_groups =
false>
101 subscribe_layer, Config, ThreadType, use_indexed_groups>
104 subscribe_layer, Config, ThreadType, use_indexed_groups>;
110 void start_session(boost::asio::ip::tcp::socket tcp_socket)
112 std::make_shared<TCPSessionCOBS<Base>>(std::move(tcp_socket), *
this)->start();
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
Represents a thread of execution within the Goby middleware, interleaving periodic events (loop()) wi...
TCPServerThreadCOBS(const Config &config, int index=-1)
TCPSessionCOBS(boost::asio::ip::tcp::socket socket, TCPServerThreadType &server)
friend void cobs_async_write(Thread *this_thread, std::shared_ptr< const goby::middleware::protobuf::IOData > io_msg)
friend void cobs_async_read(Thread *this_thread, std::shared_ptr< ThreadBase > self)
TCPSession(boost::asio::ip::tcp::socket socket, TCPServerThreadType &server)
detail namespace with internal helper functions
Objects implementing the Goby nested middleware.
middleware::SimpleThread< Config, detail::InterProcessTag > SimpleThread
Zeromq-backed SimpleThread. Derives from middleware::SimpleThread using InterProcessTag.
The global namespace for the Goby project.