CMS 3D CMS Logo

List of all members | Public Types | Static Public Member Functions | Private Types
edm::OneToValue< CKey, Val, index > Class Template Reference

#include <OneToValue.h>

Public Types

typedef Val data_type
 insert val type More...
 
typedef index index_type
 index type More...
 
typedef Ref< CKey > key_type
 insert key type More...
 
typedef std::map< index_type, map_assocmap_type
 map type More...
 
typedef helpers::Key< KeyRefProdref_type
 reference set type More...
 
typedef std::vector< typename CKey::value_type const * > transient_key_vector
 transient key vector More...
 
typedef std::map< typename CKey::value_type const *, Val > transient_map_type
 transient map type More...
 
typedef std::vector< Val > transient_val_vector
 transient val vector More...
 
typedef Val val_type
 values reference collection type More...
 

Static Public Member Functions

static void insert (ref_type &ref, map_type &m, key_type const &k, data_type const &v)
 insert in the map More...
 
static map_type::size_type size (map_assoc const &)
 size of data_type More...
 
static void sort (map_type &)
 sort More...
 
static transient_key_vector transientKeyVector (ref_type const &ref, map_type const &map)
 fill transient key vector More...
 
static transient_map_type transientMap (ref_type const &ref, map_type const &map)
 fill transient map More...
 
static transient_val_vector transientValVector (ref_type const &ref, map_type const &map)
 fill transient val vector More...
 
static val_type val (ref_type const &, map_assoc const &v)
 return values collection More...
 

Private Types

typedef RefProd< CKey > KeyRefProd
 reference to "key" collection More...
 
typedef Val map_assoc
 internal map associated data More...
 

Detailed Description

template<typename CKey, typename Val, typename index = unsigned int>
class edm::OneToValue< CKey, Val, index >

Definition at line 12 of file OneToValue.h.

Member Typedef Documentation

◆ data_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef Val edm::OneToValue< CKey, Val, index >::data_type

insert val type

Definition at line 24 of file OneToValue.h.

◆ index_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef index edm::OneToValue< CKey, Val, index >::index_type

index type

Definition at line 26 of file OneToValue.h.

◆ key_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef Ref<CKey> edm::OneToValue< CKey, Val, index >::key_type

insert key type

Definition at line 22 of file OneToValue.h.

◆ KeyRefProd

template<typename CKey, typename Val, typename index = unsigned int>
typedef RefProd<CKey> edm::OneToValue< CKey, Val, index >::KeyRefProd
private

reference to "key" collection

Definition at line 14 of file OneToValue.h.

◆ map_assoc

template<typename CKey, typename Val, typename index = unsigned int>
typedef Val edm::OneToValue< CKey, Val, index >::map_assoc
private

internal map associated data

Definition at line 16 of file OneToValue.h.

◆ map_type

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

map type

Definition at line 28 of file OneToValue.h.

◆ ref_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef helpers::Key<KeyRefProd> edm::OneToValue< CKey, Val, index >::ref_type

reference set type

Definition at line 30 of file OneToValue.h.

◆ transient_key_vector

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

transient key vector

Definition at line 34 of file OneToValue.h.

◆ transient_map_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef std::map<typename CKey::value_type const*, Val> edm::OneToValue< CKey, Val, index >::transient_map_type

transient map type

Definition at line 32 of file OneToValue.h.

◆ transient_val_vector

template<typename CKey, typename Val, typename index = unsigned int>
typedef std::vector<Val> edm::OneToValue< CKey, Val, index >::transient_val_vector

transient val vector

Definition at line 36 of file OneToValue.h.

◆ val_type

template<typename CKey, typename Val, typename index = unsigned int>
typedef Val edm::OneToValue< CKey, Val, index >::val_type

values reference collection type

Definition at line 20 of file OneToValue.h.

Member Function Documentation

◆ insert()

template<typename CKey, typename Val, typename index = unsigned int>
static void edm::OneToValue< CKey, Val, index >::insert ( ref_type ref,
map_type m,
key_type const &  k,
data_type const &  v 
)
inlinestatic

