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=0, const char *iProcessLabel=0)
 
template<class P >
void getByLabel (const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
 
 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 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.

static ErrorThrower * unsetErrorThrower()
ErrorThrower const * errorThrower_
Definition: Handle.h:266
const T * data_
Definition: Handle.h:265
template<class T>
fwlite::Handle< T >::~Handle ( )
inline

Definition at line 49 of file Handle.h.

49 { delete errorThrower_;}
ErrorThrower const * errorThrower_
Definition: Handle.h:266
template<class T>
fwlite::Handle< T >::Handle ( const Handle< T > &  iOther)
inline

Definition at line 51 of file Handle.h.

51  : data_(iOther.data_),
52  errorThrower_( iOther.errorThrower_? iOther.errorThrower_->clone(): nullptr) {}
ErrorThrower const * errorThrower_
Definition: Handle.h:266
const T * data_
Definition: Handle.h:265

Member Function Documentation

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

Definition at line 261 of file Handle.h.

261 { if(errorThrower_) { errorThrower_->throwIt();} }
ErrorThrower const * errorThrower_
Definition: Handle.h:266
virtual void throwIt() const =0
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 64 of file Handle.h.

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

64 {return errorThrower_ != nullptr; }
ErrorThrower const * errorThrower_
Definition: Handle.h:266
template<class T>
const std::string fwlite::Handle< T >::getBranchNameFor ( const fwlite::EventBase iEvent,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
)
inline

Definition at line 209 of file Handle.h.

213  {
214  return iEvent.getBranchNameFor(TempWrapT::typeInfo(),
215  iModuleLabel,
216  iProductInstanceLabel,
217  iProcessLabel);
218  }
virtual std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const =0
static std::type_info const & typeInfo()
Definition: Wrapper.h:42
template<class T>
template<class P >
void fwlite::Handle< T >::getByLabel ( const P iP,
const char *  iModuleLabel,
const char *  iProductInstanceLabel = 0,
const char *  iProcessLabel = 0 
)
inline

Definition at line 91 of file Handle.h.

Referenced by fwlite::ObjectCountSelector< Collection >::accept(), 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().

94  {
95  TempWrapT* temp;
96  void* pTemp = &temp;
97  iP.getByLabel(TempWrapT::typeInfo(),
98  iModuleLabel,
99  iProductInstanceLabel,
100  iProcessLabel,
101  pTemp);
102  delete errorThrower_;
103  errorThrower_ = nullptr;
104  if(nullptr == temp) {
106  iModuleLabel,
107  iProductInstanceLabel,
108  iProcessLabel);
109  return;
110  }
111  data_ = temp->product();
112  if(data_== nullptr) {
114  iModuleLabel,
115  iProductInstanceLabel,
116  iProcessLabel);
117  }
118  }
static ErrorThrower * errorThrowerBranchNotFoundException(const std::type_info &, const char *, const char *, const char *)
edm::Wrapper< T > TempWrapT
Definition: Handle.h:46
ErrorThrower const * errorThrower_
Definition: Handle.h:266
static ErrorThrower * errorThrowerProductNotFoundException(const std::type_info &, const char *, const char *, const char *)
const T * data_
Definition: Handle.h:265
static std::type_info const & typeInfo()
Definition: Wrapper.h:42
template<class T>
bool fwlite::Handle< T >::isValid ( void  ) const
inline
template<class T>
const T& fwlite::Handle< T >::operator* ( ) const
inline

Definition at line 76 of file Handle.h.

76  {
77  check();
78  return *data_;
79  }
void check() const
Definition: Handle.h:261
const T * data_
Definition: Handle.h:265
template<class T>
const T* fwlite::Handle< T >::operator-> ( ) const
inline

Definition at line 71 of file Handle.h.

71  {
72  check();
73  return data_;
74  }
void check() const
Definition: Handle.h:261
const T * data_
Definition: Handle.h:265
template<class T>
const Handle<T>& fwlite::Handle< T >::operator= ( const Handle< T > &  iOther)
inline

Definition at line 54 of file Handle.h.

54  {
55  Handle<T> temp(iOther);
56  swap(temp);
57  return *this;
58  }
void swap(Handle< T > &iOther)
Definition: Handle.h:252
template<class T>
T const* fwlite::Handle< T >::product ( ) const
inline

Definition at line 66 of file Handle.h.

Referenced by HltDiff::compare().

66 { check(); return data_;}
void check() const
Definition: Handle.h:261
const T * data_
Definition: Handle.h:265
template<class T>
const T* fwlite::Handle< T >::ptr ( ) const
inline

Definition at line 68 of file Handle.h.

68 { check(); return data_;}
void check() const
Definition: Handle.h:261
const T * data_
Definition: Handle.h:265
template<class T>
const T& fwlite::Handle< T >::ref ( ) const
inline

Definition at line 69 of file Handle.h.

69 { check(); return *data_;}
void check() const
Definition: Handle.h:261
const T * data_
Definition: Handle.h:265
template<class T>
void fwlite::Handle< T >::swap ( Handle< T > &  iOther)
inline

Definition at line 252 of file Handle.h.

252  {
253  const T* temp = data_;
254  data_ = iOther.data_;
255  iOther.data_ = temp;
256  ErrorThrower const* tempE = errorThrower_;
257  errorThrower_ = iOther.errorThrower_;
258  iOther.errorThrower_ = tempE;
259  }
ErrorThrower const * errorThrower_
Definition: Handle.h:266
const T * data_
Definition: Handle.h:265
long double T

Member Data Documentation

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

Definition at line 265 of file Handle.h.

Referenced by fwlite::Handle< Collection >::swap().

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

Definition at line 266 of file Handle.h.

Referenced by fwlite::Handle< Collection >::swap().