YARP
Yet Another Robot Platform
OutputStream.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_OUTPUTSTREAM_H
11 #define YARP_OS_OUTPUTSTREAM_H
12 
13 #include <yarp/os/api.h>
14 
15 namespace yarp {
16 namespace os {
17 
18 class Bytes;
19 
25 {
26 public:
30  virtual ~OutputStream();
31 
38  virtual void write(char ch);
39 
48  virtual void write(const Bytes& b, int offset, int len);
49 
55  virtual void write(const yarp::os::Bytes& b) = 0;
56 
60  virtual void close() = 0;
61 
65  virtual void flush();
66 
73  virtual void writeLine(const char* data, int len);
74 
80  virtual bool isOk() const = 0;
81 
86  virtual bool setWriteTimeout(double timeout);
87 
88  /*
89  * Set the Type Of Service field of all outgoing packets.
90  * @return true iff the TOS is set.
91  */
92  virtual bool setTypeOfService(int tos);
93 
94  /*
95  * Get the Type Of Service field of all outgoing packets.
96  * @return the TOS byte or -1 if not implemented.
97  */
98  virtual int getTypeOfService();
99 };
100 
101 
102 } // namespace os
103 } // namespace yarp
104 
105 #endif // YARP_OS_OUTPUTSTREAM_H
yarp::os::OutputStream::close
virtual void close()=0
Terminate the stream.
yarp::os::OutputStream
Simple specification of the minimum functions needed from output streams.
Definition: OutputStream.h:25
api.h
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::OutputStream::isOk
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
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::OutputStream::~OutputStream
virtual ~OutputStream()
Destructor.