insert in the map

Definition at line 38 of file OneToValue.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

38  {
39  if (k.isNull()) {
40  Exception::throwThis(errors::InvalidReference, "can't insert null references in AssociationMap");
41  }
42  if (ref.key.isNull()) {
43  if (k.isTransient()) {
45  "can't insert transient references in uninitialized AssociationMap");
46  }
47  //another thread might change the value of productGetter()
48  auto getter = ref.key.productGetter();
49  if (getter == nullptr) {
51  "Can't insert into AssociationMap unless it was properly initialized.\n"
52  "The most common fix for this is to add an argument to the call to the\n"
53  "AssociationMap constructor that is a valid Handle to the container.\n"
54  "If you don't have a valid handle or the template parameter to the\n"
55  "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
56  "(note this was a new requirement added in the 7_5_X release series)\n");
57  }
58  ref.key = KeyRefProd(k.id(), getter);
59  }
60  helpers::checkRef(ref.key, k);
61  index_type ik = index_type(k.key());
62  m[ik] = v;
63  }
index index_type
index type
Definition: OneToValue.h:26
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:84
RefProd< CKey > KeyRefProd
reference to "key" collection
Definition: OneToValue.h:14
void checkRef(const RP &rp, const R &r)
throw if r hasn&#39;t the same id as rp

◆ size()

template<typename CKey, typename Val, typename index = unsigned int>
static map_type::size_type edm::OneToValue< CKey, Val, index >::size ( map_assoc const &  )
inlinestatic

size of data_type

Definition at line 67 of file OneToValue.h.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

67 { return 1; }

◆ sort()

template<typename CKey, typename Val, typename index = unsigned int>
static void edm::OneToValue< CKey, Val, index >::sort ( map_type )
inlinestatic

sort

Definition at line 69 of file OneToValue.h.

69 {}

◆ transientKeyVector()

template<typename CKey, typename Val, typename index = unsigned int>
static transient_key_vector edm::OneToValue< CKey, Val, index >::transientKeyVector ( ref_type const &  ref,
map_type const &  map 
)
inlinestatic

fill transient key vector

Definition at line 83 of file OneToValue.h.

83  {
85  if (!map.empty()) {
86  CKey const& ckey = *ref.key;
87  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i) {
88  m.push_back(&ckey[i->first]);
89  }
90  }
91  return m;
92  }
std::vector< typename CKey::value_type const * > transient_key_vector
transient key vector
Definition: OneToValue.h:34

◆ transientMap()

template<typename CKey, typename Val, typename index = unsigned int>
static transient_map_type edm::OneToValue< CKey, Val, index >::transientMap ( ref_type const &  ref,
map_type const &  map 
)
inlinestatic

fill transient map

Definition at line 71 of file OneToValue.h.

71  {
73  if (!map.empty()) {
74  CKey const& ckey = *ref.key;
75  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i) {
76  typename CKey::value_type const* k = &ckey[i->first];
77  m.insert(std::make_pair(k, i->second));
78  }
79  }
80  return m;
81  }
std::map< typename CKey::value_type const *, Val > transient_map_type
transient map type
Definition: OneToValue.h:32

◆ transientValVector()

template<typename CKey, typename Val, typename index = unsigned int>
static transient_val_vector edm::OneToValue< CKey, Val, index >::transientValVector ( ref_type const &  ref,
map_type const &  map 
)
inlinestatic

fill transient val vector

Definition at line 94 of file OneToValue.h.

94  {
96  if (!map.empty()) {
97  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i) {
98  m.push_back(i->second);
99  }
100  }
101  return m;
102  }
std::vector< Val > transient_val_vector
transient val vector
Definition: OneToValue.h:36

◆ val()

template<typename CKey, typename Val, typename index = unsigned int>
static val_type edm::OneToValue< CKey, Val, index >::val ( ref_type const &  ,
map_assoc const &  v 
)
inlinestatic

return values collection

Definition at line 65 of file OneToValue.h.

65 { return v; }