Utilities
StorageFactory
src
IOOutput.cc
Go to the documentation of this file.
1
#include "
Utilities/StorageFactory/interface/IOOutput.h
"
2
#include "
FWCore/Utilities/interface/EDMException.h
"
3
#include <cassert>
4
6
IOOutput::~IOOutput
(
void
) {}
7
11
39
IOSize
IOOutput::write
(
unsigned
char
byte
) {
return
write
(&
byte
, 1); }
40
59
IOSize
IOOutput::write
(
IOBuffer
from) {
return
write
(from.
data
(), from.
size
()); }
60
84
IOSize
IOOutput::writev
(
const
IOBuffer
*from,
IOSize
buffers) {
85
assert
(!buffers || from);
86
87
// Keep writing as long as possible; ignore errors if we have
88
// written something, otherwise pass it on.
89
IOSize
x
;
90
IOSize
done
= 0;
91
try
{
92
for
(
IOSize
i
= 0;
i
< buffers; ++
i
) {
93
done
+= (
x
=
write
(from[
i
].
data
(), from[
i
].
size
()));
94
if
(
x
< from[
i
].
size
())
95
break
;
96
}
97
}
catch
(
cms::Exception
&) {
98
if
(!
done
)
99
throw
;
100
}
101
102
return
done
;
103
}
104
108
134
IOSize
IOOutput::xwrite
(
IOBuffer
from) {
return
xwrite
(from.
data
(), from.
size
()); }
135
162
IOSize
IOOutput::xwrite
(
const
void
*from,
IOSize
n
) {
163
// Keep writing until we've written it all. Let errors fly over.
164
IOSize
done
= 0;
165
while
(
done
<
n
)
166
done
+=
write
((
const
char
*)from +
done
,
n
-
done
);
167
168
return
done
;
169
}
170
199
IOSize
IOOutput::xwritev
(
const
IOBuffer
*from,
IOSize
buffers) {
200
// Keep writing until we've written it all. Let errors fly over.
201
// FIXME: Use writev(from, buffers) and then sort out in case of
202
// failure, the writev probably succeed directly with much less
203
// overhead.
204
assert
(!buffers || from);
205
206
IOSize
done
= 0;
207
for
(
IOSize
i
= 0;
i
< buffers; ++
i
)
208
done
+=
xwrite
(from[
i
].
data
(), from[
i
].
size
());
209
210
return
done
;
211
}
IOBuffer::size
IOSize size(void) const
Definition:
IOBuffer.h:34
mps_fire.i
i
Definition:
mps_fire.py:355
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
IOOutput.h
cms::cuda::assert
assert(be >=bs)
DDAxes::x
EDMException.h
IOOutput::writev
virtual IOSize writev(const IOBuffer *from, IOSize buffers)
Definition:
IOOutput.cc:84
fileCollector.done
done
Definition:
fileCollector.py:123
IOBuffer
Definition:
IOBuffer.h:7
IOBuffer::data
void * data(void) const
Definition:
IOBuffer.h:31
IOOutput::~IOOutput
virtual ~IOOutput(void)
Destruct the stream. A no-op.
Definition:
IOOutput.cc:6
IOOutput::xwritev
IOSize xwritev(const IOBuffer *from, IOSize buffers)
Definition:
IOOutput.cc:199
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:79
IOOutput::write
IOSize write(unsigned char byte)
Definition:
IOOutput.cc:39
cms::Exception
Definition:
Exception.h:70
IOSize
size_t IOSize
Definition:
IOTypes.h:14
IOOutput::xwrite
IOSize xwrite(const void *from, IOSize n)
Definition:
IOOutput.cc:162
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16