YARP
Yet Another Robot Platform
PortReaderBufferBase.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_PORTREADERBUFFERBASE_H
8 #define YARP_OS_PORTREADERBUFFERBASE_H
9 
10 #include <yarp/os/PortReader.h>
11 
12 #include <string>
13 
14 namespace yarp {
15 namespace os {
16 
17 class Port;
18 class PortReaderBufferBaseCreator;
19 class PortWriter;
20 
23 {
24 public:
25  PortReaderBufferBase(unsigned int maxBuffer);
26  virtual ~PortReaderBufferBase();
27 
28  void setCreator(PortReaderBufferBaseCreator* creator);
29 
30  void setReplier(yarp::os::PortReader& reader);
31 
32  void setPrune(bool flag = true);
33 
34  void setTargetPeriod(double period);
35 
36  std::string getName() const;
37 
38  unsigned int getMaxBuffer();
39 
40  bool isClosed();
41 
42  void clear();
43 
44  virtual yarp::os::PortReader* create();
45 
46  int check();
47 
48  bool read(yarp::os::ConnectionReader& connection) override;
49 
50  yarp::os::PortReader* readBase(bool& missed, bool cleanup);
51 
52  void interrupt();
53 
54  void attachBase(yarp::os::Port& port);
55 
56  // direct writer-buffer to reader-buffer pointer sharing methods
57 
58  virtual bool acceptObjectBase(yarp::os::PortReader* obj,
59  yarp::os::PortWriter* wrapper);
60 
61  virtual bool forgetObjectBase(yarp::os::PortReader* obj,
62  yarp::os::PortWriter* wrapper);
63 
64  virtual bool getEnvelope(PortReader& envelope);
65 
66  // user takes control of the current read object
67  void* acquire();
68 
69  // user gives back an object
70  void release(void* key);
71 
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73 private:
74  class Private;
75  Private* mPriv;
76 #endif // DOXYGEN_SHOULD_SKIP_THIS
77 };
78 
79 
80 } // namespace os
81 } // namespace yarp
82 
83 #endif // YARP_OS_PORTREADERBUFFERBASE_H
An interface for reading from a network connection.
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
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:922
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18