Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GENERS_RPREFERENCE_HH_
0002 #define GENERS_RPREFERENCE_HH_
0003 
0004 #include "Alignment/Geners/interface/CPP11_config.hh"
0005 #ifdef CPP11_STD_AVAILABLE
0006 
0007 #include <memory>
0008 
0009 #include "Alignment/Geners/interface/AbsReference.hh"
0010 #include "Alignment/Geners/interface/ClassId.hh"
0011 
0012 namespace gs {
0013     template <typename RP>
0014     class RPReference : public AbsReference
0015     {
0016     public:
0017         inline RPReference(AbsArchive& ar, const unsigned long long itemId)
0018            : AbsReference(ar, ClassId::makeId<RP>(), "gs::RPHeader", itemId) {}
0019 
0020         inline RPReference(
0021             AbsArchive& ar, const SearchSpecifier& namePattern,
0022             const SearchSpecifier& categPattern)
0023             : AbsReference(ar, ClassId::makeId<RP>(), "gs::RPHeader",
0024                            namePattern, categPattern) {}
0025 
0026         inline std::unique_ptr<RP> get(const unsigned long index) const
0027             {return std::unique_ptr<RP>(getPtr(index));}
0028 
0029         inline std::shared_ptr<RP> getShared(
0030             const unsigned long index) const
0031             {return std::shared_ptr<RP>(getPtr(index));}
0032 
0033     private:
0034         inline RP* getPtr(const unsigned long number) const
0035         {
0036             const unsigned long long itemId = this->id(number);
0037             assert(itemId);
0038             return RP::read(archive(),
0039                             this->positionInputStream(itemId),
0040                             itemId);
0041         }
0042     };
0043 }
0044 
0045 #endif // CPP11_STD_AVAILABLE
0046 #endif // GENERS_RPREFERENCE_HH_
0047