YARP
Yet Another Robot Platform
AbstractContactable.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_ABSTRACTCONTACTABLE_H
7 #define YARP_OS_ABSTRACTCONTACTABLE_H
8 
9 #include <yarp/os/Port.h>
11 
12 namespace yarp {
13 namespace os {
14 
25 {
26 
27 public:
31  virtual Port& asPort() = 0;
32 
36  virtual const Port& asPort() const = 0;
37 
38  // Documented in Contactable
39  bool open(const std::string& name) override;
40 
41  // Documented in Contactable
42  bool open(const Contact& contact, bool registerName = true) override;
43 
44  // Documented in Contactable
45  bool addOutput(const std::string& name) override;
46 
47  // Documented in Contactable
48  bool addOutput(const std::string& name, const std::string& carrier) override;
49 
50  // Documented in Contactable
51  bool addOutput(const Contact& contact) override;
52 
53  // Documented in Contactable
54  void close() override;
55 
56  // Documented in Contactable
57  void interrupt() override;
58 
59  // Documented in Contactable
60  void resume() override;
61 
62  // Documented in Contactable
63  Contact where() const override;
64 
65  // Documented in Contactable
66  std::string getName() const override;
67 
68  // Documented in Contactable
69  bool setEnvelope(PortWriter& envelope) override;
70 
71  // Documented in Contactable
72  bool getEnvelope(PortReader& envelope) override;
73 
74  // Documented in Contactable
75  int getInputCount() override;
76 
77  // Documented in Contactable
78  int getOutputCount() override;
79 
80  // Documented in Contactable
81  void getReport(PortReport& reporter) override;
82 
83  // Documented in Contactable
84  void setReporter(PortReport& reporter) override;
85 
86  // Documented in Contactable
87  void resetReporter() override;
88 
89  // Documented in Contactable
90  bool isWriting() override;
91 
92  // Documented in Contactable
93  void setReader(PortReader& reader) override;
94 
95  // Documented in Contactable
96  void setAdminReader(PortReader& reader) override;
97 
98  // Documented in Contactable
99  void setInputMode(bool expectInput) override;
100 
101  // Documented in Contactable
102  void setOutputMode(bool expectOutput) override;
103 
104  // Documented in Contactable
105  void setRpcMode(bool expectRpc) override;
106 
107  // Documented in Contactable
108  Type getType() override;
109 
110  // Documented in Contactable
111  void promiseType(const Type& typ) override;
112 
113  // Documented in Contactable
114  Property* acquireProperties(bool readOnly) override;
115 
116  // Documented in Contactable
117  void releaseProperties(Property* prop) override;
118 
119  // Documented in UnbufferedContactable
120  bool write(const PortWriter& writer,
121  const PortWriter* callback = nullptr) const override;
122 
123  // Documented in UnbufferedContactable
124  bool write(const PortWriter& writer,
125  PortReader& reader,
126  const PortWriter* callback = nullptr) const override;
127 
128  // Documented in UnbufferedContactable
129  bool read(PortReader& reader, bool willReply = false) override;
130 
131  // Documented in UnbufferedContactable
132  bool reply(PortWriter& writer) override;
133 
134  // Documented in UnbufferedContactable
135  bool replyAndDrop(PortWriter& writer) override;
136 
137  // Documented in Contactable
138  void includeNodeInName(bool flag) override;
139 
140 #ifndef YARP_NO_DEPRECATED // Since YARP 3.3
143  // Documented in Contactable
144  YARP_DEPRECATED_MSG("Use setCallbackLock with std::mutex instead")
145  bool setCallbackLock(yarp::os::Mutex* mutex) override;
147 #endif
148 
149  // Documented in Contactable
150  bool setCallbackLock(std::mutex* mutex = nullptr) override;
151 
152  // Documented in Contactable
153  bool removeCallbackLock() override;
154 
155  // Documented in Contactable
156  bool lockCallback() override;
157 
158  // Documented in Contactable
159  bool tryLockCallback() override;
160 
161  // Documented in Contactable
162  void unlockCallback() override;
163 };
164 
165 } // namespace os
166 } // namespace yarp
167 
168 #endif // YARP_OS_ABSTRACTCONTACTABLE_H
A default implementation of an abstract port.
virtual const Port & asPort() const =0
Get the concrete Port being used for communication, const version.
virtual Port & asPort()=0
Get the concrete Port being used for communication.
Represents how to reach a part of a YARP network.
Definition: Contact.h:36
Basic wrapper for mutual exclusion.
Definition: Mutex.h:32
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:25
A base class for objects that want information about port status changes.
Definition: PortReport.h:28
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 class for storing options and configuration information.
Definition: Property.h:34
An abstract unbuffered port.
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2885
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_WARNING_POP
Ends a temporary alteration of the enabled warnings.
Definition: system.h:332
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
Definition: system.h:331
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
Definition: system.h:333
#define YARP_os_API
Definition: api.h:18