|
join 1.0
lightweight network framework library
|
basic endpoint class. More...
#include <endpoint.hpp>
Public Types | |
| enum | Side { A , B } |
| endpoint side identifier. More... | |
| using | Outbound = typename OutboundPolicy::Producer |
| using | Inbound = typename InboundPolicy::Consumer |
Public Member Functions | |
| constexpr | BasicEndpoint () noexcept |
| default constructor. | |
| BasicEndpoint (const struct sockaddr *addr, socklen_t len) noexcept | |
| create instance using socket address. | |
| struct sockaddr * | addr () noexcept |
| get socket address. | |
| const struct sockaddr * | addr () const noexcept |
| get socket address. | |
| BasicEndpoint (Side side, const std::string &name, uint64_t elementSize=1472, uint64_t capacity=144) | |
| create instance. | |
| BasicEndpoint (const BasicEndpoint &other)=delete | |
| copy constructor. | |
| BasicEndpoint & | operator= (const BasicEndpoint &other)=delete |
| copy assignment operator. | |
| ~BasicEndpoint () | |
| destroy the instance. | |
| int | open () |
| open the channel endpoint. | |
| void | close () |
| close the channel endpoint. | |
| bool | opened () const |
| check if the endpoint is open. | |
| int | trySend (const void *element) |
| try to send a message to the peer (non blocking). | |
| int | send (const void *element) |
| send a message to the peer (blocking). | |
| template<class Rep , class Period > | |
| int | timedSend (const void *element, std::chrono::duration< Rep, Period > timeout) |
| send a message to the peer with timeout (blocking). | |
| int | tryReceive (void *element) |
| try to receive a message from the peer (non blocking). | |
| int | receive (void *element) |
| receive a message from the peer (blocking). | |
| template<class Rep , class Period > | |
| int | timedReceive (void *element, std::chrono::duration< Rep, Period > timeout) |
| receive a message from the peer with timeout (blocking). | |
| uint64_t | available () const |
| get number of available slots for sending. | |
| bool | full () const |
| check if outbound queue is full. | |
| uint64_t | pending () const |
| get number of pending messages. | |
| bool | empty () const |
| check if inbound queue is empty. | |
| Side | side () const |
| get the side this endpoint represents. | |
| const std::string & | name () const |
| get the channel name. | |
| uint64_t | elementSize () const |
| get the element size. | |
| uint64_t | capacity () const |
| get the buffer capacity. | |
Protected Attributes | |
| struct sockaddr_storage | _addr = {} |
| socket address storage. | |
basic endpoint class.
bidirectional shared memory communication endpoint.
| using join::BasicEndpoint< OutboundPolicy, InboundPolicy >::Inbound = typename InboundPolicy::Consumer |
| using join::BasicEndpoint< OutboundPolicy, InboundPolicy >::Outbound = typename OutboundPolicy::Producer |
| enum join::BasicEndpoint::Side |
|
inlineconstexprnoexcept |
default constructor.
|
inlinenoexcept |
create instance using socket address.
| addr | socket address. |
| len | socket address length. |
|
inline |
create instance.
| side | role of this endpoint. |
| name | channel name. |
| elementSize | the size of each data element in the ring buffers. |
| capacity | the maximum number of elements the ring buffers can hold. |
|
delete |
copy constructor.
| other | other object to copy. |
|
inline |
destroy the instance.
|
inlinenoexcept |
get socket address.
|
inlinenoexcept |
get socket address.
|
inline |
get number of available slots for sending.
|
inline |
get the buffer capacity.
|
inline |
close the channel endpoint.
|
inline |
get the element size.
|
inline |
check if inbound queue is empty.
|
inline |
check if outbound queue is full.
|
inline |
get the channel name.
|
inline |
open the channel endpoint.
|
inline |
check if the endpoint is open.
|
delete |
copy assignment operator.
| other | other object to copy. |
|
inline |
get number of pending messages.
|
inline |
receive a message from the peer (blocking).
| element | pointer to buffer for received element. |
|
inline |
send a message to the peer (blocking).
| element | pointer to the element to send |
|
inline |
|
inline |
receive a message from the peer with timeout (blocking).
| element | pointer to buffer for received element. |
| timeout | maximum time to wait |
|
inline |
send a message to the peer with timeout (blocking).
| element | pointer to the element to send |
| timeout | maximum time to wait |
|
inline |
try to receive a message from the peer (non blocking).
| element | pointer to buffer for received element. |
|
inline |
try to send a message to the peer (non blocking).
| element | pointer to the element to send |
|
protected |
socket address storage.