CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
fwlite::Handle< T > Class Template Reference

#include <Handle.h>

Public Types

typedef edm::Wrapper< TTempWrapT
 

Public Member Functions

bool failedToGet () const
 Returns true only if Handle was used in a 'get' call and the data could not be found. More...
 
const std::string getBranchNameFor (const fwlite::EventBase &iEvent, const char *iModuleLabel, const char *iProductInstanceLabel=nullptr, const char *iProcessLabel=nullptr)
 
template<class P >
void getByLabel (const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=nullptr, const char *iProcessLabel=nullptr)
 
 Handle ()
 
 Handle (const Handle< T > &iOther)
 
bool isValid () const
 
const Toperator* () const
 
const Toperator-> () const
 
const Handle< T > & operator= (const Handle< T > &iOther)
 
T const * product () const
 
const Tptr () const
 
const Tref () const
 
void swap (Handle< T > &iOther)
 
 ~Handle ()
 

Private Member Functions

void check () const
 

Private Attributes

const Tdata_
 
ErrorThrower const * errorThrower_
 

Detailed Description

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

Definition at line 39 of file Handle.h.

Member Typedef Documentation

◆ TempWrapT

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

Definition at line 45 of file Handle.h.

Constructor & Destructor Documentation

◆ Handle() [1/2]

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

Definition at line 47 of file Handle.h.

◆ ~Handle()

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

Definition at line 48 of file Handle.h.

48 { delete errorThrower_; }

◆ Handle() [2/2]

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

Definition at line 50 of file Handle.h.

51  : data_(iOther.data_), errorThrower_(iOther.errorThrower_ ? iOther.errorThrower_->clone() : nullptr) {}

Member Function Documentation

◆ check()

template<class T>
void fwlite::Handle< T >::check ( ) const
inlineprivate

◆ failedToGet()

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.

63 { return errorThrower_ != nullptr; }

Referenced by fwlite::Scanner< Collection >::fillDataSet(), and fwlite::Scanner< Collection >::scan().

◆ getBranchNameFor()

template<class T>
const std::string fwlite::Handle< T >::getBranchNameFor ( const fwlite::EventBase iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = nullptr,
const char *  iProcessLabel = nullptr 
)
inline

Definition at line 209 of file Handle.h.

212  {
213  return iEvent.getBranchNameFor(TempWrapT::typeInfo(), iModuleLabel, iProductInstanceLabel, iProcessLabel);
214  }

◆ getByLabel()

template<class T>
template<class P >
void fwlite::Handle< T >::getByLabel ( const P iP,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = nullptr,
const char *  iProcessLabel = nullptr 
)
inline

Definition at line 100 of file Handle.h.

103  {
104  TempWrapT* temp;
105  void* pTemp = &temp;
106  iP.getByLabel(TempWrapT::typeInfo(), iModuleLabel, iProductInstanceLabel, iProcessLabel, pTemp);
107  delete errorThrower_;
108  errorThrower_ = nullptr;
109  if (nullptr == temp) {
111  TempWrapT::typeInfo(), iModuleLabel, iProductInstanceLabel, iProcessLabel);
112  return;
113  }
114  data_ = temp->product();
115  if (data_ == nullptr) {
117  TempWrapT::typeInfo(), iModuleLabel, iProductInstanceLabel, iProcessLabel);
118  }
119  }

Referenced by calcSampleName(), HltDiff::compare(), fwlite::Scanner< Collection >::count(), fwlite::Scanner< Collection >::draw(), fwlite::Scanner< Collection >::draw2D(), fwlite::Scanner< Collection >::drawGraph(), fwlite::Scanner< Collection >::drawProf(), FWHLTTriggerTableView::fillAverageAcceptFractions(), fwlite::Scanner< Collection >::fillDataSet(), FWL1TriggerTableView::fillTable(), FWHLTTriggerTableView::fillTable(), FWFileEntry::filterEventsWithCustomParser(), main(), and fwlite::Scanner< Collection >::scan().

◆ isValid()

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

◆ operator*()

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

Definition at line 84 of file Handle.h.

84  {
85  check();
86  return *data_;
87  }

◆ operator->()

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

Definition at line 79 of file Handle.h.

79  {
80  check();
81  return data_;
82  }

◆ operator=()

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

Definition at line 53 of file Handle.h.

53  {
54  Handle<T> temp(iOther);
55  swap(temp);
56  return *this;
57  }

◆ product()

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

Definition at line 65 of file Handle.h.

65  {
66  check();
67  return data_;
68  }

Referenced by HltDiff::compare().

◆ ptr()

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

Definition at line 70 of file Handle.h.

70  {
71  check();
72  return data_;
73  }

◆ ref()

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

Definition at line 74 of file Handle.h.

74  {
75  check();
76  return *data_;
77  }

◆ swap()

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

Definition at line 248 of file Handle.h.

248  {
249  const T* temp = data_;
250  data_ = iOther.data_;
251  iOther.data_ = temp;
252  ErrorThrower const* tempE = errorThrower_;
253  errorThrower_ = iOther.errorThrower_;
254  iOther.errorThrower_ = tempE;
255  }

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

Member Data Documentation

◆ data_

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

◆ errorThrower_

template<class T>
ErrorThrower const* fwlite::Handle< T >::errorThrower_
private
Handle
fwlite::Handle::swap
void swap(Handle< T > &iOther)
Definition: Handle.h:248
fwlite::Handle::data_
const T * data_
Definition: Handle.h:265
fwlite::ErrorThrower::errorThrowerProductNotFoundException
static ErrorThrower * errorThrowerProductNotFoundException(const std::type_info &, const char *, const char *, const char *)
Definition: ErrorThrower.cc:125
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
fwlite::Handle::check
void check() const
Definition: Handle.h:258
fwlite::ErrorThrower::throwIt
virtual void throwIt() const =0
fwlite::Handle::TempWrapT
edm::Wrapper< T > TempWrapT
Definition: Handle.h:45
fwlite::ErrorThrower::unsetErrorThrower
static ErrorThrower * unsetErrorThrower()
Definition: ErrorThrower.cc:116
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::Wrapper::typeInfo
static std::type_info const & typeInfo()
Definition: Wrapper.h:43
fwlite::ErrorThrower::errorThrowerBranchNotFoundException
static ErrorThrower * errorThrowerBranchNotFoundException(const std::type_info &, const char *, const char *, const char *)
Definition: ErrorThrower.cc:118
ErrorThrower
T
long double T
Definition: Basic3DVectorLD.h:48
fwlite::Handle::errorThrower_
ErrorThrower const * errorThrower_
Definition: Handle.h:266