Utilities
StorageFactory
src
IOInput.cc
Go to the documentation of this file.
1
#include "
Utilities/StorageFactory/interface/IOInput.h
"
2
#include "
FWCore/Utilities/interface/EDMException.h
"
3
#include <cassert>
4
6
IOInput::~IOInput
(
void
) {}
7
11
52
int
IOInput::read
(
void
) {
53
unsigned
char
byte;
54
IOSize
n
=
read
(&
byte
, 1);
55
return
n
== 0 ? -1 : byte;
56
}
57
80
IOSize
IOInput::read
(
IOBuffer
into) {
return
read
(into.
data
(), into.
size
()); }
81
111
IOSize
IOInput::readv
(
IOBuffer
*into,
IOSize
buffers) {
112
assert
(!buffers || into);
113
114
// Keep reading as long as possible; ignore errors if we have read
115
// something, otherwise pass it on.
116
IOSize
status
;
117
IOSize
done
= 0;
118
try
{
119
for
(
IOSize
i
= 0;
i
< buffers;
done
+=
status
, ++
i
)
120
if
((
status
=
read
(into[
i
])) == 0)
121
break
;
122
}
catch
(
cms::Exception
&) {
123
if
(!
done
)
124
throw
;
125
}
126
127
return
done
;
128
}
129
133
155
IOSize
IOInput::xread
(
IOBuffer
into) {
return
xread
(into.
data
(), into.
size
()); }
156
178
IOSize
IOInput::xread
(
void
*into,
IOSize
n
) {
179
assert
(into);
180
181
// Keep reading as long as possible. Let system errors fly over
182
// us, they are a hard error.
183
IOSize
x
;
184
IOSize
done
= 0;
185
while
(
done
<
n
&& (
x
=
read
((
char
*)into +
done
,
n
-
done
)))
186
done
+=
x
;
187
188
return
done
;
189
}
190
214
IOSize
IOInput::xreadv
(
IOBuffer
*into,
IOSize
buffers) {
215
// FIXME: Use read(into, buffers) and then sort out in case of
216
// failure, the readv probably succeed directly with much less
217
// overhead.
218
219
assert
(!buffers || into);
220
221
// Keep reading as long as possible. Let system errors fly
222
// over us, they are a hard error.
223
IOSize
x
;
224
IOSize
done
= 0;
225
for
(
IOSize
i
= 0;
i
< buffers; ++
i
) {
226
done
+= (
x
=
xread
(into[
i
]));
227
if
(
x
< into[
i
].
size
())
228
break
;
229
}
230
return
done
;
231
}
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
IOInput::~IOInput
virtual ~IOInput(void)
Destruct the stream. A no-op.
Definition:
IOInput.cc:6
mps_update.status
status
Definition:
mps_update.py:69
cms::cuda::assert
assert(be >=bs)
DDAxes::x
EDMException.h
IOInput::readv
virtual IOSize readv(IOBuffer *into, IOSize buffers)
Definition:
IOInput.cc:111
IOInput::xread
IOSize xread(IOBuffer into)
Definition:
IOInput.cc:155
fileCollector.done
done
Definition:
fileCollector.py:123
IOInput::xreadv
IOSize xreadv(IOBuffer *into, IOSize buffers)
Definition:
IOInput.cc:214
IOInput.h
IOBuffer
Definition:
IOBuffer.h:7
IOBuffer::data
void * data(void) const
Definition:
IOBuffer.h:31
IOInput::read
int read(void)
Definition:
IOInput.cc:52
cms::Exception
Definition:
Exception.h:70
IOSize
size_t IOSize
Definition:
IOTypes.h:14
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16