CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ObjectWithDict.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ObjectWithDict_h
2 #define FWCore_Utilities_ObjectWithDict_h
3 
4 /*----------------------------------------------------------------------
5 
6 ObjectWithDict: A holder for an object and its type information.
7 
8 ----------------------------------------------------------------------*/
9 #include <string>
10 #include <typeinfo>
11 
13 
14 namespace edm {
15 
17  public:
19 
20  ObjectWithDict(TypeWithDict const& type, void* address);
21 
22  ObjectWithDict(std::type_info const& typeID, void* address);
23 
24  static ObjectWithDict byType(TypeWithDict const& type);
25 
26  void* address() const;
27 
28  TypeWithDict const& typeOf() const;
29 
30  TypeWithDict dynamicType() const;
31 
32  ObjectWithDict get(std::string const& memberName) const;
33 
34 #ifndef __GCCXML__
35  explicit operator bool() const;
36 #endif
37 
38  template <typename T> T objectCast() {
39  return *reinterpret_cast<T*>(address_);
40  }
41 
42  private:
43  friend class FunctionWithDict;
44  friend class MemberWithDict;
45  friend class TypeWithDict;
46 
48  void* address_;
49  };
50 
51 }
52 #endif
static ObjectWithDict byType(TypeWithDict const &type)
type
Definition: HCALResponse.h:21
void * address() const
TypeWithDict dynamicType() const
TypeWithDict const & typeOf() const
long double T
TypeWithDict type_