CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::Handle< GenericObject > Class Template Reference

#include <GenericHandle.h>

Public Member Functions

void clear ()
 
bool failedToGet () const
 
 Handle (std::string const &iName)
 Throws exception if iName is not a known C++ class type. More...
 
 Handle (TypeWithDict const &iType)
 Throws exception if iType is invalid. More...
 
 Handle (Handle< GenericObject > const &h)
 
 Handle (ObjectWithDict const &prod, Provenance const *prov, ProductID const &)
 
ProductID id () const
 
bool isValid () const
 
ObjectWithDict const & operator* () const
 
ObjectWithDict const * operator-> () const
 
Handle< GenericObject > & operator= (Handle< GenericObject > const &rhs)
 
ObjectWithDict const * product () const
 
Provenance const * provenance () const
 
void setWhyFailedFactory (std::shared_ptr< HandleExceptionFactory > const &iWhyFailed)
 
void swap (Handle< GenericObject > &other)
 
TypeWithDict const & type () const
 

Private Attributes

ObjectWithDict prod_
 
Provenance const * prov_
 
TypeWithDict type_
 
std::shared_ptr< HandleExceptionFactorywhyFailedFactory_
 

Detailed Description

template<>
class edm::Handle< GenericObject >

Definition at line 43 of file GenericHandle.h.

Constructor & Destructor Documentation

edm::Handle< GenericObject >::Handle ( std::string const &  iName)
inline

Throws exception if iName is not a known C++ class type.

Definition at line 46 of file GenericHandle.h.

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

46  : type_(TypeWithDict::byName(iName)), prod_(), prov_(nullptr) {
47  if (!bool(type_)) {
49  "Handle<GenericObject> told to use uknown type '",
50  iName.c_str(),
51  "'.\n Please check spelling or that a module uses this type in the job.");
52  }
53  }
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
Provenance const * prov_
edm::Handle< GenericObject >::Handle ( TypeWithDict const &  iType)
inline

Throws exception if iType is invalid.

Definition at line 56 of file GenericHandle.h.

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

56  : type_(iType), prod_(), prov_(nullptr) {
57  if (!bool(iType)) {
58  Exception::throwThis(errors::NotFound, "Handle<GenericObject> given an invalid type");
59  }
60  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
Provenance const * prov_
edm::Handle< GenericObject >::Handle ( Handle< GenericObject > const &  h)
inline

Definition at line 62 of file GenericHandle.h.

63  : type_(h.type_), prod_(h.prod_), prov_(h.prov_), whyFailedFactory_(h.whyFailedFactory_) {}
Provenance const * prov_
std::shared_ptr< HandleExceptionFactory > whyFailedFactory_
edm::Handle< GenericObject >::Handle ( ObjectWithDict const &  prod,
Provenance const *  prov,
ProductID const &   
)
inline

Definition at line 65 of file GenericHandle.h.

66  : type_(prod.typeOf()), prod_(prod), prov_(prov) {
67  assert(prod_);
68  assert(prov_);
69  }
Provenance const * prov_

Member Function Documentation

void edm::Handle< GenericObject >::clear ( void  )
inline
bool edm::Handle< GenericObject >::failedToGet ( ) const
inline

Definition at line 90 of file GenericHandle.h.

References electrons_cff::bool.

90 { return bool(whyFailedFactory_); }
std::shared_ptr< HandleExceptionFactory > whyFailedFactory_
ProductID edm::Handle< GenericObject >::id ( void  ) const
inline

Definition at line 103 of file GenericHandle.h.

103 { return prov_->productID(); }
Provenance const * prov_
ProductID const & productID() const
Definition: Provenance.h:83
bool edm::Handle< GenericObject >::isValid ( void  ) const
inline

Definition at line 88 of file GenericHandle.h.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

88 { return prod_ && nullptr != prov_; }
Provenance const * prov_
ObjectWithDict const& edm::Handle< GenericObject >::operator* ( void  ) const
inline

Definition at line 98 of file GenericHandle.h.

98 { return *(this->product()); }
ObjectWithDict const * product() const
Definition: GenericHandle.h:91
ObjectWithDict const* edm::Handle< GenericObject >::operator-> ( ) const
inline

Definition at line 97 of file GenericHandle.h.

97 { return this->product(); }
ObjectWithDict const * product() const
Definition: GenericHandle.h:91
Handle<GenericObject>& edm::Handle< GenericObject >::operator= ( Handle< GenericObject > const &  rhs)
inline

Definition at line 82 of file GenericHandle.h.

References edm::swap(), and groupFilesInBlocks::temp.

82  {
84  this->swap(temp);
85  return *this;
86  }
void swap(Handle< GenericObject > &other)
Definition: GenericHandle.h:73
ObjectWithDict const* edm::Handle< GenericObject >::product ( ) const
inline

Definition at line 91 of file GenericHandle.h.

91  {
92  if (this->failedToGet()) {
93  whyFailedFactory_->make()->raise();
94  }
95  return &prod_;
96  }
std::shared_ptr< HandleExceptionFactory > whyFailedFactory_
Provenance const* edm::Handle< GenericObject >::provenance ( ) const
inline

Definition at line 101 of file GenericHandle.h.

101 { return prov_; }
Provenance const * prov_
void edm::Handle< GenericObject >::setWhyFailedFactory ( std::shared_ptr< HandleExceptionFactory > const &  iWhyFailed)
inline

Definition at line 110 of file GenericHandle.h.

Referenced by edm::convert_handle().

110  {
111  whyFailedFactory_ = iWhyFailed;
112  }
std::shared_ptr< HandleExceptionFactory > whyFailedFactory_
void edm::Handle< GenericObject >::swap ( Handle< GenericObject > &  other)
inline

Definition at line 73 of file GenericHandle.h.

References prod_, prov_, edm::swap(), std::swap(), type_, and whyFailedFactory_.

73  {
74  // use unqualified swap for user defined classes
75  using std::swap;
76  swap(type_, other.type_);
77  std::swap(prod_, other.prod_);
78  swap(prov_, other.prov_);
79  swap(whyFailedFactory_, other.whyFailedFactory_);
80  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Provenance const * prov_
void swap(Handle< GenericObject > &other)
Definition: GenericHandle.h:73
std::shared_ptr< HandleExceptionFactory > whyFailedFactory_
TypeWithDict const& edm::Handle< GenericObject >::type ( ) const
inline

Member Data Documentation

Definition at line 116 of file GenericHandle.h.

Referenced by swap().

Provenance const* edm::Handle< GenericObject >::prov_
private

Definition at line 117 of file GenericHandle.h.

Referenced by swap().

std::shared_ptr<HandleExceptionFactory> edm::Handle< GenericObject >::whyFailedFactory_
private

Definition at line 118 of file GenericHandle.h.

Referenced by swap().