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