mavtables  0.2.1
MAVLink router and firewall.
Public Member Functions | Protected Member Functions | Friends | List of all members
Interface Class Referenceabstract

#include <Interface.hpp>

Inheritance diagram for Interface:
Inheritance graph
Collaboration diagram for Interface:
Collaboration graph

Public Member Functions

virtual ~Interface ()
 
virtual void send_packet (const std::chrono::nanoseconds &timeout)=0
 
virtual void receive_packet (const std::chrono::nanoseconds &timeout)=0
 

Protected Member Functions

virtual std::ostream & print_ (std::ostream &os) const =0
 

Friends

std::ostream & operator<< (std::ostream &os, const Interface &interface)
 

Detailed Description

The base class for all interfaces.

Derived classes should add one or more connections to queue packets for sending.

Definition at line 33 of file Interface.hpp.

Constructor & Destructor Documentation

◆ ~Interface()

Interface::~Interface ( )
virtual

Definition at line 27 of file Interface.cpp.

Member Function Documentation

◆ print_()

virtual std::ostream& Interface::print_ ( std::ostream &  os) const
protectedpure virtual

Print the interface to the given output stream.

Parameters
osThe output stream to print to.
Returns
The output stream.

Implemented in UDPInterface, and SerialInterface.

◆ receive_packet()

virtual void Interface::receive_packet ( const std::chrono::nanoseconds &  timeout)
pure virtual

Receive a packet on the interface.

Parameters
timeoutThe maximum amount of time to wait for incoming data.

Implemented in UDPInterface, and SerialInterface.

◆ send_packet()

virtual void Interface::send_packet ( const std::chrono::nanoseconds &  timeout)
pure virtual

Send a packet from one of the interface's connections.

Note
Which connection to take this packet from is not defined but it must not starve any one of the Interface's connections.
Parameters
timeoutThe maximum amount of time to wait for a packet to be available for sending.

Implemented in UDPInterface, and SerialInterface.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Interface interface 
)
friend

Print the given Interface to the given output stream.

Note
This is a polymorphic print. Therefore, it can print any derived class as well.

Some examples are:

serial {
device /dev/ttyUSB0;
baudrate 115200;
flow_control yes;
}
udp {
port 14500;
address 127.0.0.1;
}
Parameters
osThe output stream to print to.
interfaceThe interface (or any child of the Interface) to print.
Returns
The output stream.

Definition at line 58 of file Interface.cpp.


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