CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::Association< C > Class Template Reference

#include <Association.h>

Inheritance diagram for edm::Association< C >:
edm::ValueMap< int >

Classes

class  Filler
 

Public Types

typedef ValueMap< indexbase
 
typedef std::vector< std::pair< ProductID, offset > > id_offset_vector
 meant to be used in AssociativeIterator, not by the ordinary user More...
 
typedef int index
 
typedef base::offset offset
 
typedef Ref< typename refprod_type::product_typereference_type
 
typedef edm::RefProd< C > refprod_type
 

Public Member Functions

 Association ()
 
template<typename H >
 Association (const H &h)
 
void clear ()
 
bool contains (ProductID id) const
 
bool empty () const
 
reference_type get (size_t rawIdx) const
 meant to be used internally or in AssociativeIterator, not by the ordinary user More...
 
reference_type get (ProductID id, size_t idx) const
 
const id_offset_vectorids () const
 meant to be used in AssociativeIterator, not by the ordinary user More...
 
Association< C > & operator+= (const Association< C > &o)
 
template<typename RefKey >
reference_type operator[] (const RefKey &r) const
 
size_t rawIndexOf (ProductID id, size_t idx) const
 
refprod_type ref () const
 
void setRef (const refprod_type &ref)
 
size_t size () const
 
void swap (Association &other)
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void add (const Association< C > &o)
 
void throwIndexMapBound () const
 
void throwRefSet () const
 
- Private Member Functions inherited from edm::ValueMap< int >
const_iterator begin () const
 
void clear ()
 
bool contains (ProductID id) const
 
bool empty () const
 
const_iterator end () const
 
const_reference_type get (ProductID id, size_t idx) const
 
reference_type get (ProductID id, size_t idx)
 
const_reference_type get (size_t idx) const
 meant to be used in AssociativeIterator, not by the ordinary user More...
 
const id_offset_vectorids () const
 meant to be used in AssociativeIterator, not by the ordinary user More...
 
size_t idSize () const
 
ValueMap< int > & operator+= (const ValueMap< int > &o)
 
const_reference_type operator[] (const RefKey &r) const
 
reference_type operator[] (const RefKey &r)
 
size_t rawIndexOf (ProductID id, size_t idx) const
 
void shrink_to_fit ()
 
size_t size () const
 
void swap (ValueMap &other)
 
 ValueMap ()
 
id_offset_vector::const_iterator getIdOffset (ProductID id) const
 
void throwIndexBound () const
 

Private Attributes

refprod_type ref_
 
- Private Attributes inherited from edm::ValueMap< int >
id_offset_vector ids_
 
container values_
 

Friends

class helper::Filler< Association< C > >
 

Additional Inherited Members

- Private Types inherited from edm::ValueMap< int >
typedef container::const_reference const_reference_type
 
typedef std::vector< value_typecontainer
 
typedef helper::Filler< ValueMap< int > > Filler
 
typedef std::vector< std::pair< ProductID, offset > > id_offset_vector
 
typedef unsigned int offset
 
typedef container::reference reference_type
 
typedef int value_type
 
- Static Private Member Functions inherited from edm::ValueMap< int >
static short Class_Version ()
 

Detailed Description

template<typename C>
class edm::Association< C >

Definition at line 18 of file Association.h.

Member Typedef Documentation

◆ base

template<typename C>
typedef ValueMap<index> edm::Association< C >::base

Definition at line 21 of file Association.h.

◆ id_offset_vector

template<typename C>
typedef std::vector<std::pair<ProductID, offset> > edm::ValueMap< T >::id_offset_vector

meant to be used in AssociativeIterator, not by the ordinary user

Definition at line 112 of file ValueMap.h.

◆ index

template<typename C>
typedef int edm::Association< C >::index

Definition at line 20 of file Association.h.

◆ offset

template<typename C>
typedef base::offset edm::Association< C >::offset

Definition at line 22 of file Association.h.

◆ reference_type

