YARP
Yet Another Robot Platform
SizedWriter.cpp
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
#include <
yarp/os/SizedWriter.h
>
11
12
#include <
yarp/os/Bytes.h
>
13
#include <
yarp/os/ConnectionWriter.h
>
14
#include <
yarp/os/OutputStream.h
>
15
16
17
yarp::os::SizedWriter::~SizedWriter
() =
default
;
18
19
void
yarp::os::SizedWriter::write
(
OutputStream
& os)
20
{
21
for
(
size_t
i = 0; i <
length
(); i++) {
22
Bytes
b((
char
*)
data
(i),
length
(i));
23
os.
write
(b);
24
}
25
}
26
27
bool
yarp::os::SizedWriter::write
(
ConnectionWriter
& connection)
const
28
{
29
for
(
size_t
i = 0; i < length(); i++) {
30
connection.
appendBlock
((
char
*)data(i), length(i));
31
}
32
return
true
;
33
}
34
35
void
yarp::os::SizedWriter::clear
()
36
{
37
}
yarp::os::SizedWriter::length
virtual size_t length() const =0
yarp::os::ConnectionWriter::appendBlock
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
yarp::os::SizedWriter::~SizedWriter
virtual ~SizedWriter()
ConnectionWriter.h
yarp::os::OutputStream::write
virtual void write(char ch)
Write a single byte to the stream.
Definition:
OutputStream.cpp:17
yarp::os::OutputStream
Simple specification of the minimum functions needed from output streams.
Definition:
OutputStream.h:25
OutputStream.h
yarp::os::SizedWriter::clear
virtual void clear()
Definition:
SizedWriter.cpp:35
yarp::os::SizedWriter::write
virtual void write(OutputStream &os)
Definition:
SizedWriter.cpp:19
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition:
ConnectionWriter.h:40
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition:
Bytes.h:28
Bytes.h
yarp::os::SizedWriter::data
virtual const char * data(size_t index) const =0
SizedWriter.h
YARP
3.4.100+20201223.2+gitb8ea4d712
src
libYARP_os
src
yarp
os
SizedWriter.cpp
Generated on Sun Jan 3 2021 02:46:25 for YARP by
1.8.20