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

Public Member Functions

void build (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema, RelationalBuffer &operationBuffer)
 
 DependentClassWriter ()
 
void write (int oId, int refId, const void *data)
 
 ~DependentClassWriter ()
 

Private Attributes

DataElement m_dataElement
 
InsertOperationm_depInsert
 
std::auto_ptr< IRelationalWriterm_writer
 

Detailed Description

Definition at line 17 of file UniqueRefStreamer.cc.

Constructor & Destructor Documentation

ora::DependentClassWriter::DependentClassWriter ( )
inline

Definition at line 20 of file UniqueRefStreamer.cc.

20  :
21  m_dataElement(),
22  m_writer(),
23  m_depInsert( 0 ){
24  }
std::auto_ptr< IRelationalWriter > m_writer
InsertOperation * m_depInsert
ora::DependentClassWriter::~DependentClassWriter ( )
inline

Definition at line 48 of file UniqueRefStreamer.cc.

48  {
49  }

Member Function Documentation

void ora::DependentClassWriter::build ( const Reflex::Type &  objectType,
MappingElement mapping,
ContainerSchema contSchema,
RelationalBuffer operationBuffer 
)
inline

Definition at line 26 of file UniqueRefStreamer.cc.

References ora::InputRelationalData::addId(), ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_dataElement, m_depInsert, m_writer, ora::RelationalBuffer::newInsert(), ora::RelationalStreamerFactory::newWriter(), ora::MappingElement::tableName(), and ora::throwException().

Referenced by ora::UniqueRefWriter::write().

27  {
28 
29  m_depInsert = &operationBuffer.newInsert( mapping.tableName());
30  const std::vector<std::string> columns = mapping.columnNames();
31  for( std::vector<std::string>::const_iterator iC = columns.begin();
32  iC != columns.end(); ++iC){
33  m_depInsert->addId( *iC );
34  }
35 
36  MappingElement::iterator iMe = mapping.find( objectType.Name(Reflex::SCOPED) );
37  // the first inner mapping is the relevant...
38  if( iMe == mapping.end()){
39  throwException("Could not find a mapping element for class \""+
40  objectType.Name(Reflex::SCOPED)+"\"",
41  "DependentClassWriter::write");
42  }
43  RelationalStreamerFactory streamerFactory( contSchema );
44  m_writer.reset( streamerFactory.newWriter( objectType, iMe->second ) );
45  m_writer->build( m_dataElement, *m_depInsert, operationBuffer );
46  }
std::auto_ptr< IRelationalWriter > m_writer
InsertOperation * m_depInsert
void addId(const std::string &columnName)
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
void ora::DependentClassWriter::write ( int  oId,
int  refId,
const void *  data 
)
inline

Definition at line 51 of file UniqueRefStreamer.cc.

References ora::InputRelationalData::data(), m_depInsert, m_writer, and ora::throwException().

Referenced by ora::UniqueRefWriter::write().

51  {
52  if( !m_depInsert ){
53  throwException( "DependentClassWriter has not been built.",
54  "DependentClassWriter::write");
55  }
56 
57  coral::AttributeList& dataBuff = m_depInsert->data();
58  coral::AttributeList::iterator iData = dataBuff.begin();
59  iData->data<int>()= oId;
60  ++iData;
61  iData->data<int>()= refId;
62  // transfering the refId
63  std::vector<int> recordId(1,refId);
64  m_writer->setRecordId( recordId);
65  m_writer->write( oId, data );
66  }
std::auto_ptr< IRelationalWriter > m_writer
InsertOperation * m_depInsert
coral::AttributeList & data()
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10

Member Data Documentation

DataElement ora::DependentClassWriter::m_dataElement
private

Definition at line 69 of file UniqueRefStreamer.cc.

Referenced by build().

InsertOperation* ora::DependentClassWriter::m_depInsert
private

Definition at line 71 of file UniqueRefStreamer.cc.

Referenced by build(), and write().

std::auto_ptr<IRelationalWriter> ora::DependentClassWriter::m_writer
private

Definition at line 70 of file UniqueRefStreamer.cc.

Referenced by build(), and write().