Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:18

0001 #ifndef GENERS_CPBUFFERREFERENCE_HH_
0002 #define GENERS_CPBUFFERREFERENCE_HH_
0003 
0004 #include <cassert>
0005 
0006 #include "Alignment/Geners/interface/AbsReference.hh"
0007 #include "Alignment/Geners/interface/ColumnBuffer.hh"
0008 #include "Alignment/Geners/interface/binaryIO.hh"
0009 
0010 namespace gs {
0011     namespace Private {
0012         class CPBufferReference : public AbsReference
0013         {
0014         public:
0015             inline CPBufferReference(AbsArchive& ar,
0016                                      const ClassId& bufClass,
0017                                      const ClassId& cbClass,
0018                                      const unsigned long long itemId)
0019                 : AbsReference(ar, bufClass, "gs::CPBuffer", itemId),
0020                   bufClass_(bufClass), cbClass_(cbClass) {}
0021 
0022             inline void restore(const unsigned long number,
0023                                 ColumnBuffer* obj, unsigned long* column) const
0024             {
0025                 const unsigned long long itemId = this->id(number);
0026                 assert(itemId);
0027                 std::istream& is = this->positionInputStream(itemId);
0028                 read_pod(is, column);
0029                 if (is.fail()) throw IOReadFailure(
0030                     "In gs::Private::CPBufferReference::restore: "
0031                     "input stream failure");
0032                 ColumnBuffer::restore(bufClass_, cbClass_, is, obj);
0033             }
0034 
0035         private:
0036             const ClassId& bufClass_;
0037             const ClassId& cbClass_;
0038         };
0039     }
0040 }
0041 
0042 #endif // GENERS_CPBUFFERREFERENCE_HH_
0043