CMS 3D CMS Logo

HolderToVectorTrait.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_HolderToVectorTrait_h
00002 #define DataFormats_Common_HolderToVectorTrait_h
00003 #include "FWCore/Utilities/interface/EDMException.h"
00004 //#include <boost/static_assert.hpp>
00005 
00006 namespace edm {
00007   namespace reftobase {
00008     class RefVectorHolderBase;
00009     template <typename T> class BaseVectorHolder;
00010 
00011     template <typename T, typename REF>
00012     struct InvaidHolderToVector {
00013       static std::auto_ptr<BaseVectorHolder<T> > makeVectorHolder() {
00014         throw edm::Exception(errors::InvalidReference)
00015           << "InvaidHolderToVector: trying to use RefToBase built with "
00016           << "an internal type. RefToBase should be built passing an "
00017           << "object of type edm::Ref<C>. This exception should never "
00018           << "be thrown if a RefToBase was built from a RefProd<C>.";
00019       }
00020       static std::auto_ptr<RefVectorHolderBase> makeVectorBaseHolder() {
00021         throw edm::Exception(errors::InvalidReference)
00022           << "InvaidHolderToVector: trying to use RefToBase built with "
00023           << "an internal type. RefToBase should be built passing an "
00024           << "object of type edm::Ref<C>. This exception should never "
00025           << "be thrown if a RefToBase was built from a RefProd<C>.";
00026       }
00027     };
00028 
00029     template<typename T, typename REF>
00030     struct HolderToVectorTrait {
00031       //      BOOST_STATIC_ASSERT(sizeof(REF) == 0); 
00032       typedef InvaidHolderToVector<T, REF> type;
00033     };
00034 
00035     template <typename REF>
00036     struct InvalidRefHolderToRefVector {
00037       static std::auto_ptr<RefVectorHolderBase> makeVectorHolder() {
00038         throw edm::Exception(errors::InvalidReference)
00039           << "InvaidRefHolderToRefVector: trying to use RefToBaseVector built with "
00040           << "an internal type. RefToBase should be built passing an "
00041           << "object of type edm::RefVector<C>";
00042       }
00043       static std::auto_ptr<RefVectorHolderBase> makeVectorBaseHolder() {
00044         throw edm::Exception(errors::InvalidReference)
00045           << "InvaidRefHolderToRefVector: trying to use RefToBaseVector built with "
00046           << "an internal type. RefToBase should be built passing an "
00047           << "object of type edm::RefVector<C>";
00048       }
00049     };
00050     
00051     template<typename REF>
00052     struct RefHolderToRefVectorTrait {
00053       //      BOOST_STATIC_ASSERT(sizeof(REF) == 0); 
00054       typedef InvalidRefHolderToRefVector<REF> type;
00055     };
00056 
00057   }
00058 }
00059 
00060 #endif

Generated on Tue Jun 9 17:29:04 2009 for CMSSW by  doxygen 1.5.4