test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
{}
8
12
53
int
54
IOInput::read
(
void
)
55
{
56
unsigned
char
byte;
57
IOSize
n
=
read
(&byte, 1);
58
return
n == 0 ? -1 : byte;
59
}
60
83
IOSize
84
IOInput::read
(
IOBuffer
into)
85
{
return
read
(into.
data
(), into.
size
()); }
86
116
IOSize
117
IOInput::readv
(
IOBuffer
*into,
IOSize
buffers)
118
{
119
assert
(! buffers || into);
120
121
// Keep reading as long as possible; ignore errors if we have read
122
// something, otherwise pass it on.
123
IOSize
status
;
124
IOSize
done
= 0;
125
try
126
{
127
for
(
IOSize
i
= 0;
i
< buffers; done +=
status
, ++
i
)
128
if
((status =
read
(into [
i
])) == 0)
129
break
;
130
}
131
catch
(
cms::Exception
&)
132
{
133
if
(! done)
134
throw
;
135
}
136
137
return
done
;
138
}
139
143
165
IOSize
166
IOInput::xread
(
IOBuffer
into)
167
{
return
xread
(into.
data
(), into.
size
()); }
168
190
IOSize
191
IOInput::xread
(
void
*into,
IOSize
n
)
192
{
193
assert
(into);
194
195
// Keep reading as long as possible. Let system errors fly over
196
// us, they are a hard error.
197
IOSize
x
;
198
IOSize
done
= 0;
199
while
(done < n && (x =
read
((
char
*) into + done, n - done)))
200
done +=
x
;
201
202
return
done
;
203
}
204
228
IOSize
229
IOInput::xreadv
(
IOBuffer
*into,
IOSize
buffers)
230
{
231
// FIXME: Use read(into, buffers) and then sort out in case of
232
// failure, the readv probably succeed directly with much less
233
// overhead.
234
235
assert
(! buffers || into);
236
237
// Keep reading as long as possible. Let system errors fly
238
// over us, they are a hard error.
239
IOSize
x
;
240
IOSize
done
= 0;
241
for
(
IOSize
i
= 0;
i
< buffers; ++
i
)
242
{
243
done += (x =
xread
(into [
i
]));
244
if
(x < into [i].
size
())
245
break
;
246
}
247
return
done
;
248
}
i
int i
Definition:
DBlmapReader.cc:9
IOBuffer::data
void * data(void) const
Definition:
IOBuffer.h:45
assert
assert(m_qm.get())
IOInput::xread
IOSize xread(IOBuffer into)
Definition:
IOInput.cc:166
IOInput::~IOInput
virtual ~IOInput(void)
Destruct the stream. A no-op.
Definition:
IOInput.cc:6
fileCollector.done
done
Definition:
fileCollector.py:121
IOInput::readv
virtual IOSize readv(IOBuffer *into, IOSize buffers)
Definition:
IOInput.cc:117
EDMException.h
IOInput::xreadv
IOSize xreadv(IOBuffer *into, IOSize buffers)
Definition:
IOInput.cc:229
IOInput::read
int read(void)
Definition:
IOInput.cc:54
IOBuffer::size
IOSize size(void) const
Definition:
IOBuffer.h:50
cms::Exception
Definition:
Exception.h:68
IOBuffer
Definition:
IOBuffer.h:7
gen::n
int n
Definition:
Cascade2Hadronizer.cc:79
IOInput.h
IOSize
size_t IOSize
Definition:
IOTypes.h:14
DDAxes::x
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:442
mps_update.status
tuple status
Definition:
mps_update.py:57
Generated for CMSSW Reference Manual by
1.8.5