4 #include "Alignment/Geners/interface/AbsArchive.hh"
5 #include "Alignment/Geners/interface/IOException.hh"
8 AbsArchive::AbsArchive(
const char*
name)
9 : name_(name ? name :
""),
15 void AbsArchive::addItemToReference(AbsReference&
r,
16 const unsigned long long id)
const
23 const gs::AbsRecord&
record,
24 const char* failedAction)
26 std::ostringstream err;
27 err <<
"In operator<<(gs::AbsArchive& ar, const gs::AbsRecord& record): "
28 <<
"failed to " << failedAction <<
" to the archive \""
29 << ar.name() <<
"\" for item with type \""
30 << record.type().name() <<
"\", name \""
31 << record.name() <<
"\", and category \""
32 << record.category() <<
'"';
39 if (record.id())
throw gs::IOInvalidArgument(
40 "In operator<<(gs::AbsArchive& ar, const gs::AbsRecord& record): "
41 "records can not be reused");
48 std::ostream& os = ar.outputStream();
49 std::streampos
base = os.tellp();
50 std::ostream& compressed = ar.compressedStream(os);
53 if (!record.writeData(compressed))
56 const unsigned compressCode = ar.flushCompressedRecord(compressed);
59 ar, record,
"transfer compressed data"));
62 std::streamoff off = os.tellp() -
base;
63 long long delta = off;
67 const unsigned long long id = ar.addToCatalog(record, compressCode, delta);
70 ar, record,
"add catalog entry"));
74 record.itemLength_ =
delta;
78 ar.lastItemLength_ =
delta;
std::ostream & operator<<(std::ostream &out, const ALILine &li)
static std::string local_error_message(gs::AbsArchive &ar, const gs::AbsRecord &record, const char *failedAction)