template<typename C>
typedef Ref<typename refprod_type::product_type> edm::Association< C >::reference_type

Definition at line 24 of file Association.h.

◆ refprod_type

template<typename C>
typedef edm::RefProd<C> edm::Association< C >::refprod_type

Definition at line 23 of file Association.h.

Constructor & Destructor Documentation

◆ Association() [1/2]

template<typename C>
edm::Association< C >::Association ( )
inline

Definition at line 26 of file Association.h.

26 : base() {}
ValueMap< index > base
Definition: Association.h:21

◆ Association() [2/2]

template<typename C>
template<typename H >
edm::Association< C >::Association ( const H &  h)
inlineexplicit

Definition at line 28 of file Association.h.

28 : base(), ref_(h) {}
refprod_type ref_
Definition: Association.h:93
ValueMap< index > base
Definition: Association.h:21
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

Member Function Documentation

◆ add()

template<typename C>
void edm::Association< C >::add ( const Association< C > &  o)
inlineprivate

◆ Class_Version()

template<typename C>
static short edm::Association< C >::Class_Version ( )
inlinestatic

Definition at line 90 of file Association.h.

92 :
refprod_type ref_
Definition: Association.h:93
edm::RefProd< C > refprod_type
Definition: Association.h:23

◆ clear()

template<typename C>
void edm::Association< C >::clear ( void  )
inline

Definition at line 66 of file Association.h.

References edm::ValueMap< T >::clear().

66 { base::clear(); }
void clear()
Definition: ValueMap.h:153

◆ contains()

template<typename C>
bool edm::Association< C >::contains ( ProductID  id) const
inline

Definition at line 63 of file Association.h.

References edm::ValueMap< T >::contains().

Referenced by LumiList.LumiList::__contains__(), and pat::PATIsolatedTrackProducer::produce().

63 { return base::contains(id); }
bool contains(ProductID id) const
Definition: ValueMap.h:149

◆ empty()

template<typename C>
bool edm::Association< C >::empty ( ) const
inline

Definition at line 65 of file Association.h.

References edm::ValueMap< T >::empty().

65 { return base::empty(); }
bool empty() const
Definition: ValueMap.h:152

◆ get() [1/2]

template<typename C>
reference_type edm::Association< C >::get ( size_t  rawIdx) const
inline

meant to be used internally or in AssociativeIterator, not by the ordinary user

Definition at line 39 of file Association.h.

References mps_fire::i, dqmdumpme::k, edm::Association< C >::ref_, edm::Association< C >::throwIndexMapBound(), and edm::ValueMap< int >::values_.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

39  {
40  index i = values_[rawIdx];
41  if (i < 0)
42  return reference_type();
43  size_t k = i;
44  if (k >= ref_->size())
46  return reference_type(ref_, k);
47  }
refprod_type ref_
Definition: Association.h:93
Ref< typename refprod_type::product_type > reference_type
Definition: Association.h:24
void throwIndexMapBound() const
Definition: Association.h:94
container values_
Definition: ValueMap.h:235

◆ get() [2/2]

template<typename C>
reference_type edm::Association< C >::get ( ProductID  id,
size_t  idx 
) const
inline

◆ ids()

template<typename C>
const id_offset_vector& edm::Association< C >::ids ( ) const
inline

meant to be used in AssociativeIterator, not by the ordinary user

Definition at line 85 of file Association.h.

References edm::ValueMap< int >::ids_.

85 { return ids_; }
id_offset_vector ids_
Definition: ValueMap.h:236

◆ operator+=()

template<typename C>
Association<C>& edm::Association< C >::operator+= ( const Association< C > &  o)
inline

Definition at line 51 of file Association.h.

References edm::Association< C >::add(), and EcalTangentSkim_cfg::o.

51  {
52  add(o);
53  return *this;
54  }
void add(const Association< C > &o)
Definition: Association.h:101

◆ operator[]()

template<typename C>
template<typename RefKey >
reference_type edm::Association< C >::operator[] ( const RefKey &  r) const
inline

