YARP
Yet Another Robot Platform
RpcServer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 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_RPCSERVER_H
11 #define YARP_OS_RPCSERVER_H
12 
14 
15 namespace yarp {
16 namespace os {
17 
27 {
28 public:
32  RpcServer();
33 
37  ~RpcServer() override;
38 
42  virtual bool write(const PortWriter& writer,
43  const PortWriter* callback = nullptr) const override;
44 
48  virtual bool write(const PortWriter& writer,
49  PortReader& reader,
50  const PortWriter* callback = nullptr) const override;
51 
52  // documented in UnbufferedContactable
53  bool read(PortReader& reader, bool willReply = true) override;
54 
55  void setInputMode(bool expectInput) override;
56  void setOutputMode(bool expectOutput) override;
57  void setRpcMode(bool expectRpc) override;
58 
59  Port& asPort() override
60  {
61  return port;
62  }
63 
64  const Port& asPort() const override
65  {
66  return port;
67  }
68 
69 private:
70  // an RpcServer may be implemented with a regular port
71  Port port;
72 
73  // forbid copy constructor and assignment operator by making them private
74  // and not implementing them
75  RpcServer(const RpcServer& alt);
76  const RpcServer& operator=(const RpcServer& alt);
77 };
78 
79 } // namespace os
80 } // namespace yarp
81 
82 #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:28
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
A mini-server for network communication.
Definition: Port.h:50
A port that is specialized as an RPC server.
Definition: RpcServer.h:27
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
Definition: RpcServer.h:64
Port & asPort() override
Get the concrete Port being used for communication.
Definition: RpcServer.h:59
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:920
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1096
The main, catch-all namespace for YARP.
Definition: dirs.h:19
#define YARP_os_API
Definition: api.h:21