CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ObjectWithDict.cc
Go to the documentation of this file.
3 
4 namespace edm {
5 
7  type_(),
8  address_(nullptr) {
9  }
10 
14  return obj;
15  }
16 
18  type_(type),
19  address_(address) {
20  }
21 
22  ObjectWithDict::ObjectWithDict(std::type_info const& typeID, void* address) :
23  type_(TypeWithDict(typeID)),
24  address_(address) {
25  }
26 
27  TypeWithDict const&
29  return type_;
30  }
31 
34  if(!type_.isVirtual()) {
35  return type_;
36  }
37  struct Dummy_t {virtual ~Dummy_t() {} };
38  return TypeWithDict(typeid(*(Dummy_t*)address_));
39  }
40 
41  ObjectWithDict::operator bool() const {
42  return bool(type_) && address_ != nullptr;
43  }
44 
45  void*
47  return address_;
48  }
49 
51  ObjectWithDict::get(std::string const& memberName) const {
52  return type_.dataMemberByName(memberName).get(*this);
53  }
54 }
static ObjectWithDict byType(TypeWithDict const &type)
type
Definition: HCALResponse.h:21
char * address
Definition: mlp_lapack.h:14
void * address() const
#define nullptr
TypeWithDict dynamicType() const
friend class TypeWithDict
bool isVirtual() const
ObjectWithDict get() const
TypeWithDict const & typeOf() const
MemberWithDict dataMemberByName(std::string const &member) const
ObjectWithDict construct() const
TypeWithDict type_
ObjectWithDict get(std::string const &memberName) const