YARP
Yet Another Robot Platform
TextCarrier.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_IMPL_TEXTCARRIER_H
8#define YARP_OS_IMPL_TEXTCARRIER_H
9
11
12namespace yarp::os::impl {
13
17class TextCarrier : public TcpCarrier
18{
19
20public:
21 TextCarrier(bool ackVariant = false);
22
23 Carrier* create() const override;
24
25 std::string getName() const override;
26
27 virtual std::string getSpecifierName() const;
28
29 bool checkHeader(const Bytes& header) override;
30 void getHeader(Bytes& header) const override;
31 bool requireAck() const override;
32 bool isTextMode() const override;
33 bool supportReply() const override;
34 bool sendHeader(ConnectionState& proto) override;
35 bool expectReplyToHeader(ConnectionState& proto) override;
36 bool expectSenderSpecifier(ConnectionState& proto) override;
37 bool sendIndex(ConnectionState& proto, SizedWriter& writer) override;
38 bool expectIndex(ConnectionState& proto) override;
39 bool sendAck(ConnectionState& proto) override;
40 bool expectAck(ConnectionState& proto) override;
41 bool respondToHeader(ConnectionState& proto) override;
42
43private:
44 bool ackVariant;
45};
46
47} // namespace yarp::os::impl
48
49#endif // YARP_OS_IMPL_TEXTCARRIER_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:24
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
Definition: Carrier.h:44
The basic state of a connection - route, streams in use, etc.
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:32
Communicating between two ports via TCP.
Definition: TcpCarrier.h:19
Communicating between two ports via a plain-text protocol.
Definition: TextCarrier.h:18
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Definition: TextCarrier.cpp:26
bool sendAck(ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
bool expectAck(ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Definition: TextCarrier.cpp:71
bool sendIndex(ConnectionState &proto, SizedWriter &writer) override
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
bool isTextMode() const override
Check if carrier is textual in nature.
Definition: TextCarrier.cpp:76
Carrier * create() const override
Factory method.
Definition: TextCarrier.cpp:66
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
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...
Definition: TextCarrier.cpp:42
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
Definition: TextCarrier.cpp:87
bool expectSenderSpecifier(ConnectionState &proto) override
Expect the name of the sending port.
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
Definition: TextCarrier.cpp:82
TextCarrier(bool ackVariant=false)
Definition: TextCarrier.cpp:21
void getHeader(Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
Definition: TextCarrier.cpp:56
virtual std::string getSpecifierName() const
Definition: TextCarrier.cpp:34
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
The components from which ports and connections are built.