CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Static Public Member Functions | Private Types
edm::OneToMany< CKey, CVal, index > Class Template Reference

#include <OneToMany.h>

Public Types

typedef edm::Ref< CVal > data_type
 insert val type More...
 
typedef index index_type
 index type More...
 
typedef edm::Ref< CKey > key_type
 insert key type More...
 
typedef std::map< index_type,
map_assoc
map_type
 map type More...
 
typedef helpers::KeyVal
< KeyRefProd, ValRefProd
ref_type
 reference set type More...
 
typedef std::vector< const
typename CKey::value_type * > 
transient_key_vector
 transient key vector More...
 
typedef std::map< const
typename CKey::value_type
*, std::vector< const typename
CVal::value_type * > > 
transient_map_type
 transient map type More...
 
typedef std::vector
< std::vector< const typename
CVal::value_type * > > 
transient_val_vector
 transient val vector More...
 
typedef edm::RefVector< CVal > val_type
 values reference collection type More...
 

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 More...
 
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 More...
 
static void sort (map_type &)
 sort More...
 
static transient_key_vector transientKeyVector (const ref_type &ref, const map_type &map)
 fill transient key vector More...
 
static transient_map_type transientMap (const ref_type &ref, const map_type &map)
 fill transient map More...
 
static transient_val_vector transientValVector (const ref_type &ref, const map_type &map)
 fill transient val vector More...
 
static val_type val (const ref_type &ref, const map_assoc &iv)
 return values collection More...
 

Private Types

typedef edm::RefProd< CKey > KeyRefProd
 reference to "key" collection More...
 
typedef std::vector< index > map_assoc
 internal map associated data More...
 
typedef edm::RefProd< CVal > ValRefProd
 reference to "value" collection More...
 

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 
)
inlinestatic

insert in the map

Definition at line 41 of file OneToMany.h.

Referenced by BeautifulSoup.PageElement::_invert(), and edm::OneToMany< reco::TrackJetCollection, reco::TrackCollection >::insert().

42  {
43  if (k.isNull() || v.isNull())
45  "can't insert null references in AssociationMap");
46  if(ref.key.isNull()) {
47  if(k.isTransient() || v.isTransient()) {
49  "can't insert transient references in uninitialized AssociationMap");
50  }
51  //another thread might cause productGetter() to change values
52  EDProductGetter const* getter = ref.key.productGetter();
53  if(getter == nullptr) {
55  "Can't insert into AssociationMap unless it was properly initialized.\n"
56  "The most common fix for this is to add arguments to the call to the\n"
57  "AssociationMap constructor that are valid Handle's to the containers.\n"
58  "If you don't have valid handles or either template parameter to the\n"
59  "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
60  "(note this was a new requirement added in the 7_5_X release series)\n");
61  }
62  ref.key = KeyRefProd(k.id(), getter);
63  ref.val = ValRefProd(v.id(), ref.val.productGetter());
64  }
65  helpers::checkRef(ref.key, k); helpers::checkRef(ref.val, v);
66  index_type ik = index_type(k.key()), iv = index_type(v.key());
67  m[ ik ].push_back(iv);
68  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
index index_type
index type
Definition: OneToMany.h:27
edm::RefProd< CKey > KeyRefProd
reference to &quot;key&quot; collection
Definition: OneToMany.h:14
edm::RefProd< CVal > ValRefProd
reference to &quot;value&quot; collection
Definition: OneToMany.h:16
void checkRef(const RP &rp, const R &r)
throw if r hasn&#39;t the same id as rp
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 
)
inlinestatic

Definition at line 69 of file OneToMany.h.

Referenced by BeautifulSoup.PageElement::_invert().

69  {
70  for(typename val_type::const_iterator i = v.begin(), iEnd = v.end(); i != iEnd; ++i)
71  insert(ref, m, k, *i);
72  }
int i
Definition: DBlmapReader.cc:9
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map
Definition: OneToMany.h:41
iterator const_iterator
Definition: RefVector.h:39
template<typename CKey, typename CVal, typename index = unsigned int>
static map_type::size_type edm::OneToMany< CKey, CVal, index >::size ( const map_assoc v)
inlinestatic

size of data_type

Definition at line 81 of file OneToMany.h.

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

sort

Definition at line 83 of file OneToMany.h.

83 { }
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 
)
inlinestatic

fill transient key vector

Definition at line 104 of file OneToMany.h.

104  {
106  if(!map.empty()) {
107  const CKey & ckey = * ref.key;
108  for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i)
109  m.push_back(& ckey[i->first]);
110  }
111  return m;
112  }
int i
Definition: DBlmapReader.cc:9
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
Definition: OneToMany.h:37
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 
)
inlinestatic

fill transient map

Definition at line 85 of file OneToMany.h.

85  {
87  if(!map.empty()) {
88  const CKey & ckey = * ref.key;
89  const CVal & cval = * ref.val;
90  for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) {
91  const map_assoc & a = i->second;
92  const typename CKey::value_type * k = & ckey[ i->first ];
93  std::vector<const typename CVal::value_type *> v;
94  for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j) {
95  const typename CVal::value_type * val = & cval[ *j ];
96  v.push_back(val);
97  }
98  m.insert(std::make_pair(k, v));
99  }
100  }
101  return m;
102  }
std::map< const typename CKey::value_type *, std::vector< const typename CVal::value_type * > > transient_map_type
transient map type
Definition: OneToMany.h:35
int i
Definition: DBlmapReader.cc:9
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
Definition: OneToMany.h:74
int j
Definition: DBlmapReader.cc:9
double a
Definition: hdecay.h:121
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:62
std::vector< index > map_assoc
internal map associated data
Definition: OneToMany.h:18
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 
)
inlinestatic

fill transient val vector

Definition at line 114 of file OneToMany.h.

114  {
116  if(!map.empty()) {
117  const CVal & cval = * ref.val;
118  for(typename map_type::const_iterator i = map.begin(); i != map.end(); ++ i) {
119  const map_assoc & a = i->second;
120  std::vector<const typename CVal::value_type *> v;
121  m.push_back(v);
122  for(typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j)
123  m.back().push_back(& cval[ *j ]);
124  }
125  }
126  return m;
127  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
double a
Definition: hdecay.h:121
std::vector< std::vector< const typename CVal::value_type * > > transient_val_vector
transient val vector
Definition: OneToMany.h:39
std::vector< index > map_assoc
internal map associated data
Definition: OneToMany.h:18
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 
)
inlinestatic

return values collection

Definition at line 74 of file OneToMany.h.

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

74  {
75  val_type v;
76  for(typename map_assoc::const_iterator idx = iv.begin(), idxEnd = iv.end(); idx != idxEnd; ++idx)
77  v.push_back(edm::Ref<CVal>(ref.val, *idx));
78  return v;
79  }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::RefVector< CVal > val_type
values reference collection type
Definition: OneToMany.h:21