CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Friends

edm::ObjectWithDict Class Reference

#include <ObjectWithDict.h>

List of all members.

Public Member Functions

void * address () const
TypeWithDict dynamicType () const
ObjectWithDict get (std::string const &memberName) const
template<typename T >
T objectCast ()
 ObjectWithDict (TypeWithDict const &type, void *address)
 ObjectWithDict ()
 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.

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

Definition at line 17 of file ObjectWithDict.cc.

edm::ObjectWithDict::ObjectWithDict ( std::type_info const &  typeID,
void *  address 
)

Definition at line 22 of file ObjectWithDict.cc.

                                                                          :
    type_(TypeWithDict(typeID)),
    address_(address) {
  }

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().

                                    {
    if(!type_.isVirtual()) {
      return type_;
    }
    struct Dummy_t {virtual ~Dummy_t() {} };
    return TypeWithDict(typeid(*(Dummy_t*)address_));
  }
ObjectWithDict edm::ObjectWithDict::get ( std::string const &  memberName) const

Definition at line 51 of file ObjectWithDict.cc.

References edm::TypeWithDict::dataMemberByName(), edm::MemberWithDict::get(), and type_.

Referenced by edm::convert_handle().

                                                       {
    return type_.dataMemberByName(memberName).get(*this);
  }
template<typename T >
T edm::ObjectWithDict::objectCast ( ) [inline]

Definition at line 38 of file ObjectWithDict.h.

References address_.

                                         {
      return *reinterpret_cast<T*>(address_);
    }
edm::ObjectWithDict::operator bool ( ) const [explicit]

Definition at line 41 of file ObjectWithDict.cc.

References address_, and type_.

                                      {
    return bool(type_) && address_ != nullptr;
  }
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

Definition at line 48 of file ObjectWithDict.h.

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

Definition at line 47 of file ObjectWithDict.h.

Referenced by dynamicType(), get(), operator bool(), and typeOf().