HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
hf::can::PipeHub Class Reference

The bus: forwards datagrams between participants. More...

#include <PipePort.h>

Classes

struct  Client
 

Public Member Functions

 PipeHub ()=default
 
 ~PipeHub ()
 
 PipeHub (const PipeHub &)=delete
 
PipeHub & operator= (const PipeHub &)=delete
 
bool Start (const std::string &path)
 Listen at path (an existing socket file is replaced) and start the hub thread.
 
void Stop ()
 Stop the thread, close every connection and remove the socket file.
 
bool Running () const noexcept
 
uint64_t Forwarded () const noexcept
 Datagrams forwarded so far (each counted once per receiver).
 
std::size_t Participants () const noexcept
 

Static Public Attributes

static constexpr std::size_t kMaxBacklog = 1U << 20U
 

Private Member Functions

void Loop ()
 

Private Attributes

std::string path_
 
int listen_fd_ {-1}
 
int wake_ [2] {-1, -1}
 
std::thread thread_
 
std::atomic< bool > running_ {false}
 
std::atomic< uint64_t > forwarded_ {0}
 
std::atomic< std::size_t > participants_ {0}
 

Detailed Description

The bus: forwards datagrams between participants.

Constructor & Destructor Documentation

◆ PipeHub() [1/2]

hf::can::PipeHub::PipeHub ( )
default

◆ ~PipeHub()

hf::can::PipeHub::~PipeHub ( )

◆ PipeHub() [2/2]

hf::can::PipeHub::PipeHub ( const PipeHub &  )
delete

Member Function Documentation

◆ Forwarded()

uint64_t hf::can::PipeHub::Forwarded ( ) const
inlinenoexcept

Datagrams forwarded so far (each counted once per receiver).

◆ Loop()

void hf::can::PipeHub::Loop ( )
private

◆ operator=()

PipeHub & hf::can::PipeHub::operator= ( const PipeHub &  )
delete

◆ Participants()

std::size_t hf::can::PipeHub::Participants ( ) const
inlinenoexcept

◆ Running()

bool hf::can::PipeHub::Running ( ) const
inlinenoexcept

◆ Start()

bool hf::can::PipeHub::Start ( const std::string &  path)

Listen at path (an existing socket file is replaced) and start the hub thread.

◆ Stop()

void hf::can::PipeHub::Stop ( )

Stop the thread, close every connection and remove the socket file.

Member Data Documentation

◆ forwarded_

std::atomic<uint64_t> hf::can::PipeHub::forwarded_ {0}
private

◆ kMaxBacklog

constexpr std::size_t hf::can::PipeHub::kMaxBacklog = 1U << 20U
staticconstexpr

Bytes buffered for one slow participant before the hub stops reading senders.

◆ listen_fd_

int hf::can::PipeHub::listen_fd_ {-1}
private

◆ participants_

std::atomic<std::size_t> hf::can::PipeHub::participants_ {0}
private

◆ path_

std::string hf::can::PipeHub::path_
private

◆ running_

std::atomic<bool> hf::can::PipeHub::running_ {false}
private

◆ thread_

std::thread hf::can::PipeHub::thread_
private

◆ wake_

int hf::can::PipeHub::wake_[2] {-1, -1}
private

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