Goby3  3.1.4
2024.02.22
goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups > Class Template Referenceabstract

#include <goby/middleware/io/detail/io_interface.h>

Inheritance diagram for goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >:
goby::middleware::io::detail::IOPublishTransporter< IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, false >, line_in_group, publish_layer, false > goby::middleware::io::detail::IOSubscribeTransporter< IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, false >, line_out_group, subscribe_layer, false >

Public Member Functions

 IOThread (const IOConfig &config, int index, std::string glog_group="i/o")
 Constructs the thread. More...
 
void initialize () override
 
void finalize () override
 
virtual ~IOThread ()
 

Protected Member Functions

void write (std::shared_ptr< const goby::middleware::protobuf::IOData > io_msg)
 
void handle_read_success (std::size_t bytes_transferred, const std::string &bytes)
 
void handle_read_success (std::size_t bytes_transferred, std::shared_ptr< goby::middleware::protobuf::IOData > io_msg)
 
void handle_write_success (std::size_t bytes_transferred)
 
void handle_read_error (const boost::system::error_code &ec)
 
void handle_write_error (const boost::system::error_code &ec)
 
SocketType & mutable_socket ()
 Access the (mutable) socket (or serial_port) object. More...
 
boost::asio::io_contextmutable_io ()
 
bool socket_is_open ()
 Does the socket exist and is it open? More...
 
virtual void open_socket ()=0
 Opens the newly created socket/serial_port. More...
 
virtual void async_read ()=0
 Starts an asynchronous read on the socket. More...
 
virtual void async_write (std::shared_ptr< const goby::middleware::protobuf::IOData > io_msg)=0
 Starts an asynchronous write from data published. More...
 
const std::string & glog_group ()
 

Friends

template<class IOThreadImplementation >
void basic_async_write (IOThreadImplementation *this_thread, std::shared_ptr< const goby::middleware::protobuf::IOData > io_msg)
 

Detailed Description

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig, typename SocketType, template< class > class ThreadType, bool use_indexed_groups = false>
class goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >

Definition at line 79 of file io_interface.h.

Constructor & Destructor Documentation

◆ IOThread()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::IOThread ( const IOConfig &  config,
int  index,
std::string  glog_group = "i/o" 
)
inline

Constructs the thread.

Parameters
configA reference to the configuration read by the main application at launch
indexThread index for multiple instances in a given application (-1 indicates a single instance)
glog_groupString name for group to use for glog

Definition at line 94 of file io_interface.h.

◆ ~IOThread()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
virtual goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::~IOThread ( )
inlinevirtual

Definition at line 151 of file io_interface.h.

Member Function Documentation

◆ async_read()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
virtual void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::async_read ( )
protectedpure virtual

◆ async_write()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
virtual void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::async_write ( std::shared_ptr< const goby::middleware::protobuf::IOData io_msg)
protectedpure virtual

◆ finalize()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::finalize ( )
inlineoverride

Definition at line 140 of file io_interface.h.

◆ glog_group()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
const std::string& goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::glog_group ( )
inlineprotected

Definition at line 234 of file io_interface.h.

◆ handle_read_error()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, goby::middleware::io::PubSubLayer publish_layer, goby::middleware::io::PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::handle_read_error ( const boost::system::error_code &  ec)
protected

Definition at line 389 of file io_interface.h.

◆ handle_read_success() [1/2]

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::handle_read_success ( std::size_t  bytes_transferred,
const std::string &  bytes 
)
inlineprotected

Definition at line 185 of file io_interface.h.

◆ handle_read_success() [2/2]

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::handle_read_success ( std::size_t  bytes_transferred,
std::shared_ptr< goby::middleware::protobuf::IOData io_msg 
)
inlineprotected

Definition at line 193 of file io_interface.h.

◆ handle_write_error()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, goby::middleware::io::PubSubLayer publish_layer, goby::middleware::io::PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::handle_write_error ( const boost::system::error_code &  ec)
protected

Definition at line 415 of file io_interface.h.

◆ handle_write_success()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::handle_write_success ( std::size_t  bytes_transferred)
inlineprotected

Definition at line 207 of file io_interface.h.

◆ initialize()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::initialize ( )
inlineoverride

Definition at line 124 of file io_interface.h.

◆ mutable_io()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
boost::asio::io_context& goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::mutable_io ( )
inlineprotected

Definition at line 220 of file io_interface.h.

◆ mutable_socket()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
SocketType& goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::mutable_socket ( )
inlineprotected

Access the (mutable) socket (or serial_port) object.

Definition at line 212 of file io_interface.h.

◆ open_socket()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
virtual void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::open_socket ( )
protectedpure virtual

Opens the newly created socket/serial_port.

◆ socket_is_open()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
bool goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::socket_is_open ( )
inlineprotected

Does the socket exist and is it open?

Definition at line 223 of file io_interface.h.

◆ write()

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
void goby::middleware::io::detail::IOThread< line_in_group, line_out_group, publish_layer, subscribe_layer, IOConfig, SocketType, ThreadType, use_indexed_groups >::write ( std::shared_ptr< const goby::middleware::protobuf::IOData io_msg)
inlineprotected

Definition at line 171 of file io_interface.h.

Friends And Related Function Documentation

◆ basic_async_write

template<const goby::middleware::Group & line_in_group, const goby::middleware::Group & line_out_group, PubSubLayer publish_layer, PubSubLayer subscribe_layer, typename IOConfig , typename SocketType , template< class > class ThreadType, bool use_indexed_groups = false>
template<class IOThreadImplementation >
void basic_async_write ( IOThreadImplementation *  this_thread,
std::shared_ptr< const goby::middleware::protobuf::IOData io_msg 
)
friend

Definition at line 261 of file io_interface.h.


The documentation for this class was generated from the following file: