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 ()
 
 Object ()
 
 Object (const void *ptr, const Reflex::Type &type)
 
 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 11 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:28
void * m_ptr
Definition: Object.h:27
ora::Object::Object ( const void *  ptr,
const Reflex::Type &  type 
)

Definition at line 12 of file Object.cc.

12  :
13  m_ptr( const_cast<void*>(ptr) ),
14  m_type( type ){
15 }
type
Definition: HCALResponse.h:22
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
ora::Object::Object ( const Object rhs)

Definition at line 17 of file Object.cc.

17  :
18  m_ptr( rhs.m_ptr ),
19  m_type( rhs.m_type ){
20 }
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
ora::Object::~Object ( )
virtual

Definition at line 22 of file Object.cc.

22  {
23 }

Member Function Documentation

void * ora::Object::address ( ) const
void * ora::Object::cast ( const std::type_info &  asType) const

Definition at line 53 of file Object.cc.

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

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

53  {
54  Reflex::Type castType = ClassUtils::lookupDictionary( typeInfo );
55  if( ! m_type ){
56  throwException( "Object input class has not been found in the dictionary.",
57  "Object::cast" );
58 
59  }
60  return ClassUtils::upCast( m_type, m_ptr, castType );
61 }
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
void * upCast(const Reflex::Type &type, void *ptr, const Reflex::Type &asType)
Definition: ClassUtils.cc:32
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
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 35 of file Object.h.

35  {
36  const std::type_info& typeInfo = typeid(T);
37  return static_cast<T*>( cast( typeInfo ) );
38 }
T * cast() const
Definition: Object.h:35
long double T
void ora::Object::destruct ( )

Definition at line 63 of file Object.cc.

References ora::throwException().

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

63  {
64  if( ! m_type ){
65  throwException( "Object input class has not been found in the dictionary.",
66  "Object::destruct" );
67 
68  }
69  if( m_ptr ){
70  m_type.Destruct( m_ptr );
71  m_ptr = 0;
72  }
73 }
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
bool ora::Object::operator!= ( const Object rhs) const

Definition at line 37 of file Object.cc.

References operator==().

37  {
38  return !operator==( rhs );
39 }
bool operator==(const Object &rhs) const
Definition: Object.cc:31
ora::Object & ora::Object::operator= ( const Object rhs)

Definition at line 25 of file Object.cc.

References m_ptr, and m_type.

25  {
26  m_ptr = rhs.m_ptr;
27  m_type = rhs.m_type;
28  return *this;
29 }
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
bool ora::Object::operator== ( const Object rhs) const

Definition at line 31 of file Object.cc.

References m_ptr, and m_type.

31  {
32  if( m_ptr != rhs.m_ptr ) return false;
33  if( m_type != rhs.m_type ) return false;
34  return true;
35 }
Reflex::Type m_type
Definition: Object.h:28
void * m_ptr
Definition: Object.h:27
const Reflex::Type & ora::Object::type ( ) const
std::string ora::Object::typeName ( ) const

Definition at line 49 of file Object.cc.

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

49  {
50  return m_type.Name( Reflex::SCOPED );
51 }
Reflex::Type m_type
Definition: Object.h:28

Member Data Documentation

void* ora::Object::m_ptr
private

Definition at line 27 of file Object.h.

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

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

Definition at line 28 of file Object.h.

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