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 * $Id: AssociationMapHelpers.h,v 1.3 2007/12/21 22:42:29 wmtan Exp $ 00010 * 00011 */ 00012 #include "FWCore/Utilities/interface/EDMException.h" 00013 00014 namespace edm { 00015 namespace helpers { 00016 template<typename K, typename V> 00017 struct KeyVal { 00018 typedef K key_type; 00019 typedef V value_type; 00020 KeyVal() { } 00021 KeyVal(const K & k, const V & v) : key(k), val(v) { } 00022 K key; 00023 V val; 00024 }; 00025 00026 template<typename K> 00027 struct Key { 00028 typedef K key_type; 00029 Key() { } 00030 Key(const K & k) : key(k) { } 00031 K key; 00032 }; 00033 00035 template<typename RP, typename R> 00036 void checkRef(const RP & rp, const R & r) { 00037 if (rp.id() != r.id()) 00038 throw edm::Exception(edm::errors::InvalidReference, "invalid reference"); 00039 } 00040 } 00041 } 00042 00043 #endif