Goby v2
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
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:
Inheritance graph
[legend]

Public Types

enum  AccessOrder { NEWEST_FIRST, OLDEST_FIRST }
 

Public Member Functions

 LineBasedInterface (const std::string &delimiter)
 
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
 
boost::asio::io_service & io_service ()
 

Protected Member Functions

virtual void do_start ()=0
 
virtual void do_write (const protobuf::Datagram &line)=0
 
virtual void do_close (const boost::system::error_code &error)=0
 
void set_active (bool active)
 
std::string & delimiter ()
 
std::deque< goby::util::protobuf::Datagram > & in ()
 
boost::mutex & in_mutex ()
 

Protected Attributes

std::string delimiter_
 
boost::asio::io_service io_service_
 
std::deque< protobuf::Datagramin_
 
boost::mutex in_mutex_
 

Friends

template<typename ASIOAsyncReadStream >
class LineBasedConnection
 

Detailed Description

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

Definition at line 44 of file interface.h.

Member Function Documentation

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

Definition at line 80 of file interface.cpp.


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