CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::Object Class Reference

#include <Object.h>

List of all members.

Public Member Functions

void * address () const
void * cast (const std::type_info &asType) const
template<typename T >
T * cast () const
void destruct ()
 Object (const Object &rhs)
 Object (const void *ptr, const Reflex::Type &type)
 Object ()
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.

                 :
  m_ptr(0),
  m_type(){
}
ora::Object::Object ( const void *  ptr,
const Reflex::Type &  type 
)

Definition at line 12 of file Object.cc.

                                                          :
  m_ptr( const_cast<void*>(ptr) ),
  m_type( type ){
}
ora::Object::Object ( const Object rhs)

Definition at line 17 of file Object.cc.

                                   :
  m_ptr( rhs.m_ptr ),
  m_type( rhs.m_type ){
}
ora::Object::~Object ( ) [virtual]

Definition at line 22 of file Object.cc.

                  {
}

Member Function Documentation

void * ora::Object::address ( ) const
template<typename T >
T * ora::Object::cast ( ) const [inline]

Definition at line 35 of file Object.h.

                      {
  const std::type_info& typeInfo = typeid(T);
  return static_cast<T*>( cast( typeInfo ) );
}
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().

                                                         {
  Reflex::Type castType = ClassUtils::lookupDictionary( typeInfo );
  if( ! m_type ){
    throwException( "Object input class has not been found in the dictionary.",
                    "Object::cast" );
    
  }
  return ClassUtils::upCast( m_type, m_ptr, castType );
}
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().

                         {
  if( ! m_type ){
    throwException( "Object input class has not been found in the dictionary.",
                    "Object::cast" );
    
  }
  if( m_ptr ){
    m_type.Destruct( m_ptr );
    m_ptr = 0;
  }
}
bool ora::Object::operator!= ( const Object rhs) const

Definition at line 37 of file Object.cc.

References operator==().

                                                  {
  return !operator==( rhs );
}
ora::Object & ora::Object::operator= ( const Object rhs)

Definition at line 25 of file Object.cc.

References m_ptr, and m_type.

                                                 {
  m_ptr = rhs.m_ptr;
  m_type = rhs.m_type;
  return *this;
}
bool ora::Object::operator== ( const Object rhs) const

Definition at line 31 of file Object.cc.

References m_ptr, and m_type.

                                                  {
  if( m_ptr != rhs.m_ptr ) return false;
  if( m_type != rhs.m_type ) return false;
  return true;
}
const Reflex::Type & ora::Object::type ( ) const

Definition at line 45 of file Object.cc.

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

                                        {
  return m_type;
}
std::string ora::Object::typeName ( ) const

Definition at line 49 of file Object.cc.

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

                                    {
  return m_type.Name( Reflex::SCOPED );
}

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