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
cms::cuda::assert
assert(be >=bs)
gs
Definition: AbsArchive.cc:45
data-class-funcs.classname
classname
Definition: data-class-funcs.py:33
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
operator==
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Definition: QGLikelihoodObject.h:49
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
alignCSCRings.r
r
Definition: alignCSCRings.py:93
writeEcalDQMStatus.write
write
Definition: writeEcalDQMStatus.py:48
unpackBuffers-CaloStage1.offsets
offsets
Definition: unpackBuffers-CaloStage1.py:127
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45