File indexing completed on 2024-04-06 12:13:01
0001 #ifndef FWCore_Reflection_ObjectWithDict_h
0002 #define FWCore_Reflection_ObjectWithDict_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <string>
0011 #include <typeinfo>
0012
0013 #include "FWCore/Reflection/interface/TypeWithDict.h"
0014
0015 namespace edm {
0016
0017 class ObjectWithDict {
0018 private:
0019 TypeWithDict type_;
0020 void* address_;
0021
0022 public:
0023 static ObjectWithDict byType(TypeWithDict const&);
0024
0025 public:
0026 ObjectWithDict();
0027 explicit ObjectWithDict(TypeWithDict const&, void* address);
0028 explicit ObjectWithDict(std::type_info const&, void* address);
0029 explicit operator bool() const;
0030 void* address() const;
0031 TypeWithDict typeOf() const;
0032 TypeWithDict dynamicType() const;
0033 ObjectWithDict castObject(TypeWithDict const&) const;
0034 ObjectWithDict get(std::string const& memberName) const;
0035
0036 void destruct(bool dealloc) const;
0037 template <typename T>
0038 T objectCast() {
0039 return *reinterpret_cast<T*>(address_);
0040 }
0041 };
0042
0043 }
0044
0045 #endif