YARP
Yet Another Robot Platform
TextCarrier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_IMPL_TEXTCARRIER_H
11 #define YARP_OS_IMPL_TEXTCARRIER_H
12 
14 
15 namespace yarp {
16 namespace os {
17 namespace impl {
18 
22 class TextCarrier : public TcpCarrier
23 {
24 
25 public:
26  TextCarrier(bool ackVariant = false);
27 
28  Carrier* create() const override;
29 
30  std::string getName() const override;
31 
32  virtual std::string getSpecifierName() const;
33 
34  bool checkHeader(const Bytes& header) override;
35  void getHeader(Bytes& header) const override;
36  bool requireAck() const override;
37  bool isTextMode() const override;
38  bool supportReply() const override;
39  bool sendHeader(ConnectionState& proto) override;
40  bool expectReplyToHeader(ConnectionState& proto) override;
41  bool expectSenderSpecifier(ConnectionState& proto) override;
42  bool sendIndex(ConnectionState& proto, SizedWriter& writer) override;
43  bool expectIndex(ConnectionState& proto) override;
44  bool sendAck(ConnectionState& proto) override;
45  bool expectAck(ConnectionState& proto) override;
46  bool respondToHeader(ConnectionState& proto) override;
47 
48 private:
49  bool ackVariant;
50 };
51 
52 } // namespace impl
53 } // namespace os
54 } // namespace yarp
55 
56 #endif // YARP_OS_IMPL_TEXTCARRIER_H
yarp::os::Carrier
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
Definition: Carrier.h:48
TcpCarrier.h
yarp::os::impl::TextCarrier::requireAck
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Definition: TextCarrier.cpp:74
yarp::os::impl::TextCarrier::expectIndex
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
Definition: TextCarrier.cpp:129
yarp::os::impl::TextCarrier::sendHeader
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
Definition: TextCarrier.cpp:90
yarp::os::impl::TextCarrier::checkHeader
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:45
yarp::os::impl::TextCarrier::sendIndex
bool sendIndex(ConnectionState &proto, SizedWriter &writer) override
Definition: TextCarrier.cpp:122
yarp::os::impl::TextCarrier::TextCarrier
TextCarrier(bool ackVariant=false)
Definition: TextCarrier.cpp:24
yarp::os::impl::TextCarrier::sendAck
bool sendAck(ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
Definition: TextCarrier.cpp:135
yarp::os::impl::TextCarrier::supportReply
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
Definition: TextCarrier.cpp:85
yarp::os::impl::TcpCarrier
Communicating between two ports via TCP.
Definition: TcpCarrier.h:24
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::impl::TextCarrier::getSpecifierName
virtual std::string getSpecifierName() const
Definition: TextCarrier.cpp:37
yarp::os::ConnectionState
The basic state of a connection - route, streams in use, etc.
Definition: ConnectionState.h:31
yarp::os::impl::TextCarrier::respondToHeader
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
Definition: TextCarrier.cpp:155
yarp::os::impl::TextCarrier
Communicating between two ports via a plain-text protocol.
Definition: TextCarrier.h:23
yarp::os::impl::TextCarrier::isTextMode
bool isTextMode() const override
Check if carrier is textual in nature.
Definition: TextCarrier.cpp:79
yarp::os::impl::TextCarrier::expectSenderSpecifier
bool expectSenderSpecifier(ConnectionState &proto) override
Expect the name of the sending port.
Definition: TextCarrier.cpp:113
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::impl::TextCarrier::expectAck
bool expectAck(ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
Definition: TextCarrier.cpp:146
yarp::os::impl::TextCarrier::expectReplyToHeader
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
Definition: TextCarrier.cpp:104
yarp::os::impl::TextCarrier::getName
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Definition: TextCarrier.cpp:29
yarp::os::impl::TextCarrier::getHeader
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:59
yarp::os::impl::TextCarrier::create
Carrier * create() const override
Factory method.
Definition: TextCarrier.cpp:69
yarp::os::SizedWriter
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:36