test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
edm::ObjectWithDict Class Reference

#include <ObjectWithDict.h>

Public Member Functions

void * address () const
 
TypeWithDict dynamicType () const
 
ObjectWithDict get (std::string const &memberName) const
 
template<typename T >
T objectCast ()
 
 ObjectWithDict ()
 
 ObjectWithDict (TypeWithDict const &type, void *address)
 
 ObjectWithDict (std::type_info const &typeID, void *address)
 
 operator bool () const
 
TypeWithDict const & typeOf () const
 

Static Public Member Functions

static ObjectWithDict byType (TypeWithDict const &type)
 

Private Attributes

void * address_
 
TypeWithDict type_
 

Friends

class FunctionWithDict
 
class MemberWithDict
 
class TypeWithDict
 

Detailed Description

Definition at line 16 of file ObjectWithDict.h.

Constructor & Destructor Documentation

edm::ObjectWithDict::ObjectWithDict ( )

Definition at line 6 of file ObjectWithDict.cc.

6  :
7  type_(),
8  address_(nullptr) {
9  }
TypeWithDict type_
edm::ObjectWithDict::ObjectWithDict ( TypeWithDict const &  type,
void *  address 
)

Definition at line 17 of file ObjectWithDict.cc.

17  :
18  type_(type),
19  address_(address) {
20  }
type
Definition: HCALResponse.h:21
void * address() const
TypeWithDict type_
edm::ObjectWithDict::ObjectWithDict ( std::type_info const &  typeID,
void *  address 
)

Definition at line 22 of file ObjectWithDict.cc.

22  :
23  type_(TypeWithDict(typeID)),
24  address_(address) {
25  }
void * address() const
friend class TypeWithDict
TypeWithDict type_

Member Function Documentation

void * edm::ObjectWithDict::address ( ) const
ObjectWithDict edm::ObjectWithDict::byType ( TypeWithDict const &  type)
static
TypeWithDict edm::ObjectWithDict::dynamicType ( ) const

Definition at line 33 of file ObjectWithDict.cc.

References address_, edm::TypeWithDict::isVirtual(), type_, and TypeWithDict.

Referenced by fwlite::RecordWriter::update().

33  {
34  if(!type_.isVirtual()) {
35  return type_;
36  }
37  struct Dummy_t {virtual ~Dummy_t() {} };
38  return TypeWithDict(typeid(*(Dummy_t*)address_));
39  }
friend class TypeWithDict
bool isVirtual() const
TypeWithDict type_
ObjectWithDict edm::ObjectWithDict::get ( std::string const &  memberName) const
template<typename T >
T edm::ObjectWithDict::objectCast ( )
inline

Definition at line 38 of file ObjectWithDict.h.

References address_.

38  {
39  return *reinterpret_cast<T*>(address_);
40  }
long double T
edm::ObjectWithDict::operator bool ( ) const
explicit

Definition at line 41 of file ObjectWithDict.cc.

41  {
42  return bool(type_) && address_ != nullptr;
43  }
TypeWithDict type_
TypeWithDict const & edm::ObjectWithDict::typeOf ( ) const

Friends And Related Function Documentation

friend class FunctionWithDict
friend

Definition at line 43 of file ObjectWithDict.h.

friend class MemberWithDict
friend

Definition at line 44 of file ObjectWithDict.h.

friend class TypeWithDict
friend

Definition at line 45 of file ObjectWithDict.h.

Referenced by dynamicType().

Member Data Documentation

void* edm::ObjectWithDict::address_
private

Definition at line 48 of file ObjectWithDict.h.

Referenced by address(), dynamicType(), and objectCast().

TypeWithDict edm::ObjectWithDict::type_
private