CMS 3D CMS Logo

edm::Association< C > Class Template Reference

#include <DataFormats/Common/interface/Association.h>

Inheritance diagram for edm::Association< C >:

edm::ValueMap< int >

List of all members.

Public Types

typedef ValueMap< indexbase
typedef int index
typedef base::offset offset
typedef Ref< typename
refprod_type::product_type
reference_type
typedef edm::RefProd< C > refprod_type

Public Member Functions

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

Private Member Functions

void add (const Association< C > &o)
void throwIndexMapBound () const
void throwRefSet () const

Private Attributes

refprod_type ref_

Friends

class helper::Filler< Association< C > >

Classes

class  Filler


Detailed Description

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

Definition at line 18 of file Association.h.


Member Typedef Documentation

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

Definition at line 21 of file Association.h.

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

Definition at line 20 of file Association.h.

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

Reimplemented from edm::ValueMap< int >.

Definition at line 22 of file Association.h.

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

Reimplemented from edm::ValueMap< int >.

Definition at line 24 of file Association.h.

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

Definition at line 23 of file Association.h.


Constructor & Destructor Documentation

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

Definition at line 26 of file Association.h.

00026 : base() { }

template<typename C>
template<typename H>
edm::Association< C >::Association ( const H &  h  )  [inline, explicit]

Definition at line 28 of file Association.h.

00028 : base(), ref_(h) { }


Member Function Documentation

template<typename C>
void edm::Association< C >::add ( const Association< C > &  o  )  [inline, private]

Definition at line 103 of file Association.h.

References edm::Association< C >::Filler::add(), and edm::helper::Filler< Map >::fill().

00103                                          {
00104       Filler filler(*this);
00105       filler.add(o);
00106       filler.fill();
00107     }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 65 of file Association.h.

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

00065 { base::clear(); }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 62 of file Association.h.

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

00062 { return base::contains(id); }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 64 of file Association.h.

References empty.

00064 { return base::empty(); }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 47 of file Association.h.

References edm::ValueMap< int >::rawIndexOf().

00047                                                        { 
00048       return get(rawIndexOf(id,idx));
00049     }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 39 of file Association.h.

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

00039                                             { 
00040       index i = values_[rawIdx];
00041       if(i < 0) return reference_type(); 
00042       size_t k = i;
00043       if (k >= ref_->size()) throwIndexMapBound();
00044       return reference_type(ref_,k);
00045     }

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

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

Reimplemented from edm::ValueMap< int >.

Definition at line 89 of file Association.h.

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

00089 { return ids_; }

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

Definition at line 51 of file Association.h.

00051                                                           {
00052       add(o);
00053       return *this;
00054     }

template<typename C>
Association& edm::Association< C >::operator= ( Association< C > const &  rhs  )  [inline]

Definition at line 71 of file Association.h.

References edm::Association< C >::swap(), and pyDBSRunClass::temp.

00071                                                    {
00072       Association temp(rhs);
00073       this->swap(temp);
00074       return *this;
00075     }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 34 of file Association.h.

00034                                                         {
00035       return get(r.id(), r.key());
00036     }

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

Definition at line 66 of file Association.h.

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

Referenced by reco::utilsNew::CandMatcher< C >::operator[](), and reco::utilsNew::CandMatcher< C >::ref().

00066 { return ref_; }

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_, and edm::Association< C >::throwRefSet().

00055                                           {
00056       if(ref_.isNull() ) {
00057         ref_ = ref;
00058       } else {
00059         if(ref_.id() != ref.id()) throwRefSet();
00060       }
00061     }

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

Reimplemented from edm::ValueMap< int >.

Definition at line 63 of file Association.h.

References size.

00063 { return base::size(); }

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

Definition at line 67 of file Association.h.

References edm::Association< C >::ref_, edm::RefProd< C >::swap(), and swap().

Referenced by edm::Association< C >::operator=(), and edm::swap().

00067                                   {
00068       this->ValueMap<int>::swap(other);
00069       ref_.swap(other.ref_);
00070     }

template<typename C>
void edm::Association< C >::throwIndexMapBound (  )  const [inline, private]

Definition at line 94 of file Association.h.

References edm::errors::InvalidReference.

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

00094                                     {
00095       throw Exception(errors::InvalidReference)
00096         << "Association: index in the map out of upper boundary\n";
00097     }

template<typename C>
void edm::Association< C >::throwRefSet (  )  const [inline, private]

Definition at line 98 of file Association.h.

References edm::errors::InvalidReference.

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

00098                              {
00099       throw Exception(errors::InvalidReference) 
00100         << "Association: reference to product already set\n";
00101     }


Friends And Related Function Documentation

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

Definition at line 109 of file Association.h.


Member Data Documentation

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

Definition at line 93 of file Association.h.

Referenced by edm::Association< C >::get(), edm::Association< C >::ref(), edm::Association< C >::setRef(), and edm::Association< C >::swap().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:37:53 2009 for CMSSW by  doxygen 1.5.4