Definition at line 34 of file Association.h.

34  {
35  return get(r.id(), r.key());
36  }

◆ rawIndexOf()

template<typename C>
size_t edm::ValueMap< T >::rawIndexOf
inline

Definition at line 128 of file ValueMap.h.

128  {
129  typename id_offset_vector::const_iterator f = getIdOffset(id);
130  if (f == ids_.end())
132  offset off = f->second;
133  size_t j = off + idx;
134  if (j >= values_.size())
135  throwIndexBound();
136  return j;
137  }
id_offset_vector::const_iterator getIdOffset(ProductID id) const
Definition: ValueMap.h:238
base::offset offset
Definition: Association.h:22
id_offset_vector ids_
Definition: ValueMap.h:236
double f[11][100]
void throwIndexBound() const
Definition: ValueMap.h:245
void throwNotExisting() const
Definition: ValueMap.h:253
container values_
Definition: ValueMap.h:235

◆ ref()

template<typename C>
refprod_type edm::Association< C >::ref ( ) const
inline

Definition at line 67 of file Association.h.

References edm::Association< C >::ref_.

Referenced by reco::utilsNew::CandMatcher< C >::ref(), and edm::Association< C >::setRef().

67 { return ref_; }
refprod_type ref_
Definition: Association.h:93

◆ setRef()

template<typename C>
void edm::Association< C >::setRef ( const refprod_type ref)
inline

Definition at line 55 of file Association.h.

References edm::RefProd< C >::id(), edm::RefProd< C >::isNull(), edm::Association< C >::ref(), edm::Association< C >::ref_, and edm::Association< C >::throwRefSet().

55  {
56  if (ref_.isNull()) {
57  ref_ = ref;
58  } else {
59  if (ref_.id() != ref.id())
60  throwRefSet();
61  }
62  }
refprod_type ref_
Definition: Association.h:93
refprod_type ref() const
Definition: Association.h:67
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:124
bool isNull() const
Checks for null.
Definition: RefProd.h:115
void throwRefSet() const
Definition: Association.h:97

◆ size()

template<typename C>
size_t edm::Association< C >::size ( void  ) const
inline

Definition at line 64 of file Association.h.

References edm::ValueMap< T >::size().

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

64 { return base::size(); }
size_t size() const
Definition: ValueMap.h:150

◆ swap()

template<typename C>
void edm::Association< C >::swap ( Association< C > &  other)
inline

Definition at line 68 of file Association.h.

References trackingPlots::other, edm::Association< C >::ref_, edm::ValueMap< T >::swap(), and edm::RefProd< C >::swap().

Referenced by edm::swap().

68  {
70  ref_.swap(other.ref_);
71  }
refprod_type ref_
Definition: Association.h:93
void swap(ValueMap &other)
Definition: ValueMap.h:118
void swap(RefProd< C > &)
Definition: RefProd.h:175

◆ throwIndexMapBound()

template<typename C>
void edm::Association< C >::throwIndexMapBound ( ) const
inlineprivate

Definition at line 94 of file Association.h.

References edm::errors::InvalidReference, and edm::Exception::throwThis().

Referenced by edm::Association< C >::get().

94  {
95  Exception::throwThis(errors::InvalidReference, "Association: index in the map out of upper boundary\n");
96  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86

◆ throwRefSet()

template<typename C>
void edm::Association< C >::throwRefSet ( ) const
inlineprivate

Definition at line 97 of file Association.h.

References edm::errors::InvalidReference, and edm::Exception::throwThis().

Referenced by edm::Association< C >::setRef().

97  {
98  Exception::throwThis(errors::InvalidReference, "Association: reference to product already set\n");
99  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86

Friends And Related Function Documentation

◆ helper::Filler< Association< C > >

template<typename C>
friend class helper::Filler< Association< C > >
friend

Definition at line 107 of file Association.h.

Member Data Documentation

◆ ref_

template<typename C>
refprod_type edm::Association< C >::ref_
private