Go to the documentation of this file.00001 #include "JetMETCorrections/InterpolationTables/interface/DualHistoAxis.h"
00002
00003 #include "Alignment/Geners/interface/binaryIO.hh"
00004 #include "Alignment/Geners/interface/IOException.hh"
00005 #include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
00006
00007 namespace npstat {
00008 bool DualHistoAxis::write(std::ostream& of) const
00009 {
00010 unsigned char c = uniform_;
00011 gs::write_pod(of, c);
00012 if (uniform_)
00013 return !of.fail() && u_.classId().write(of) && u_.write(of);
00014 else
00015 return !of.fail() && a_.classId().write(of) && a_.write(of);
00016 }
00017
00018 DualHistoAxis* DualHistoAxis::read(const gs::ClassId& id, std::istream& in)
00019 {
00020 static const gs::ClassId current(gs::ClassId::makeId<DualHistoAxis>());
00021 current.ensureSameId(id);
00022
00023 unsigned char c;
00024 gs::read_pod(in, &c);
00025 gs::ClassId clid(in, 1);
00026 if (in.fail())
00027 throw gs::IOReadFailure("In npstat::DualHistoAxis::read: "
00028 "input stream failure");
00029 if (c)
00030 {
00031 CPP11_auto_ptr<HistoAxis> axis(HistoAxis::read(clid, in));
00032 return new DualHistoAxis(*axis);
00033 }
00034 else
00035 {
00036 CPP11_auto_ptr<NUHistoAxis> axis(NUHistoAxis::read(clid, in));
00037 return new DualHistoAxis(*axis);
00038 }
00039 }
00040 }