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 Reflex::Type &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 Reflex::Type & type () const
 
std::string typeName () const
 
virtual ~Object ()
 

Private Attributes

void * m_ptr
 
Reflex::Type m_type
 

Detailed Description

Definition at line 12 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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
template<typename T >
ora::Object::Object ( const T obj)
inlineexplicit

Definition at line 48 of file Object.h.

48  :
49  Object( &obj, typeid(obj) ){
50 }
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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:93
ora::Object::Object ( const void *  ptr,
const Reflex::Type &  type 
)

Definition at line 17 of file Object.cc.

17  :
18  m_ptr( const_cast<void*>(ptr) ),
19  m_type( type ){
20 }
type
Definition: HCALResponse.h:21
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
ora::Object::Object ( const void *  ptr,
const std::string &  typeName 
)

Definition at line 22 of file Object.cc.

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

22  :
23  m_ptr( const_cast<void*>(ptr) ){
25 }
Reflex::Type m_type
Definition: Object.h:34
std::string typeName() const
Definition: Object.cc:59
void * m_ptr
Definition: Object.h:33
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:93
ora::Object::Object ( const Object rhs)
inline

Definition at line 39 of file Object.h.

39  :
40  m_ptr( rhs.m_ptr ),
41  m_type( rhs.m_type ){
42  }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
ora::Object::~Object ( )
virtual

Definition at line 32 of file Object.cc.

32  {
33 }

Member Function Documentation

void * ora::Object::address ( ) const
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().

Referenced by cond::PayLoadInspector< DataT >::object().

63  {
64  Reflex::Type 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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
void * upCast(const Reflex::Type &type, void *ptr, const Reflex::Type &asType)
Definition: ClassUtils.cc:32
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:93
template<typename T >
T * ora::Object::cast ( ) const
inline

Definition at line 55 of file Object.h.

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

Definition at line 81 of file Object.cc.

References ora::throwException().

Referenced by cond::DbSession::importObject(), and cond::PayLoadInspector< DataT >::~PayLoadInspector().

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 ){
88  m_type.Destruct( m_ptr );
89  m_ptr = 0;
90  }
91 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
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 run_regression::ret.

Referenced by cond::deserialize().

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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
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 }
Reflex::Type m_type
Definition: Object.h:34
void * m_ptr
Definition: Object.h:33
const Reflex::Type & ora::Object::type ( ) const
std::string ora::Object::typeName ( ) const

Definition at line 59 of file Object.cc.

Referenced by cond::PayLoadInspector< DataT >::dumpXML(), and cond::persistency::OraPayloadTable::select().

59  {
60  return m_type.Name( Reflex::SCOPED );
61 }
Reflex::Type m_type
Definition: Object.h:34

Member Data Documentation

void* ora::Object::m_ptr
private

Definition at line 33 of file Object.h.

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

Reflex::Type ora::Object::m_type
private

Definition at line 34 of file Object.h.

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