CMS 3D CMS Logo

Public Types | Static Public Member Functions | Private Types

edm::OneToMany< CKey, CVal, index > Class Template Reference

#include <OneToMany.h>

List of all members.

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 data_type &v)
 insert in the map
static void insert (ref_type &ref, map_type &m, const key_type &k, const val_type &v)
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

Detailed Description

template<typename CKey, typename CVal, typename index = unsigned int>
class edm::OneToMany< CKey, CVal, index >

Definition at line 12 of file OneToMany.h.


Member Typedef Documentation

template<typename CKey, typename CVal, typename index = unsigned int>
typedef edm::Ref<CVal> edm::OneToMany< CKey, CVal, index >::data_type

insert val type

Definition at line 25 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef index edm::OneToMany< CKey, CVal, index >::index_type

index type

Definition at line 27 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef edm::Ref<CKey> edm::OneToMany< CKey, CVal, index >::key_type

insert key type

Definition at line 23 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef edm::RefProd<CKey> edm::OneToMany< CKey, CVal, index >::KeyRefProd [private]

reference to "key" collection

Definition at line 14 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef std::vector<index> edm::OneToMany< CKey, CVal, index >::map_assoc [private]

internal map associated data

Definition at line 18 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef std::map<index_type, map_assoc > edm::OneToMany< CKey, CVal, index >::map_type

map type

Definition at line 29 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef helpers::KeyVal<KeyRefProd, ValRefProd> edm::OneToMany< CKey, CVal, index >::ref_type

reference set type

Definition at line 31 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef std::vector<const typename CKey::value_type *> edm::OneToMany< CKey, CVal, index >::transient_key_vector

transient key vector

Definition at line 37 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef std::map<const typename CKey::value_type *, std::vector<const typename CVal::value_type *> > edm::OneToMany< CKey, CVal, index >::transient_map_type

transient map type

Definition at line 35 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef std::vector<std::vector<const typename CVal::value_type *> > edm::OneToMany< CKey, CVal, index >::transient_val_vector

transient val vector

Definition at line 39 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef edm::RefVector<CVal> edm::OneToMany< CKey, CVal, index >::val_type

values reference collection type

Definition at line 21 of file OneToMany.h.

template<typename CKey, typename CVal, typename index = unsigned int>
typedef edm::RefProd<CVal> edm::OneToMany< CKey, CVal, index >::ValRefProd [private]

reference to "value" collection

Definition at line 16 of file OneToMany.h.


Member Function Documentation

template<typename CKey, typename CVal, typename index = unsigned int>
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.

Referenced by edm::OneToMany< JetC, reco::TrackCollection >::insert().

                                                                 {
      if (k.isNull() || v.isNull())
        Exception::throwThis(errors::InvalidReference,
          "can't insert null references in AssociationMap");
      if (ref.key.isNull()) {
        ref.key = KeyRefProd(k);
        ref.val = ValRefProd(v);
      }
      helpers::checkRef(ref.key, k); helpers::checkRef(ref.val, v);
      index_type ik = index_type(k.key()), iv = index_type(v.key());
      m[ ik ].push_back(iv);
    }
template<typename CKey, typename CVal, typename index = unsigned int>
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.

                                                                                             {
      for(typename val_type::const_iterator i = v.begin(), iEnd = v.end(); i != iEnd; ++i)
      insert(ref, m, k, *i);
    }
template<typename CKey, typename CVal, typename index = unsigned int>
static map_type::size_type edm::OneToMany< CKey, CVal, index >::size ( const map_assoc v) [inline, static]

size of data_type

Definition at line 66 of file OneToMany.h.

{ return v.size(); }
template<typename CKey, typename CVal, typename index = unsigned int>
static void edm::OneToMany< CKey, CVal, index >::sort ( map_type ) [inline, static]

sort

Definition at line 68 of file OneToMany.h.

{ }
template<typename CKey, typename CVal, typename index = unsigned int>
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.

                                                                                               {
      transient_key_vector m;
      const CKey & ckey = * ref.key;
      for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i)
        m.push_back(& ckey[i->first]);
      return m;
    }
template<typename CKey, typename CVal, typename index = unsigned int>
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.

                                                                                       {
      transient_map_type m;
      const CKey & ckey = * ref.key;
      const CVal & cval = * ref.val;
      for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) {
        const map_assoc & a = i->second;
        const typename CKey::value_type * k = & ckey[ i->first ];
        std::vector<const typename CVal::value_type *> v;
        for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j) {
          const typename CVal::value_type * val = & cval[ *j ];
          v.push_back(val);
        }
        m.insert(std::make_pair(k, v));
      }
      return m;
    }
template<typename CKey, typename CVal, typename index = unsigned int>
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.

                                                                                               {
      transient_val_vector m;
      const CVal & cval = * ref.val;
      for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) {
        const map_assoc & a = i->second;
        std::vector<const typename CVal::value_type *> v;
        m.push_back(v);
        for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j)
          m.back().push_back(& cval[ *j ]);
      }
      return m;
    }
template<typename CKey, typename CVal, typename index = unsigned int>
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.

Referenced by edm::OneToMany< JetC, reco::TrackCollection >::transientMap().

                                                                    {
      val_type v;
      for(typename map_assoc::const_iterator idx = iv.begin(), idxEnd = iv.end(); idx != idxEnd; ++idx)
        v.push_back(edm::Ref<CVal>(ref.val, *idx));
      return v;
    }