YARP
Yet Another Robot Platform
RpcServer.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_RPCSERVER_H
8 #define YARP_OS_RPCSERVER_H
9 
11 
12 namespace yarp {
13 namespace os {
14 
24 {
25 public:
29  RpcServer();
30 
34  ~RpcServer() override;
35 
39  virtual bool write(const PortWriter& writer,
40  const PortWriter* callback = nullptr) const override;
41 
45  virtual bool write(const PortWriter& writer,
46  PortReader& reader,
47  const PortWriter* callback = nullptr) const override;
48 
49  // documented in UnbufferedContactable
50  bool read(PortReader& reader, bool willReply = true) override;
51 
52  void setInputMode(bool expectInput) override;
53  void setOutputMode(bool expectOutput) override;
54  void setRpcMode(bool expectRpc) override;
55 
56  Port& asPort() override
57  {
58  return port;
59  }
60 
61  const Port& asPort() const override
62  {
63  return port;
64  }
65 
66 private:
67  // an RpcServer may be implemented with a regular port
68  Port port;
69 
70  // forbid copy constructor and assignment operator by making them private
71  // and not implementing them
72  RpcServer(const RpcServer& alt);
73  const RpcServer& operator=(const RpcServer& alt);
74 };
75 
76 } // namespace os
77 } // namespace yarp
78 
79 #endif // YARP_OS_RPCSERVER_H
A default implementation of an abstract port.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:25
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:24
A mini-server for network communication.
Definition: Port.h:47
A port that is specialized as an RPC server.
Definition: RpcServer.h:24
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
Definition: RpcServer.h:61
Port & asPort() override
Get the concrete Port being used for communication.
Definition: RpcServer.h:56
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:923
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18