CMS 3D CMS Logo

ColumnBuffer.cc
Go to the documentation of this file.
1 #include "Alignment/Geners/interface/ColumnBuffer.hh"
2 #include "Alignment/Geners/interface/streamposIO.hh"
3 
4 namespace gs {
5  namespace Private {
6  bool ColumnBuffer::write(std::ostream &os) const {
7  write_pod(os, firstrow);
8  write_pod(os, lastrowp1);
9  const unsigned char isPod = (podsize ? 1 : 0);
10  write_pod(os, isPod);
11  if (isPod)
12  write_pod(os, podsize);
13  else
14  write_pod_vector(os, offsets);
15  return !os.fail() && buf.write(os);
16  }
17 
18  void ColumnBuffer::restore(const ClassId &id, const ClassId &bufId, std::istream &is, ColumnBuffer *obj) {
19  assert(obj);
20  obj->classId().ensureSameId(id);
21 
22  read_pod(is, &obj->firstrow);
23  read_pod(is, &obj->lastrowp1);
24  unsigned char isPod;
25  read_pod(is, &isPod);
26  if (isPod) {
27  obj->offsets.clear();
28  read_pod(is, &obj->podsize);
29  } else {
30  obj->podsize = 0;
31  read_pod_vector(is, &obj->offsets);
32  }
33  if (is.fail())
34  throw IOReadFailure("In gs::Private::ColumnBuffer::restore: input stream failure");
35 
36  // Size of a POD object can not be zero
37  if (isPod && !obj->podsize)
38  throw IOInvalidData("In gs::Private::ColumnBuffer::restore: corrupted record");
39 
40  CharBuffer::restore(bufId, is, &obj->buf);
41  }
42 
43  bool ColumnBuffer::operator==(const ColumnBuffer &r) const {
44  return firstrow == r.firstrow && lastrowp1 == r.lastrowp1 && podsize == r.podsize && offsets == r.offsets &&
45  buf == r.buf;
46  }
47 
48  const ClassId &ColumnBuffer::static_classId() {
49  static const ClassId classId_(ClassId(classname(), version()));
50  return classId_;
51  }
52  } // namespace Private
53 } // namespace gs
assert(be >=bs)
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Definition: AbsArchive.cc:46