7#ifndef YARP_OS_IMPL_LOCALCARRIER_H
8#define YARP_OS_IMPL_LOCALCARRIER_H
37 std::mutex senderMutex;
38 std::mutex receiverMutex;
67 void reset()
override;
71 void close()
override;
72 bool isOk()
const override;
75 Contact localAddress, remoteAddress;
94 std::string
getName()
const override;
A starter class for implementing simple carriers.
A mini-server for performing network communication in the background.
A simple abstraction for a block of bytes.
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
The basic state of a connection - route, streams in use, etc.
Simple specification of the minimum functions needed from output streams.
virtual void write(char ch)
Write a single byte to the stream.
This is a base class for objects that can be both read from and be written to the YARP network.
A class for thread synchronization and mutual exclusion.
Minimal requirements for an efficient Writer.
A stream which can be asked to perform bidirectional communication.
Coordinate ports communicating locally within a process.
void setSender(LocalCarrier *sender)
LocalCarrier * getReceiver()
void revoke(LocalCarrier *carrier)
LocalCarrier * getSender(LocalCarrier *receiver)
A stream for communicating locally within a process.
bool isOk() const override
Check if the stream is ok or in an error state.
void interrupt() override
Interrupt the stream.
InputStream & getInputStream() override
Get an InputStream to read from.
const Contact & getLocalAddress() const override
Get the address of the local side of the stream.
OutputStream & getOutputStream() override
Get an OutputStream to write to.
void close() override
Terminate the stream.
void beginPacket() override
Mark the beginning of a logical packet.
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
void attach(LocalCarrier *owner, bool sender)
void endPacket() override
Mark the end of a logical packet (see beginPacket).
bool setTypeOfService(int tos) override
const Contact & getRemoteAddress() const override
Get the address of the remote side of the stream.
void reset() override
Reset the stream.
A carrier for communicating locally within a process.
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
static LocalCarrierManager manager
bool write(ConnectionState &proto, SizedWriter &writer) override
Write a message.
yarp::os::Semaphore received
void accept(yarp::os::Portable *ref)
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
bool expectExtraHeader(ConnectionState &proto) override
Receive any carrier-specific header.
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
bool checkHeader(const Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
bool canEscape() const override
Check if carrier can encode administrative messages, as opposed to just user data.
void setParameters(const Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
Carrier * create() const override
Factory method.
virtual bool becomeLocal(ConnectionState &proto, bool sender)
virtual std::string getSpecifierName() const
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
void getHeader(Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
bool isLocal() const override
Check if carrier operates within a single process.
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
The components from which ports and connections are built.