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

#include <OraPtrStreamer.h>

Inheritance diagram for ora::OraPtrWriter:
ora::IRelationalWriter

Public Member Functions

bool build (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
 
 OraPtrWriter (const edm::TypeWithDict &objectType, MappingElement &mapping, ContainerSchema &contSchema)
 
void setRecordId (const std::vector< int > &identity)
 
void write (int oid, const void *data)
 Writes a data element. More...
 
virtual ~OraPtrWriter ()
 
- Public Member Functions inherited from ora::IRelationalWriter
virtual ~IRelationalWriter ()
 Destructor. More...
 

Private Attributes

DataElementm_dataElement
 
DataElement m_localElement
 
MappingElementm_mappingElement
 
edm::TypeWithDict m_objectType
 
ContainerSchemam_schema
 
std::auto_ptr< IRelationalWriterm_writer
 

Detailed Description

Definition at line 20 of file OraPtrStreamer.h.

Constructor & Destructor Documentation

ora::OraPtrWriter::OraPtrWriter ( const edm::TypeWithDict objectType,
MappingElement mapping,
ContainerSchema contSchema 
)

Definition at line 142 of file OraPtrStreamer.cc.

144  :
145  m_objectType( objectType ),
146  m_mappingElement( mapping ),
147  m_schema( contSchema ),
148  m_localElement(),
149  m_dataElement( 0 ),
150  m_writer(){
151 }
ContainerSchema & m_schema
DataElement m_localElement
std::auto_ptr< IRelationalWriter > m_writer
edm::TypeWithDict m_objectType
MappingElement & m_mappingElement
DataElement * m_dataElement
ora::OraPtrWriter::~OraPtrWriter ( )
virtual

Definition at line 153 of file OraPtrStreamer.cc.

153  {
154 }

Member Function Documentation

bool ora::OraPtrWriter::build ( DataElement dataElement,
IRelationalData relationalData,
RelationalBuffer operationBuffer 
)
virtual

Implements ora::IRelationalWriter.

Definition at line 156 of file OraPtrStreamer.cc.

References ora::DataElement::clear(), edm::TypeWithDict::name(), ora::RelationalStreamerFactory::newWriter(), ora::ClassUtils::resolvedType(), AlCaHLTBitMon_QueryRunRegistry::string, edm::TypeWithDict::templateArgumentAt(), and ora::throwException().

Referenced by psClasses.BuildThread::run().

158  {
159  m_dataElement = &dataElement;
161 
162  // Check the type
164  edm::TypeWithDict ptrResolvedType = ClassUtils::resolvedType(ptrType);
165  // Check the component type
166  if ( ! ptrType || !ptrResolvedType ) {
167  throwException( "Missing dictionary information for the type of the pointer \"" +
168  m_objectType.cppName() + "\"",
169  "OraPtrWriter::build" );
170  }
171 
172  std::string ptrTypeName = ptrType.name();
173 // Retrieve the relevant mapping element
174  MappingElement::iterator iMe = m_mappingElement.find( ptrTypeName );
175  if ( iMe == m_mappingElement.end() ) {
176  throwException( "Item for \"" + ptrTypeName + "\" not found in the mapping element",
177  "OraPtrWriter::build" );
178  }
179  RelationalStreamerFactory streamerFactory( m_schema );
180  m_writer.reset( streamerFactory.newWriter( ptrResolvedType, iMe->second ));
181  return m_writer->build( m_localElement, relationalData, operationBuffer );
182 }
edm::TypeWithDict resolvedType(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:486
TypeWithDict templateArgumentAt(size_t index) const
ContainerSchema & m_schema
std::string name() const
std::string cppName() const
iterator find(const std::string &key)
Retrieves a sub-element.
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
DataElement m_localElement
std::auto_ptr< IRelationalWriter > m_writer
edm::TypeWithDict m_objectType
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
iterator end()
Returns an iterator in the end of the sequence.
MappingElement & m_mappingElement
DataElement * m_dataElement
void ora::OraPtrWriter::setRecordId ( const std::vector< int > &  identity)
virtual

Implements ora::IRelationalWriter.

Definition at line 184 of file OraPtrStreamer.cc.

184  {
185  m_writer->setRecordId( identity );
186 }
std::auto_ptr< IRelationalWriter > m_writer
void ora::OraPtrWriter::write ( int  oid,
const void *  data 
)
virtual

Writes a data element.

Implements ora::IRelationalWriter.

Definition at line 189 of file OraPtrStreamer.cc.

References ora::throwException().

Referenced by pkg.AbstractPkg::generate(), and querying.connection::write_and_commit().

190  {
191 
192  if(!m_dataElement){
193  throwException("The streamer has not been built.",
194  "OraPtrWriter::write");
195  }
196 
198  // first load if required
199  m_objectType.functionMemberByName("load").invoke(ptrObject,nullptr);
200  // then get the data...
201  void* ptrAddress = nullptr;
202  edm::ObjectWithDict ptrAddrObj = edm::ObjectWithDict( edm::TypeWithDict(typeid(void*)), &ptrAddress );
203  m_objectType.functionMemberByName("address").invoke(ptrObject, &ptrAddrObj);
204  m_writer->write( oid, ptrAddress );
205 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:49
void invoke(ObjectWithDict const &obj, ObjectWithDict *ret=nullptr, std::vector< void * > const &values=std::vector< void * >()) const
Call a member function.
FunctionWithDict functionMemberByName(std::string const &) const
std::auto_ptr< IRelationalWriter > m_writer
edm::TypeWithDict m_objectType
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
DataElement * m_dataElement

Member Data Documentation

DataElement* ora::OraPtrWriter::m_dataElement
private

Definition at line 41 of file OraPtrStreamer.h.

DataElement ora::OraPtrWriter::m_localElement
private

Definition at line 40 of file OraPtrStreamer.h.

MappingElement& ora::OraPtrWriter::m_mappingElement
private

Definition at line 38 of file OraPtrStreamer.h.

edm::TypeWithDict ora::OraPtrWriter::m_objectType
private

Definition at line 37 of file OraPtrStreamer.h.

ContainerSchema& ora::OraPtrWriter::m_schema
private

Definition at line 39 of file OraPtrStreamer.h.

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

Definition at line 42 of file OraPtrStreamer.h.