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 
12 namespace yarp {
13 namespace os {
14 namespace impl {
15 
19 class TextCarrier : public TcpCarrier
20 {
21 
22 public:
23  TextCarrier(bool ackVariant = false);
24 
25  Carrier* create() const override;
26 
27  std::string getName() const override;
28 
29  virtual std::string getSpecifierName() const;
30 
31  bool checkHeader(const Bytes& header) override;
32  void getHeader(Bytes& header) const override;
33  bool requireAck() const override;
34  bool isTextMode() const override;
35  bool supportReply() const override;
36  bool sendHeader(ConnectionState& proto) override;
37  bool expectReplyToHeader(ConnectionState& proto) override;
38  bool expectSenderSpecifier(ConnectionState& proto) override;
39  bool sendIndex(ConnectionState& proto, SizedWriter& writer) override;
40  bool expectIndex(ConnectionState& proto) override;
41  bool sendAck(ConnectionState& proto) override;
42  bool expectAck(ConnectionState& proto) override;
43  bool respondToHeader(ConnectionState& proto) override;
44 
45 private:
46  bool ackVariant;
47 };
48 
49 } // namespace impl
50 } // namespace os
51 } // namespace yarp
52 
53 #endif // YARP_OS_IMPL_TEXTCARRIER_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:25
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
Definition: Carrier.h:45
The basic state of a connection - route, streams in use, etc.
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:33
Communicating between two ports via TCP.
Definition: TcpCarrier.h:21
Communicating between two ports via a plain-text protocol.
Definition: TextCarrier.h:20
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 main, catch-all namespace for YARP.
Definition: dirs.h:16