YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
CommandBottle.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_OS_COMMANDBOTTLE_H
7#define YARP_OS_COMMANDBOTTLE_H
8
9#include <yarp/os/Portable.h>
10#include <yarp/os/Bottle.h>
11
12namespace yarp::os {
13
14/*
15 * This is a class that contains both the command and the reply.
16 *
17 * The only advantage of this class compared to using two bottles is that
18 * portmonitors are able to know, in the `updateReply` method, what was the
19 * request for the reply received.
20 */
23{
24public:
25 CommandBottle() = default;
26 explicit CommandBottle(const std::string& text);
27 explicit CommandBottle(std::initializer_list<yarp::os::Value> values);
28
29 CommandBottle(const CommandBottle& rhs) = default;
30 CommandBottle(CommandBottle&& rhs) noexcept = default;
32 CommandBottle& operator=(CommandBottle&& rhs) noexcept = default;
33 ~CommandBottle() override = default;
34
35
36 bool write(yarp::os::ConnectionWriter& connection) const override;
37 bool read(yarp::os::ConnectionReader& connection) override;
38
41};
42
43} // namespace yarp::os
44
45#endif // YARP_OS_COMMANDBOTTLE_H
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
CommandBottle(const CommandBottle &rhs)=default
~CommandBottle() override=default
yarp::os::Bottle reply
CommandBottle & operator=(const CommandBottle &rhs)=default
yarp::os::Bottle cmd
CommandBottle(CommandBottle &&rhs) noexcept=default
CommandBottle & operator=(CommandBottle &&rhs) noexcept=default
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition Portable.h:25
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18