YARP
Yet Another Robot Platform
SizedWriter.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_SIZEDWRITER_H
8 #define YARP_OS_SIZEDWRITER_H
9 
10 #include <yarp/conf/numeric.h>
11 
12 #include <yarp/os/api.h>
13 
14 #include <yarp/os/PortWriter.h>
15 
16 namespace yarp {
17 namespace os {
18 
19 class ConnectionWriter;
20 class OutputStream;
21 class PortReader;
22 class Portable;
23 
33 {
34 public:
35  virtual ~SizedWriter();
36 
37  virtual size_t length() const = 0;
38 
39  virtual size_t headerLength() const = 0;
40 
41  virtual size_t length(size_t index) const = 0;
42 
43  virtual const char* data(size_t index) const = 0;
44 
45  virtual PortReader* getReplyHandler() = 0;
46 
47  virtual Portable* getReference() = 0;
48 
49  virtual void write(OutputStream& os);
50 
51  bool write(ConnectionWriter& connection) const override;
52 
53  virtual bool dropRequested() = 0;
54 
58  virtual void startWrite() const = 0;
59 
63  virtual void stopWrite() const = 0;
64 
65  virtual void clear();
66 };
67 
68 } // namespace os
69 } // namespace yarp
70 
71 #endif // YARP_OS_SIZEDWRITER_H
An interface for writing to a network connection.
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:22
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
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:26
Minimal requirements for an efficient Writer.
Definition: SizedWriter.h:33
virtual void stopWrite() const =0
Call when all writing is finished.
virtual size_t headerLength() const =0
virtual bool dropRequested()=0
virtual Portable * getReference()=0
virtual size_t length(size_t index) const =0
virtual size_t length() const =0
virtual PortReader * getReplyHandler()=0
virtual const char * data(size_t index) const =0
virtual void startWrite() const =0
Call when writing is about to begin.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1098
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18