CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/Common/interface/AssociationMapHelpers.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_AssociationMapKeyVal_h
00002 #define DataFormats_Common_AssociationMapKeyVal_h
00003 /*
00004  *
00005  * helper classes for AssociationMap
00006  *
00007  * \author Luca Lista, INFN
00008  *
00009  *
00010  */
00011 #include "FWCore/Utilities/interface/EDMException.h"
00012 
00013 namespace edm {
00014   namespace helpers {
00015     template<typename K, typename V>
00016     struct KeyVal {
00017       typedef K key_type;
00018       typedef V value_type;
00019       KeyVal() { }
00020       KeyVal(const K & k, const V & v) : key(k), val(v) { }
00021       K key;
00022       V val;
00023     };
00024     
00025     template<typename K>
00026     struct Key {
00027       typedef K key_type;
00028       Key() { }
00029       Key(const K & k) : key(k) { }
00030       K key;
00031     };
00032     
00034     template<typename RP, typename R>
00035     void checkRef(const RP & rp, const R & r) {
00036       if (rp.id() != r.id()) {
00037         Exception::throwThis(edm::errors::InvalidReference, "invalid reference");
00038       }
00039     }
00040   }
00041 }
00042 
00043 #endif