CMS 3D CMS Logo

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

#include <Object.h>

Public Member Functions

void * address () const
 
void * cast (const std::type_info &asType) const
 
template<typename T >
Tcast () const
 
void destruct ()
 
boost::shared_ptr< void > makeShared () const
 
 Object ()
 
template<typename T >
 Object (const T &obj)
 
 Object (const void *ptr, const std::type_info &typeInfo)
 
 Object (const void *ptr, const edm::TypeWithDict &type)
 
 Object (const void *ptr, const std::string &typeName)
 
 Object (const Object &rhs)
 
bool operator!= (const Object &rhs) const
 
Objectoperator= (const Object &rhs)
 
bool operator== (const Object &rhs) const
 
const edm::TypeWithDicttype () const
 
std::string typeName () const
 
virtual ~Object ()
 

Private Attributes

void * m_ptr
 
edm::TypeWithDict m_type
 

Detailed Description

Definition at line 13 of file Object.h.

Constructor & Destructor Documentation

ora::Object::Object ( )

Definition at line 7 of file Object.cc.

7  :
8  m_ptr(0),
9  m_type(){
10 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
template<typename T >
ora::Object::Object ( const T obj)
inlineexplicit

Definition at line 49 of file Object.h.

49  :
50  Object( &obj, typeid(obj) ){
51 }
Object()
Definition: Object.cc:7
ora::Object::Object ( const void *  ptr,
const std::type_info &  typeInfo 
)

Definition at line 12 of file Object.cc.

References ora::ClassUtils::lookupDictionary(), and m_type.

12  :
13  m_ptr( const_cast<void*>(ptr) ){
14  m_type = ClassUtils::lookupDictionary( typeInfo, true );
15 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:170
ora::Object::Object ( const void *  ptr,
const edm::TypeWithDict type 
)

Definition at line 17 of file Object.cc.

17  :
18  m_ptr( const_cast<void*>(ptr) ),
19  m_type( type ){
20 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
ora::Object::Object ( const void *  ptr,
const std::string &  typeName 
)

Definition at line 22 of file Object.cc.

22  :
23  m_ptr( const_cast<void*>(ptr) ),
25 }
std::string typeName() const
Definition: Object.cc:59
edm::TypeWithDict m_type
Definition: Object.h:35
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
void * m_ptr
Definition: Object.h:34
ora::Object::Object ( const Object rhs)
inline

Definition at line 40 of file Object.h.

40  :
41  m_ptr( rhs.m_ptr ),
42  m_type( rhs.m_type ){
43  }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
ora::Object::~Object ( )
virtual

Definition at line 32 of file Object.cc.

32  {
33 }

Member Function Documentation

void * ora::Object::address ( ) const

Definition at line 51 of file Object.cc.

Referenced by ora::Container::insertItem(), and ora::Container::updateItem().

51  {
52  return m_ptr;
53 }
void * m_ptr
Definition: Object.h:34
void * ora::Object::cast ( const std::type_info &  asType) const

Definition at line 63 of file Object.cc.

References ora::ClassUtils::lookupDictionary(), ora::throwException(), and ora::ClassUtils::upCast().

63  {
64  edm::TypeWithDict castType = ClassUtils::lookupDictionary( typeInfo );
65  if( ! m_type ){
66  throwException( "Object input class has not been found in the dictionary.",
67  "Object::cast" );
68 
69  }
70  return ClassUtils::upCast( m_type, m_ptr, castType );
71 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * upCast(const edm::TypeWithDict &type, void *ptr, const edm::TypeWithDict &asType)
Definition: ClassUtils.cc:38
void * m_ptr
Definition: Object.h:34
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:170
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
template<typename T >
T * ora::Object::cast ( ) const
inline

Definition at line 56 of file Object.h.

56  {
57  const std::type_info& typeInfo = typeid(T);
58  return static_cast<T*>( cast( typeInfo ) );
59 }
T * cast() const
Definition: Object.h:56
long double T
void ora::Object::destruct ( )

Definition at line 81 of file Object.cc.

References ora::throwException().

81  {
82  if( ! m_type ){
83  throwException( "Object input class has not been found in the dictionary.",
84  "Object::destruct" );
85 
86  }
87  if( m_ptr ){
89  m_ptr = 0;
90  }
91 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
void destruct(void *address, bool dealloc=true) const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
boost::shared_ptr< void > ora::Object::makeShared ( ) const

Definition at line 73 of file Object.cc.

References runTheMatrix::ret.

73  {
74  boost::shared_ptr<void> ret;
75  if( m_ptr ) {
76  ret = boost::shared_ptr<void>( m_ptr, RflxDeleter( m_type ) );
77  }
78  return ret;
79 }
tuple ret
prodAgent to be discontinued
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
bool ora::Object::operator!= ( const Object rhs) const

Definition at line 47 of file Object.cc.

References operator==().

47  {
48  return !operator==( rhs );
49 }
bool operator==(const Object &rhs) const
Definition: Object.cc:41
ora::Object & ora::Object::operator= ( const Object rhs)

Definition at line 35 of file Object.cc.

References m_ptr, and m_type.

35  {
36  m_ptr = rhs.m_ptr;
37  m_type = rhs.m_type;
38  return *this;
39 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
bool ora::Object::operator== ( const Object rhs) const

Definition at line 41 of file Object.cc.

References m_ptr, and m_type.

41  {
42  if( m_ptr != rhs.m_ptr ) return false;
43  if( m_type != rhs.m_type ) return false;
44  return true;
45 }
edm::TypeWithDict m_type
Definition: Object.h:35
void * m_ptr
Definition: Object.h:34
const edm::TypeWithDict & ora::Object::type ( ) const
std::string ora::Object::typeName ( ) const

Definition at line 59 of file Object.cc.

59  {
60  return m_type.cppName();
61 }
edm::TypeWithDict m_type
Definition: Object.h:35
std::string cppName() const

Member Data Documentation

void* ora::Object::m_ptr
private

Definition at line 34 of file Object.h.

Referenced by operator=(), and operator==().

edm::TypeWithDict ora::Object::m_type
private

Definition at line 35 of file Object.h.

Referenced by Object(), operator=(), and operator==().