YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ApplicationNetworkProtocolVersion.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
9
10using namespace yarp::os;
11
15
17{
18 std::string s;
19 s = std::to_string(protocol_version) + " (" +
20 std::to_string(yarp_major) + "." +
21 std::to_string(yarp_minor) + "." +
22 std::to_string(yarp_patch) + ")";
23 return s;
24}
25
27{
28 connection.convertTextMode();
29 protocol_version = connection.expectInt16();
30 yarp_major = connection.expectInt16();
31 yarp_minor = connection.expectInt16();
32 yarp_patch = connection.expectInt16();
33 return true;
34}
35
37{
38 connection.convertTextMode();
39 connection.appendInt16(this->protocol_version);
40 connection.appendInt16(this->yarp_major);
41 connection.appendInt16(this->yarp_minor);
42 connection.appendInt16(this->yarp_patch);
43 return true;
44}
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
An interface for reading from a network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual std::int16_t expectInt16()=0
Read a 16-bit integer from the network connection.
An interface for writing to a network connection.
virtual void appendInt16(std::int16_t data)=0
Send a representation of a 16-bit integer to the network connection.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
An interface to the operating system, including Port based communication.