CARLA
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
carla::multigpu::Secondary Class Reference

#include <secondary.h>

+ Inheritance diagram for carla::multigpu::Secondary:
+ Collaboration diagram for carla::multigpu::Secondary:

Public Types

using endpoint = boost::asio::ip::tcp::endpoint
 
using protocol_type = endpoint::protocol_type
 

Public Member Functions

void AsyncRun (size_t worker_threads)
 
void Connect ()
 
SecondaryCommandsGetCommander ()
 
 Secondary (boost::asio::ip::tcp::endpoint ep, SecondaryCommands::callback_type callback)
 
 Secondary (std::string ip, uint16_t port, SecondaryCommands::callback_type callback)
 
void Stop ()
 
void Write (std::shared_ptr< const carla::streaming::detail::tcp::Message > message)
 
void Write (Buffer buffer)
 
void Write (std::string text)
 
 ~Secondary ()
 

Static Public Member Functions

template<typename... Buffers>
static auto MakeMessage (Buffers... buffers)
 

Private Member Functions

void ReadData ()
 
void Reconnect ()
 
- Private Member Functions inherited from carla::profiler::LifetimeProfiled
 LifetimeProfiled ()=default
 
- Private Member Functions inherited from carla::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=delete
 

Private Attributes

std::shared_ptr< BufferPool_buffer_pool
 
SecondaryCommands _commander
 
boost::asio::deadline_timer _connection_timer
 
std::atomic_bool _done {false}
 
boost::asio::ip::tcp::endpoint _endpoint
 
ThreadPool _pool
 
boost::asio::ip::tcp::socket _socket
 
boost::asio::io_context::strand _strand
 

Detailed Description

Definition at line 34 of file secondary.h.

Member Typedef Documentation

◆ endpoint

using carla::multigpu::Secondary::endpoint = boost::asio::ip::tcp::endpoint

Definition at line 40 of file secondary.h.

◆ protocol_type

using carla::multigpu::Secondary::protocol_type = endpoint::protocol_type

Definition at line 41 of file secondary.h.

Constructor & Destructor Documentation

◆ Secondary() [1/2]

carla::multigpu::Secondary::Secondary ( boost::asio::ip::tcp::endpoint  ep,
SecondaryCommands::callback_type  callback 
)

Definition at line 27 of file secondary.cpp.

References _commander, and carla::multigpu::SecondaryCommands::set_callback().

+ Here is the call graph for this function:

◆ Secondary() [2/2]

carla::multigpu::Secondary::Secondary ( std::string  ip,
uint16_t  port,
SecondaryCommands::callback_type  callback 
)

Definition at line 41 of file secondary.cpp.

References _commander, _endpoint, and carla::multigpu::SecondaryCommands::set_callback().

+ Here is the call graph for this function:

◆ ~Secondary()

carla::multigpu::Secondary::~Secondary ( )

Definition at line 56 of file secondary.cpp.

References _pool, and carla::ThreadPool::Stop().

+ Here is the call graph for this function:

Member Function Documentation

◆ AsyncRun()

void carla::multigpu::Secondary::AsyncRun ( size_t  worker_threads)

Definition at line 130 of file secondary.cpp.

References _pool, and carla::ThreadPool::AsyncRun().

Referenced by Connect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Connect()

void carla::multigpu::Secondary::Connect ( )

Definition at line 60 of file secondary.cpp.

References _commander, _strand, AsyncRun(), carla::log_error(), carla::log_info(), and carla::multigpu::SecondaryCommands::set_secondary().

+ Here is the call graph for this function:

◆ GetCommander()

SecondaryCommands& carla::multigpu::Secondary::GetCommander ( )
inline

Definition at line 57 of file secondary.h.

References _commander.

◆ MakeMessage()

template<typename... Buffers>
static auto carla::multigpu::Secondary::MakeMessage ( Buffers...  buffers)
inlinestatic

Definition at line 62 of file secondary.h.

References ReadData(), and Reconnect().

Referenced by Write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadData()

void carla::multigpu::Secondary::ReadData ( )
private

Definition at line 224 of file secondary.cpp.

References _strand, DEBUG_ASSERT_EQ, DEBUG_ASSERT_NE, DEBUG_ONLY, and carla::log_error().

Referenced by MakeMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Reconnect()

void carla::multigpu::Secondary::Reconnect ( )
private

Definition at line 118 of file secondary.cpp.

References _connection_timer, and carla::time_duration::seconds().

Referenced by MakeMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Stop()

void carla::multigpu::Secondary::Stop ( void  )

Definition at line 105 of file secondary.cpp.

References _connection_timer, and _strand.

◆ Write() [1/3]

void carla::multigpu::Secondary::Write ( std::shared_ptr< const carla::streaming::detail::tcp::Message message)

Definition at line 134 of file secondary.cpp.

References _strand, DEBUG_ASSERT, DEBUG_ONLY, and carla::log_error().

+ Here is the call graph for this function:

◆ Write() [2/3]

void carla::multigpu::Secondary::Write ( Buffer  buffer)

Definition at line 161 of file secondary.cpp.

References _strand, carla::BufferView::CreateFrom(), DEBUG_ASSERT, DEBUG_ONLY, carla::log_error(), and MakeMessage().

+ Here is the call graph for this function:

◆ Write() [3/3]

void carla::multigpu::Secondary::Write ( std::string  text)

Definition at line 191 of file secondary.cpp.

References _strand, DEBUG_ONLY, and carla::log_error().

+ Here is the call graph for this function:

Member Data Documentation

◆ _buffer_pool

std::shared_ptr<BufferPool> carla::multigpu::Secondary::_buffer_pool
private

Definition at line 80 of file secondary.h.

◆ _commander

SecondaryCommands carla::multigpu::Secondary::_commander
private

Definition at line 82 of file secondary.h.

Referenced by Connect(), GetCommander(), and Secondary().

◆ _connection_timer

boost::asio::deadline_timer carla::multigpu::Secondary::_connection_timer
private

Definition at line 79 of file secondary.h.

Referenced by Reconnect(), and Stop().

◆ _done

std::atomic_bool carla::multigpu::Secondary::_done {false}
private

Definition at line 81 of file secondary.h.

◆ _endpoint

boost::asio::ip::tcp::endpoint carla::multigpu::Secondary::_endpoint
private

Definition at line 77 of file secondary.h.

Referenced by Secondary().

◆ _pool

ThreadPool carla::multigpu::Secondary::_pool
private

Definition at line 75 of file secondary.h.

Referenced by AsyncRun(), and ~Secondary().

◆ _socket

boost::asio::ip::tcp::socket carla::multigpu::Secondary::_socket
private

Definition at line 76 of file secondary.h.

◆ _strand

boost::asio::io_context::strand carla::multigpu::Secondary::_strand
private

Definition at line 78 of file secondary.h.

Referenced by Connect(), ReadData(), Stop(), and Write().


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