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::DependentClassReader Class Reference

Public Member Functions

void build (const Reflex::Type &objectType, MappingElement &depMapping, ContainerSchema &contSchema)
 
 DependentClassReader ()
 
void * read (int refId)
 
 ~DependentClassReader ()
 

Private Attributes

DataElement m_dataElement
 
std::auto_ptr< SelectOperationm_depQuery
 
std::auto_ptr< IRelationalReaderm_reader
 
Reflex::Type m_type
 

Detailed Description

Definition at line 74 of file UniqueRefStreamer.cc.

Constructor & Destructor Documentation

ora::DependentClassReader::DependentClassReader ( )
inline

Definition at line 76 of file UniqueRefStreamer.cc.

76  :
77  m_dataElement(),
78  m_type(),
79  m_reader(),
80  m_depQuery(){
81  }
std::auto_ptr< IRelationalReader > m_reader
std::auto_ptr< SelectOperation > m_depQuery
ora::DependentClassReader::~DependentClassReader ( )
inline

Definition at line 101 of file UniqueRefStreamer.cc.

101  {
102  }

Member Function Documentation

void ora::DependentClassReader::build ( const Reflex::Type &  objectType,
MappingElement depMapping,
ContainerSchema contSchema 
)
inline

Definition at line 83 of file UniqueRefStreamer.cc.

References ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_dataElement, m_depQuery, m_reader, m_type, ora::RelationalStreamerFactory::newReader(), ora::ContainerSchema::storageSchema(), ora::MappingElement::tableName(), and ora::throwException().

Referenced by ora::RelationalRefLoader::build().

83  {
84 
85  m_type = objectType;
86  m_depQuery.reset( new SelectOperation( depMapping.tableName(), contSchema.storageSchema()));
87  m_depQuery->addWhereId( depMapping.columnNames()[ 1 ] );
88  MappingElement::iterator iMap = depMapping.find( m_type.Name(Reflex::SCOPED) );
89  // the first inner mapping is the good one ...
90  if( iMap == depMapping.end()){
91  throwException("Could not find a mapping element for class \""+
92  m_type.Name(Reflex::SCOPED)+"\"",
93  "DependentClassReadBuffer::ReadBuffer");
94  }
95  MappingElement& mapping = iMap->second;
96  RelationalStreamerFactory streamerFactory( contSchema );
97  m_reader.reset( streamerFactory.newReader( m_type, mapping )) ;
98  m_reader->build( m_dataElement , *m_depQuery );
99  }
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
std::auto_ptr< IRelationalReader > m_reader
std::auto_ptr< SelectOperation > m_depQuery
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
void* ora::DependentClassReader::read ( int  refId)
inline

Definition at line 104 of file UniqueRefStreamer.cc.

References ora::ClassUtils::constructObject(), m_depQuery, m_reader, m_type, and ora::throwException().

Referenced by Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), ora::RelationalRefLoader::load(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

104  {
105  if( !m_depQuery.get() ){
106  throwException( "DependentClassReader has not been built.",
107  "DependentClassReader::read");
108  }
109  coral::AttributeList& whereData = m_depQuery->whereData();
110  coral::AttributeList::iterator iWData = whereData.begin();
111  iWData->data<int>() = refId;
112  m_depQuery->execute();
113  m_reader->select( refId );
114  void* destination = 0;
115  if( m_depQuery->nextCursorRow() ){
116  destination = ClassUtils::constructObject( m_type );
117  m_reader->read( destination );
118  }
119  m_depQuery->clear();
120  m_reader->clear();
121  return destination;
122  }
void * constructObject(const Reflex::Type &typ)
Definition: ClassUtils.cc:127
std::auto_ptr< IRelationalReader > m_reader
std::auto_ptr< SelectOperation > m_depQuery
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10

Member Data Documentation

DataElement ora::DependentClassReader::m_dataElement
private

Definition at line 125 of file UniqueRefStreamer.cc.

Referenced by build().

std::auto_ptr<SelectOperation> ora::DependentClassReader::m_depQuery
private

Definition at line 128 of file UniqueRefStreamer.cc.

Referenced by build(), and read().

std::auto_ptr<IRelationalReader> ora::DependentClassReader::m_reader
private

Definition at line 127 of file UniqueRefStreamer.cc.

Referenced by build(), and read().

Reflex::Type ora::DependentClassReader::m_type
private

Definition at line 126 of file UniqueRefStreamer.cc.

Referenced by build(), and read().