CMS 3D CMS Logo

DualAxis.cc
Go to the documentation of this file.
2 
3 #include "Alignment/Geners/interface/binaryIO.hh"
4 #include "Alignment/Geners/interface/IOException.hh"
5 #include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
6 
7 namespace npstat {
8  bool DualAxis::write(std::ostream& of) const {
9  unsigned char c = uniform_;
10  gs::write_pod(of, c);
11  if (uniform_)
12  return !of.fail() && u_.classId().write(of) && u_.write(of);
13  else
14  return !of.fail() && a_.classId().write(of) && a_.write(of);
15  }
16 
17  DualAxis* DualAxis::read(const gs::ClassId& id, std::istream& in) {
18  static const gs::ClassId current(gs::ClassId::makeId<DualAxis>());
19  current.ensureSameId(id);
20 
21  unsigned char c;
22  gs::read_pod(in, &c);
23  gs::ClassId clid(in, 1);
24  if (in.fail())
25  throw gs::IOReadFailure(
26  "In npstat::DualAxis::read: "
27  "input stream failure");
28  if (c) {
29  CPP11_auto_ptr<UniformAxis> axis(UniformAxis::read(clid, in));
30  return new DualAxis(*axis);
31  } else {
32  CPP11_auto_ptr<GridAxis> axis(GridAxis::read(clid, in));
33  return new DualAxis(*axis);
34  }
35  }
36 } // namespace npstat
npstat::DualAxis::a_
GridAxis a_
Definition: DualAxis.h:104
npstat::DualAxis::write
bool write(std::ostream &of) const
Definition: DualAxis.cc:8
npstat
Definition: AbsArrayProjector.h:14
npstat::DualAxis::uniform_
bool uniform_
Definition: DualAxis.h:106
npstat::UniformAxis::read
static UniformAxis * read(const gs::ClassId &id, std::istream &in)
Definition: UniformAxis.cc:100
npstat::GridAxis::read
static GridAxis * read(const gs::ClassId &id, std::istream &in)
Definition: GridAxis.cc:117
npstat::UniformAxis::classId
gs::ClassId classId() const
Definition: UniformAxis.h:74
npstat::GridAxis::classId
gs::ClassId classId() const
Definition: GridAxis.h:108
npstat::DualAxis::DualAxis
DualAxis()
Definition: DualAxis.h:114
recoMuon::in
Definition: RecoMuonEnumerators.h:6
npstat::UniformAxis::write
bool write(std::ostream &of) const
Definition: UniformAxis.cc:92
npstat::DualAxis::u_
UniformAxis u_
Definition: DualAxis.h:105
DualAxis.h
Represent both equidistant and non-uniform coordinate sets for rectangular grids.
npstat::DualAxis
Definition: DualAxis.h:24
npstat::DualAxis::read
static DualAxis * read(const gs::ClassId &id, std::istream &in)
Definition: DualAxis.cc:17
npstat::GridAxis::write
bool write(std::ostream &of) const
Definition: GridAxis.cc:108
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56