#include <DataFormats/Common/interface/OneToMany.h>
Public Types | |
typedef edm::Ref< CVal > | data_type |
insert val type | |
typedef index | index_type |
index type | |
typedef edm::Ref< CKey > | key_type |
insert key type | |
typedef std::map< index_type, map_assoc > | map_type |
map type | |
typedef helpers::KeyVal < KeyRefProd, ValRefProd > | ref_type |
reference set type | |
typedef std::vector< const typename CKey::value_type * > | transient_key_vector |
transient key vector | |
typedef std::map< const typename CKey::value_type *, std::vector< const typename CVal::value_type * > > | transient_map_type |
transient map type | |
typedef std::vector < std::vector< const typename CVal::value_type * > > | transient_val_vector |
transient val vector | |
typedef edm::RefVector< CVal > | val_type |
values reference collection type | |
Static Public Member Functions | |
static void | insert (ref_type &ref, map_type &m, const key_type &k, const val_type &v) |
static void | insert (ref_type &ref, map_type &m, const key_type &k, const data_type &v) |
insert in the map | |
static map_type::size_type | size (const map_assoc &v) |
size of data_type | |
static void | sort (map_type &) |
sort | |
static transient_key_vector | transientKeyVector (const ref_type &ref, const map_type &map) |
fill transient key vector | |
static transient_map_type | transientMap (const ref_type &ref, const map_type &map) |
fill transient map | |
static transient_val_vector | transientValVector (const ref_type &ref, const map_type &map) |
fill transient val vector | |
static val_type | val (const ref_type &ref, const map_assoc &iv) |
return values collection | |
Private Types | |
typedef edm::RefProd< CKey > | KeyRefProd |
reference to "key" collection | |
typedef std::vector< index > | map_assoc |
internal map associated data | |
typedef edm::RefProd< CVal > | ValRefProd |
reference to "value" collection |
Definition at line 12 of file OneToMany.h.
typedef edm::Ref<CVal> edm::OneToMany< CKey, CVal, index >::data_type |
typedef index edm::OneToMany< CKey, CVal, index >::index_type |
typedef edm::Ref<CKey> edm::OneToMany< CKey, CVal, index >::key_type |
typedef edm::RefProd<CKey> edm::OneToMany< CKey, CVal, index >::KeyRefProd [private] |
typedef std::vector<index> edm::OneToMany< CKey, CVal, index >::map_assoc [private] |
typedef std::map<index_type, map_assoc > edm::OneToMany< CKey, CVal, index >::map_type |
typedef helpers::KeyVal<KeyRefProd, ValRefProd> edm::OneToMany< CKey, CVal, index >::ref_type |
typedef std::vector<const typename CKey::value_type *> edm::OneToMany< CKey, CVal, index >::transient_key_vector |
typedef std::map<const typename CKey::value_type *, std::vector<const typename CVal::value_type *> > edm::OneToMany< CKey, CVal, index >::transient_map_type |
typedef std::vector<std::vector<const typename CVal::value_type *> > edm::OneToMany< CKey, CVal, index >::transient_val_vector |
typedef edm::RefVector<CVal> edm::OneToMany< CKey, CVal, index >::val_type |
typedef edm::RefProd<CVal> edm::OneToMany< CKey, CVal, index >::ValRefProd [private] |
static void edm::OneToMany< CKey, CVal, index >::insert | ( | ref_type & | ref, | |
map_type & | m, | |||
const key_type & | k, | |||
const val_type & | v | |||
) | [inline, static] |
Definition at line 54 of file OneToMany.h.
References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), i, and edm::OneToMany< CKey, CVal, index >::insert().
00054 { 00055 for(typename val_type::const_iterator i = v.begin(), iEnd = v.end(); i != iEnd; ++i) 00056 insert(ref, m, k, *i); 00057 }
static void edm::OneToMany< CKey, CVal, index >::insert | ( | ref_type & | ref, | |
map_type & | m, | |||
const key_type & | k, | |||
const data_type & | v | |||
) | [inline, static] |
insert in the map
Definition at line 41 of file OneToMany.h.
References edm::helpers::checkRef(), edm::errors::InvalidReference, edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), edm::helpers::KeyVal< K, V >::key, and edm::helpers::KeyVal< K, V >::val.
Referenced by edm::OneToMany< CKey, CVal, index >::insert().
00042 { 00043 if (k.isNull() || v.isNull()) 00044 throw edm::Exception(edm::errors::InvalidReference) 00045 << "can't insert null references in AssociationMap"; 00046 if (ref.key.isNull()) { 00047 ref.key = KeyRefProd(k); 00048 ref.val = ValRefProd(v); 00049 } 00050 helpers::checkRef(ref.key, k); helpers::checkRef(ref.val, v); 00051 index_type ik = index_type(k.key()), iv = index_type(v.key()); 00052 m[ ik ].push_back(iv); 00053 }
static map_type::size_type edm::OneToMany< CKey, CVal, index >::size | ( | const map_assoc & | v | ) | [inline, static] |
static void edm::OneToMany< CKey, CVal, index >::sort | ( | map_type & | ) | [inline, static] |
static transient_key_vector edm::OneToMany< CKey, CVal, index >::transientKeyVector | ( | const ref_type & | ref, | |
const map_type & | map | |||
) | [inline, static] |
fill transient key vector
Definition at line 87 of file OneToMany.h.
References i, edm::helpers::KeyVal< K, V >::key, and m.
00087 { 00088 transient_key_vector m; 00089 const CKey & ckey = * ref.key; 00090 for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) 00091 m.push_back(& ckey[i->first]); 00092 return m; 00093 }
static transient_map_type edm::OneToMany< CKey, CVal, index >::transientMap | ( | const ref_type & | ref, | |
const map_type & | map | |||
) | [inline, static] |
fill transient map
Definition at line 70 of file OneToMany.h.
References a, i, j, k, edm::helpers::KeyVal< K, V >::key, m, edm::RefVector< C, T, F >::push_back(), v, edm::helpers::KeyVal< K, V >::val, and edm::OneToMany< CKey, CVal, index >::val().
00070 { 00071 transient_map_type m; 00072 const CKey & ckey = * ref.key; 00073 const CVal & cval = * ref.val; 00074 for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) { 00075 const map_assoc & a = i->second; 00076 const typename CKey::value_type * k = & ckey[ i->first ]; 00077 std::vector<const typename CVal::value_type *> v; 00078 for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j) { 00079 const typename CVal::value_type * val = & cval[ *j ]; 00080 v.push_back(val); 00081 } 00082 m.insert(std::make_pair(k, v)); 00083 } 00084 return m; 00085 }
static transient_val_vector edm::OneToMany< CKey, CVal, index >::transientValVector | ( | const ref_type & | ref, | |
const map_type & | map | |||
) | [inline, static] |
fill transient val vector
Definition at line 95 of file OneToMany.h.
References a, i, j, m, v, and edm::helpers::KeyVal< K, V >::val.
00095 { 00096 transient_val_vector m; 00097 const CVal & cval = * ref.val; 00098 for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) { 00099 const map_assoc & a = i->second; 00100 std::vector<const typename CVal::value_type *> v; 00101 m.push_back(v); 00102 for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j) 00103 m.back().push_back(& cval[ *j ]); 00104 } 00105 return m; 00106 }
static val_type edm::OneToMany< CKey, CVal, index >::val | ( | const ref_type & | ref, | |
const map_assoc & | iv | |||
) | [inline, static] |
return values collection
Definition at line 59 of file OneToMany.h.
References edm::RefVector< C, T, F >::push_back(), v, and edm::helpers::KeyVal< K, V >::val.
Referenced by edm::OneToMany< CKey, CVal, index >::transientMap().
00059 { 00060 val_type v; 00061 for(typename map_assoc::const_iterator idx = iv.begin(), idxEnd = iv.end(); idx != idxEnd; ++idx) 00062 v.push_back(edm::Ref<CVal>(ref.val, *idx)); 00063 return v; 00064 }