CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::OraPtrUpdater Class Reference

#include <OraPtrStreamer.h>

Inheritance diagram for ora::OraPtrUpdater:
ora::IRelationalUpdater

List of all members.

Public Member Functions

bool build (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
 OraPtrUpdater (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void setRecordId (const std::vector< int > &identity)
void update (int oid, const void *data)
 Updates a data element.
virtual ~OraPtrUpdater ()

Private Attributes

DataElementm_dataElement
DataElement m_localElement
MappingElementm_mappingElement
Reflex::Type m_objectType
ContainerSchemam_schema
std::auto_ptr< IRelationalUpdaterm_updater

Detailed Description

Definition at line 45 of file OraPtrStreamer.h.


Constructor & Destructor Documentation

ora::OraPtrUpdater::OraPtrUpdater ( const Reflex::Type &  objectType,
MappingElement mapping,
ContainerSchema contSchema 
)

Definition at line 205 of file OraPtrStreamer.cc.

                                                                :
  m_objectType( objectType ),
  m_mappingElement( mapping ),
  m_schema( contSchema ), 
  m_localElement(),
  m_dataElement( 0 ),
  m_updater(){
}
ora::OraPtrUpdater::~OraPtrUpdater ( ) [virtual]

Definition at line 216 of file OraPtrStreamer.cc.

                                {
}

Member Function Documentation

bool ora::OraPtrUpdater::build ( DataElement dataElement,
IRelationalData relationalData,
RelationalBuffer operationBuffer 
) [virtual]

Implements ora::IRelationalUpdater.

Definition at line 219 of file OraPtrStreamer.cc.

References ora::DataElement::clear(), ora::RelationalStreamerFactory::newUpdater(), ora::ClassUtils::resolvedType(), and ora::throwException().

                                                                 {
  m_dataElement = &dataElement;
  m_localElement.clear();
  
  // Check the  type
  Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0);
  Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType);
  // Check the component type
  if ( ! ptrType || !ptrResolvedType ) {
    throwException( "Missing dictionary information for the type of the pointer \"" +
                    m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
                    "OraPtrUpdater::build" );
  }

  std::string ptrTypeName = ptrType.Name();
// Retrieve the relevant mapping element
  MappingElement::iterator iMe = m_mappingElement.find( ptrTypeName );
  if ( iMe == m_mappingElement.end() ) {
    throwException( "Item for \"" + ptrTypeName + "\" not found in the mapping element",
                    "OraPtrUpdater::build" );
  }
  RelationalStreamerFactory streamerFactory( m_schema );
  m_updater.reset( streamerFactory.newUpdater( ptrResolvedType, iMe->second ) );
  return m_updater->build( m_localElement, relationalData, operationBuffer );
}
void ora::OraPtrUpdater::setRecordId ( const std::vector< int > &  identity) [virtual]

Implements ora::IRelationalUpdater.

Definition at line 247 of file OraPtrStreamer.cc.

                                                                  {
  m_updater->setRecordId( identity );
}
void ora::OraPtrUpdater::update ( int  oid,
const void *  data 
) [virtual]

Updates a data element.

Writes a data element.

Implements ora::IRelationalUpdater.

Definition at line 252 of file OraPtrStreamer.cc.

References ora::throwException().

                                                   {
  if(!m_dataElement){
    throwException("The streamer has not been built.",
                   "OraPtrUpdater::update");    
  }
  Reflex::Object ptrObject( m_objectType, m_dataElement->address( data ) );
  // first load if required
  ptrObject.Invoke("load",0);
  void* ptrAddress = 0;
  ptrObject.Invoke("address",ptrAddress);
  m_updater->update( oid, ptrAddress );
}

Member Data Documentation

Definition at line 67 of file OraPtrStreamer.h.

Definition at line 66 of file OraPtrStreamer.h.

Definition at line 64 of file OraPtrStreamer.h.

Reflex::Type ora::OraPtrUpdater::m_objectType [private]

Definition at line 63 of file OraPtrStreamer.h.

Definition at line 65 of file OraPtrStreamer.h.

Definition at line 68 of file OraPtrStreamer.h.