YARP
Yet Another Robot Platform
RpcServer.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_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
yarp::os::RpcServer::asPort
const Port & asPort() const override
Get the concrete Port being used for communication, const version.
Definition: RpcServer.h:64
yarp::sig::file::read
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:827
yarp::os::RpcServer::asPort
Port & asPort() override
Get the concrete Port being used for communication.
Definition: RpcServer.h:59
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
yarp::os::Port
A mini-server for network communication.
Definition: Port.h:50
yarp::os::PortReader
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
yarp::os::RpcServer
A port that is specialized as an RPC server.
Definition: RpcServer.h:27
AbstractContactable.h
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::sig::file::write
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:971
yarp::os::AbstractContactable
A default implementation of an abstract port.
Definition: AbstractContactable.h:28