CMS 3D CMS Logo

fwlite::Handle< T > Class Template Reference

#include <DataFormats/FWLite/interface/Handle.h>

List of all members.

Public Types

typedef edm::Wrapper< T > TempWrapT

Public Member Functions

bool failedToGet () const
 Returns true only if Handle was used in a 'get' call and the data could not be found.
const std::string getBranchNameFor (const fwlite::ChainEvent &iEvent, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
const std::string getBranchNameFor (const fwlite::Event &iEvent, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
void getByLabel (const fwlite::ChainEvent &iEvent, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
void getByLabel (const fwlite::Event &iEvent, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
 Handle (const Handle< T > &iOther)
 Handle ()
bool isValid () const
const T & operator * () const
const T * operator-> () const
const Handle< T > & operator= (const Handle< T > &iOther)
T const * product () const
const T * ptr () const
const T & ref () const
void swap (Handle< T > &iOther)
 ~Handle ()

Private Member Functions

void check () const

Private Attributes

const T * data_
ErrorThrowererrorThrower_


Detailed Description

template<class T>
class fwlite::Handle< T >

Definition at line 38 of file Handle.h.


Member Typedef Documentation

template<class T>
typedef edm::Wrapper<T> fwlite::Handle< T >::TempWrapT

Definition at line 46 of file Handle.h.


Constructor & Destructor Documentation

template<class T>
fwlite::Handle< T >::Handle (  )  [inline]

Definition at line 48 of file Handle.h.

template<class T>
fwlite::Handle< T >::~Handle (  )  [inline]

Definition at line 49 of file Handle.h.

References fwlite::Handle< T >::errorThrower_.

00049 { delete errorThrower_;}

template<class T>
fwlite::Handle< T >::Handle ( const Handle< T > &  iOther  )  [inline]

Definition at line 51 of file Handle.h.

00051                                       : data_(iOther.data_),
00052       errorThrower_( iOther.errorThrower_? iOther.errorThrower_->clone(): 0) {}


Member Function Documentation

template<class T>
void fwlite::Handle< T >::check (  )  const [inline, private]

Definition at line 175 of file Handle.h.

References fwlite::Handle< T >::errorThrower_, and fwlite::ErrorThrower::throwIt().

Referenced by fwlite::Handle< T >::operator *(), fwlite::Handle< T >::operator->(), fwlite::Handle< T >::product(), fwlite::Handle< T >::ptr(), and fwlite::Handle< T >::ref().

00175 { if(errorThrower_) { errorThrower_->throwIt();} }

template<class T>
bool fwlite::Handle< T >::failedToGet (  )  const [inline]

Returns true only if Handle was used in a 'get' call and the data could not be found.

Definition at line 63 of file Handle.h.

References fwlite::Handle< T >::errorThrower_.

00063 {return errorThrower_ != 0; }

template<class T>
const std::string fwlite::Handle< T >::getBranchNameFor ( const fwlite::ChainEvent iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
) [inline]

Definition at line 156 of file Handle.h.

References fwlite::ChainEvent::getBranchNameFor(), and edm::Wrapper< T >::typeInfo().

00159                                                                       {
00160       return iEvent.getBranchNameFor(TempWrapT::typeInfo(),
00161                                      iModuleLabel,
00162                                      iProductInstanceLabel,
00163                                      iProcessLabel);
00164     }

template<class T>
const std::string fwlite::Handle< T >::getBranchNameFor ( const fwlite::Event iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
) [inline]

Definition at line 146 of file Handle.h.

References fwlite::Event::getBranchNameFor(), and edm::Wrapper< T >::typeInfo().

00149                                                                       {
00150       return iEvent.getBranchNameFor(TempWrapT::typeInfo(),
00151                                      iModuleLabel,
00152                                      iProductInstanceLabel,
00153                                      iProcessLabel);
00154     }

template<class T>
void fwlite::Handle< T >::getByLabel ( const fwlite::ChainEvent iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
) [inline]

Definition at line 117 of file Handle.h.

References fwlite::Handle< T >::data_, fwlite::Handle< T >::errorThrower_, fwlite::ErrorThrower::errorThrowerBranchNotFoundException(), fwlite::ErrorThrower::errorThrowerProductNotFoundException(), fwlite::ChainEvent::getByLabel(), edm::Wrapper< T >::product(), pyDBSRunClass::temp, and edm::Wrapper< T >::typeInfo().

00120                                                      {
00121       TempWrapT* temp;
00122       void* pTemp = &temp;
00123       iEvent.getByLabel(TempWrapT::typeInfo(),
00124                         iModuleLabel,
00125                         iProductInstanceLabel,
00126                         iProcessLabel,
00127                         pTemp);
00128          delete errorThrower_;
00129          errorThrower_ = 0;
00130          if(0==temp) {
00131             errorThrower_=ErrorThrower::errorThrowerBranchNotFoundException(TempWrapT::typeInfo(),
00132                                                                             iModuleLabel,
00133                                                                             iProductInstanceLabel,
00134                                                                             iProcessLabel);
00135             return;
00136          }
00137          data_ = temp->product();
00138          if(data_==0) {
00139             errorThrower_=ErrorThrower::errorThrowerProductNotFoundException(TempWrapT::typeInfo(),
00140                                                                              iModuleLabel,
00141                                                                              iProductInstanceLabel,
00142                                                                              iProcessLabel);
00143          }
00144       }

template<class T>
void fwlite::Handle< T >::getByLabel ( const fwlite::Event iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
) [inline]

Definition at line 88 of file Handle.h.

References fwlite::Handle< T >::data_, fwlite::Handle< T >::errorThrower_, fwlite::ErrorThrower::errorThrowerBranchNotFoundException(), fwlite::ErrorThrower::errorThrowerProductNotFoundException(), fwlite::Event::getByLabel(), edm::Wrapper< T >::product(), pyDBSRunClass::temp, and edm::Wrapper< T >::typeInfo().

00091                                                      {
00092         TempWrapT* temp;
00093         void* pTemp = &temp;
00094         iEvent.getByLabel(TempWrapT::typeInfo(),
00095                           iModuleLabel,
00096                           iProductInstanceLabel,
00097                           iProcessLabel,
00098                           pTemp);
00099         delete errorThrower_;
00100         errorThrower_ = 0;
00101         if(0==temp) {
00102            errorThrower_=ErrorThrower::errorThrowerBranchNotFoundException(TempWrapT::typeInfo(),
00103                                                                            iModuleLabel,
00104                                                                            iProductInstanceLabel,
00105                                                                            iProcessLabel);
00106            return;
00107         }
00108         data_ = temp->product();
00109         if(data_==0) {
00110            errorThrower_=ErrorThrower::errorThrowerProductNotFoundException(TempWrapT::typeInfo(),
00111                                                                             iModuleLabel,
00112                                                                             iProductInstanceLabel,
00113                                                                             iProcessLabel);
00114         }
00115       }

template<class T>
bool fwlite::Handle< T >::isValid ( void   )  const [inline]

Definition at line 60 of file Handle.h.

References fwlite::Handle< T >::data_.

00060 { return data_ != 0; }

template<class T>
const T& fwlite::Handle< T >::operator * (  )  const [inline]

Definition at line 75 of file Handle.h.

References fwlite::Handle< T >::check(), and fwlite::Handle< T >::data_.

00075                                  {
00076         check();
00077         return *data_;
00078       }

template<class T>
const T* fwlite::Handle< T >::operator-> (  )  const [inline]

Definition at line 70 of file Handle.h.

References fwlite::Handle< T >::check(), and fwlite::Handle< T >::data_.

00070                                   {
00071         check();
00072         return data_;
00073       }

template<class T>
const Handle<T>& fwlite::Handle< T >::operator= ( const Handle< T > &  iOther  )  [inline]

Definition at line 54 of file Handle.h.

References fwlite::Handle< T >::swap(), and pyDBSRunClass::temp.

00054                                                           {
00055          Handle<T> temp(iOther);
00056          swap(iOther);
00057       }

template<class T>
T const* fwlite::Handle< T >::product (  )  const [inline]

Definition at line 65 of file Handle.h.

References fwlite::Handle< T >::check(), and fwlite::Handle< T >::data_.

00065 { check(); return data_;}

template<class T>
const T* fwlite::Handle< T >::ptr (  )  const [inline]

Definition at line 67 of file Handle.h.

References fwlite::Handle< T >::check(), and fwlite::Handle< T >::data_.

00067 { check(); return data_;}

template<class T>
const T& fwlite::Handle< T >::ref (  )  const [inline]

Definition at line 68 of file Handle.h.

References fwlite::Handle< T >::check(), and fwlite::Handle< T >::data_.

00068 { check(); return *data_;}

template<class T>
void fwlite::Handle< T >::swap ( Handle< T > &  iOther  )  [inline]

Definition at line 166 of file Handle.h.

References fwlite::Handle< T >::data_, fwlite::Handle< T >::errorThrower_, and pyDBSRunClass::temp.

Referenced by fwlite::Handle< T >::operator=().

00166                                  {
00167       const T* temp = data_;
00168       data_ = iOther.data_;
00169       iOther.data_ = temp;
00170       ErrorThrower* tempE = errorThrower_;
00171       errorThrower_ = iOther.errorThrower_;
00172       iOther.errorThrower = tempE;
00173    }


Member Data Documentation

template<class T>
const T* fwlite::Handle< T >::data_ [private]

Definition at line 179 of file Handle.h.

Referenced by fwlite::Handle< T >::getByLabel(), fwlite::Handle< T >::isValid(), fwlite::Handle< T >::operator *(), fwlite::Handle< T >::operator->(), fwlite::Handle< T >::product(), fwlite::Handle< T >::ptr(), fwlite::Handle< T >::ref(), and fwlite::Handle< T >::swap().

template<class T>
ErrorThrower* fwlite::Handle< T >::errorThrower_ [private]

Definition at line 180 of file Handle.h.

Referenced by fwlite::Handle< T >::check(), fwlite::Handle< T >::failedToGet(), fwlite::Handle< T >::getByLabel(), fwlite::Handle< T >::swap(), and fwlite::Handle< T >::~Handle().


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