Goby3  3.0.1
2021.08.17
goby::util::LineBasedInterface Class Referenceabstract

basic interface class for all the derived serial (and networking mimics) line-based nodes (serial, tcp, udp, etc.) More...

#include <goby/util/linebasedcomms/interface.h>

Inheritance diagram for goby::util::LineBasedInterface:
goby::util::SerialClient goby::util::TCPClient goby::util::TCPServer

Public Types

enum  AccessOrder { NEWEST_FIRST, OLDEST_FIRST }
 

Public Member Functions

 LineBasedInterface (const std::string &delimiter)
 
virtual ~LineBasedInterface ()
 
void start ()
 
void close ()
 
bool active ()
 
void sleep (int sec)
 
bool readline (std::string *s, AccessOrder order=OLDEST_FIRST)
 returns string line (including delimiter) More...
 
bool readline (protobuf::Datagram *msg, AccessOrder order=OLDEST_FIRST)
 
void write (const std::string &s)
 
void write (const protobuf::Datagram &msg)
 
void clear ()
 
void set_delimiter (const std::string &s)
 
std::string delimiter () const
 

Protected Member Functions

virtual void do_start ()=0
 
virtual void do_close ()=0
 
virtual std::string local_endpoint ()=0
 
virtual std::string remote_endpoint ()
 
void set_active (bool active)
 
std::string & delimiter ()
 
std::deque< goby::util::protobuf::Datagram > & in ()
 
goby::middleware::InterThreadTransporterinterthread ()
 
int index ()
 
virtual void do_subscribe ()=0
 
goby::middleware::DynamicGroupin_group ()
 
goby::middleware::DynamicGroupout_group ()
 
bool io_thread_ready ()
 

Detailed Description

basic interface class for all the derived serial (and networking mimics) line-based nodes (serial, tcp, udp, etc.)

Definition at line 61 of file interface.h.

Member Enumeration Documentation

◆ AccessOrder

Enumerator
NEWEST_FIRST 
OLDEST_FIRST 

Definition at line 81 of file interface.h.

Constructor & Destructor Documentation

◆ LineBasedInterface()

goby::util::LineBasedInterface::LineBasedInterface ( const std::string &  delimiter)

◆ ~LineBasedInterface()

virtual goby::util::LineBasedInterface::~LineBasedInterface ( )
virtual

Member Function Documentation

◆ active()

bool goby::util::LineBasedInterface::active ( )
inline

Definition at line 72 of file interface.h.

◆ clear()

void goby::util::LineBasedInterface::clear ( )

◆ close()

void goby::util::LineBasedInterface::close ( )

◆ delimiter() [1/2]

std::string& goby::util::LineBasedInterface::delimiter ( )
inlineprotected

Definition at line 118 of file interface.h.

◆ delimiter() [2/2]

std::string goby::util::LineBasedInterface::delimiter ( ) const
inline

Definition at line 107 of file interface.h.

◆ do_close()

virtual void goby::util::LineBasedInterface::do_close ( )
protectedpure virtual

◆ do_start()

virtual void goby::util::LineBasedInterface::do_start ( )
protectedpure virtual

◆ do_subscribe()

virtual void goby::util::LineBasedInterface::do_subscribe ( )
protectedpure virtual

◆ in()

std::deque<goby::util::protobuf::Datagram>& goby::util::LineBasedInterface::in ( )
inlineprotected

Definition at line 119 of file interface.h.

◆ in_group()

goby::middleware::DynamicGroup& goby::util::LineBasedInterface::in_group ( )
inlineprotected

Definition at line 127 of file interface.h.

◆ index()

int goby::util::LineBasedInterface::index ( )
inlineprotected

Definition at line 123 of file interface.h.

◆ interthread()

goby::middleware::InterThreadTransporter& goby::util::LineBasedInterface::interthread ( )
inlineprotected

Definition at line 121 of file interface.h.

◆ io_thread_ready()

bool goby::util::LineBasedInterface::io_thread_ready ( )
inlineprotected

Definition at line 130 of file interface.h.

◆ local_endpoint()

virtual std::string goby::util::LineBasedInterface::local_endpoint ( )
protectedpure virtual

◆ out_group()

goby::middleware::DynamicGroup& goby::util::LineBasedInterface::out_group ( )
inlineprotected

Definition at line 128 of file interface.h.

◆ readline() [1/2]

bool goby::util::LineBasedInterface::readline ( protobuf::Datagram msg,
AccessOrder  order = OLDEST_FIRST 
)

◆ readline() [2/2]

bool goby::util::LineBasedInterface::readline ( std::string *  s,
AccessOrder  order = OLDEST_FIRST 
)

returns string line (including delimiter)

Returns
true if data was read, false if no data to read

◆ remote_endpoint()

virtual std::string goby::util::LineBasedInterface::remote_endpoint ( )
inlineprotectedvirtual

Reimplemented in goby::util::SerialClient, and goby::util::TCPClient.

Definition at line 114 of file interface.h.

◆ set_active()

void goby::util::LineBasedInterface::set_active ( bool  active)
inlineprotected

Definition at line 116 of file interface.h.

◆ set_delimiter()

void goby::util::LineBasedInterface::set_delimiter ( const std::string &  s)
inline

Definition at line 106 of file interface.h.

◆ sleep()

void goby::util::LineBasedInterface::sleep ( int  sec)

◆ start()

void goby::util::LineBasedInterface::start ( )

◆ write() [1/2]

void goby::util::LineBasedInterface::write ( const protobuf::Datagram msg)

◆ write() [2/2]

void goby::util::LineBasedInterface::write ( const std::string &  s)
inline

Definition at line 94 of file interface.h.


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