#include <cassert>
#include <sstream>
#include "Alignment/Geners/interface/AbsArchive.hh"
#include "Alignment/Geners/interface/IOException.hh"
Go to the source code of this file.
#define GS_STREAM_COPY_BUFFER_SIZE 65536 |
static void archive_stream_copy |
( |
std::istream & |
in, |
|
|
std::size_t |
count, |
|
|
std::ostream & |
out |
|
) |
| |
|
static |
Definition at line 9 of file AbsArchive.cc.
References GS_STREAM_COPY_BUFFER_SIZE.
17 bool in_fail =
in.fail();
18 bool out_fail =
out.fail();
19 while (
count > bufsize && !in_fail && !out_fail)
21 in.read(buffer, bufsize);
25 out.write(buffer, bufsize);
26 out_fail =
out.fail();
30 if (!in_fail && !out_fail)
#define GS_STREAM_COPY_BUFFER_SIZE
static std::string local_error_message |
( |
gs::AbsArchive & |
ar, |
|
|
const gs::AbsRecord & |
record, |
|
|
const char * |
failedAction |
|
) |
| |
|
static |
Definition at line 143 of file AbsArchive.cc.
Referenced by operator<<().
147 std::ostringstream err;
148 err <<
"In operator<<(gs::AbsArchive& ar, const gs::AbsRecord& record): "
149 <<
"failed to " << failedAction <<
" to the archive \""
150 << ar.name() <<
"\" for item with type \""
151 <<
record.type().name() <<
"\", name \""
152 <<
record.name() <<
"\", and category \""
153 <<
record.category() <<
'"';
gs::AbsArchive& operator<< |
( |
gs::AbsArchive & |
ar, |
|
|
const gs::AbsRecord & |
record |
|
) |
| |
Definition at line 157 of file AbsArchive.cc.
References newFWLiteAna::base, delta, and local_error_message().
160 if (
record.id())
throw gs::IOInvalidArgument(
161 "In operator<<(gs::AbsArchive& ar, const gs::AbsRecord& record): "
162 "records can not be reused");
169 std::ostream& os = ar.outputStream();
170 std::streampos
base = os.tellp();
171 std::ostream& compressed = ar.compressedStream(os);
174 if (!
record.writeData(compressed))
177 const unsigned compressCode = ar.flushCompressedRecord(compressed);
180 ar,
record,
"transfer compressed data"));
183 std::streamoff off = os.tellp() -
base;
184 const long long delta = off;
185 assert(delta >= 0LL);
188 const unsigned long long id = ar.addToCatalog(
record, compressCode, delta);
191 ar,
record,
"add catalog entry"));
199 ar.lastItemLength_ =
delta;
static std::string local_error_message(gs::AbsArchive &ar, const gs::AbsRecord &record, const char *failedAction)