Goby3  3.1.5a
2024.05.23
goby::middleware::PollerInterface Class Referenceabstract

Defines the common interface for polling for data on Goby transporters. More...

#include <goby/middleware/transport/interface.h>

Inheritance diagram for goby::middleware::PollerInterface:
goby::middleware::Poller< Transporter > goby::middleware::Poller< InterProcessTransporterBase< Derived, InnerTransporter > > goby::middleware::Poller< InterThreadTransporter > goby::middleware::Poller< InterVehicleTransporterBase< Derived, InnerTransporter > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< goby::middleware::InterProcessForwarder< goby::middleware::InterThreadTransporter > >, goby::middleware::InterProcessForwarder< goby::middleware::InterThreadTransporter > > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< InnerTransporter >, InnerTransporter > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< InterProcessForwarder< InterThreadTransporter > >, InterProcessForwarder< InterThreadTransporter > > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< InterProcessPortal< goby::middleware::InterThreadTransporter > >, InterProcessPortal< goby::middleware::InterThreadTransporter > > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > >, InterProcessPortal< InterThreadTransporter > > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehicleForwarder< InterProcessPortal<> >, InterProcessPortal<> > > goby::middleware::Poller< InterVehicleTransporterBase< InterVehiclePortal< InnerTransporter >, InnerTransporter > > goby::middleware::Poller< NullTransporter >

Public Member Functions

template<class Clock = std::chrono::system_clock, class Duration = typename Clock::duration>
int poll (const std::chrono::time_point< Clock, Duration > &timeout=std::chrono::time_point< Clock, Duration >::max())
 poll for data. Blocks until a data event occurs or a timeout when a particular time has been reached More...
 
template<class Clock = std::chrono::system_clock, class Duration = typename Clock::duration>
int poll (Duration wait_for)
 poll for data. Blocks until a data event occurs or a certain duration of time elapses (timeout) More...
 
std::shared_ptr< std::timed_mutex > poll_mutex ()
 access the mutex used for poll synchronization More...
 
std::shared_ptr< std::condition_variable_any > cv ()
 access the condition variable used for poll synchronization More...
 

Protected Member Functions

 PollerInterface (std::shared_ptr< std::timed_mutex > poll_mutex, std::shared_ptr< std::condition_variable_any > cv)
 

Friends

template<typename Transporter >
class Poller
 

Detailed Description

Defines the common interface for polling for data on Goby transporters.

Definition at line 139 of file interface.h.

Constructor & Destructor Documentation

◆ PollerInterface()

goby::middleware::PollerInterface::PollerInterface ( std::shared_ptr< std::timed_mutex >  poll_mutex,
std::shared_ptr< std::condition_variable_any >  cv 
)
inlineprotected

Definition at line 169 of file interface.h.

Member Function Documentation

◆ cv()

std::shared_ptr<std::condition_variable_any> goby::middleware::PollerInterface::cv ( )
inline

access the condition variable used for poll synchronization

Notifications on this condition variable will cause the poll() loop to assume there is incoming data available (typically this is notified by the publishing thread in InterThreadTransporter, but can be used to synchronize the Goby poller infrastructure with other synchronous events, such as boost::asio, file descriptors, etc. For an example, see io::IOThread)

Returns
pointer to the condition variable used for polling

Definition at line 166 of file interface.h.

◆ poll() [1/2]

template<class Clock , class Duration >
int goby::middleware::PollerInterface::poll ( const std::chrono::time_point< Clock, Duration > &  timeout = std::chrono::time_point<Clock, Duration>::max())

poll for data. Blocks until a data event occurs or a timeout when a particular time has been reached

Parameters
timeouttimeout defined using a SystemClock or std::chrono::system_clock time_point. Defaults to never timing out
Returns
the number of poll events or zero if the timeout was reached

Definition at line 345 of file interface.h.

◆ poll() [2/2]

template<class Clock , class Duration >
int goby::middleware::PollerInterface::poll ( Duration  wait_for)

poll for data. Blocks until a data event occurs or a certain duration of time elapses (timeout)

Parameters
wait_fortimeout duration
Returns
the number of poll events or zero if the timeout was reached

Definition at line 351 of file interface.h.

◆ poll_mutex()

std::shared_ptr<std::timed_mutex> goby::middleware::PollerInterface::poll_mutex ( )
inline

access the mutex used for poll synchronization

Returns
pointer to the mutex used for polling

Definition at line 160 of file interface.h.

Friends And Related Function Documentation

◆ Poller

template<typename Transporter >
friend class Poller
friend

Definition at line 176 of file interface.h.


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