//## begin module%1.7%.codegen_version preserve=yes // Read the documentation to learn more about C++ code generator // versioning. //## end module%1.7%.codegen_version //## begin module%4205D0C403E2.cm preserve=no //## end module%4205D0C403E2.cm //## begin module%4205D0C403E2.cp preserve=no // C O P Y R I G H T N O T I C E // This material is confidential to ERG and may not be disclosed in whole // or in part to any third party nor used in any manner whatsoever other // than for the purposes expressly consented to by ERG in writing. // // This material is also copyright and may not be reproduced, stored in a // retrieval system or transmitted in any form or by any means in whole or // in part without the express written consent of ERG. //## end module%4205D0C403E2.cp //## Module: TransactionStructure%4205D0C403E2; Pseudo Package body //## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4 //## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\TransactionStructure.cpp //## begin module%4205D0C403E2.additionalIncludes preserve=no //## end module%4205D0C403E2.additionalIncludes //## begin module%4205D0C403E2.includes preserve=yes #pragma warn -com #include #pragma warn +com //## end module%4205D0C403E2.includes // IXmlSchemaWrapperSchema #include "IXmlSchemaWrapperSchema.h" // IXmlSchemaWrapperElement #include "IXmlSchemaWrapperElement.h" // IXmlSchemaWrapperHandle #include "IXmlSchemaWrapperHandle.h" // IXmlSchemaWrapperFactory #include "IXmlSchemaWrapperFactory.h" // IXmlSchemaWrapperStream #include "IXmlSchemaWrapperStream.h" // TransactionStream #include "TransactionStream.h" // TransactionStructure #include "TransactionStructure.h" //## begin module%4205D0C403E2.additionalDeclarations preserve=yes //## end module%4205D0C403E2.additionalDeclarations // Class TransactionStructure //## Operation: TransactionStructure%4205D148027B TransactionStructure::TransactionStructure (const std::string &name, const int &iteration, XMLSchema::IXmlSchemaWrapperFactory &schemaFactory, XMLSchema::IXmlSchemaWrapperSchema &schema, const bool &isHeader) //## begin TransactionStructure::TransactionStructure%4205D148027B.hasinit preserve=no : m_structureName(name), m_isHeader(isHeader), m_structureHandle(0), m_structure(0), m_schemaFactory(&schemaFactory), m_schema(&schema) //## end TransactionStructure::TransactionStructure%4205D148027B.hasinit //## begin TransactionStructure::TransactionStructure%4205D148027B.initialization preserve=yes //## end TransactionStructure::TransactionStructure%4205D148027B.initialization { //## begin TransactionStructure::TransactionStructure%4205D148027B.body preserve=yes m_structureHandle = &m_schemaFactory->createHandle(); if ( m_schema->createStructure( name.c_str(), iteration, *m_structureHandle ) ) { if ( ( m_structure = m_schema->createSchemaElement( m_structureHandle->c_str(), "" ) ) == 0 ) { m_schema->destroyStructure( m_structureHandle->c_str() ); m_schemaFactory->destroyHandle( *m_structureHandle ); m_structureHandle = 0; MTHROW( std::runtime_error, \ "Cannot create structure \"" << name << "\"." ); } } else { m_schemaFactory->destroyHandle( *m_structureHandle ); m_structureHandle = 0; MTHROW( std::runtime_error, \ "Cannot create structure \"" << name << "\"." ); } //## end TransactionStructure::TransactionStructure%4205D148027B.body } TransactionStructure::~TransactionStructure() { //## begin TransactionStructure::~TransactionStructure%4205D0C403E2_dest.body preserve=yes if ( m_structure ) { m_schema->destroySchemaElement( *m_structure ); m_structure = 0; } if ( m_structureHandle ) { m_schema->destroyStructure( m_structureHandle->c_str() ); m_schemaFactory->destroyHandle( *m_structureHandle ); m_structureHandle = 0; } m_schemaFactory = 0; // We don't own this object. m_schema = 0; // We don't own this object. //## end TransactionStructure::~TransactionStructure%4205D0C403E2_dest.body } //## Other Operations (implementation) //## Operation: getName%4205D7B602F0 const std::string & TransactionStructure::getName () const { //## begin TransactionStructure::getName%4205D7B602F0.body preserve=yes return ( m_structureName ); //## end TransactionStructure::getName%4205D7B602F0.body } //## Operation: getSchemaElement%4206D93203BB XMLSchema::IXmlSchemaWrapperElement & TransactionStructure::getSchemaElement () { //## begin TransactionStructure::getSchemaElement%4206D93203BB.body preserve=yes return ( *m_structure ); //## end TransactionStructure::getSchemaElement%4206D93203BB.body } //## Operation: isHeader%4207123A020C const bool TransactionStructure::isHeader () const { //## begin TransactionStructure::isHeader%4207123A020C.body preserve=yes return ( m_isHeader ); //## end TransactionStructure::isHeader%4207123A020C.body } //## Operation: write%4207140A0268 const bool TransactionStructure::write (TransactionStream& stream) { //## begin TransactionStructure::write%4207140A0268.body preserve=yes XMLSchema::IXmlSchemaWrapperStream * wrapperStream = 0; try { wrapperStream = &m_schemaFactory->createXdrStream(); if ( m_schema->serialise( m_structureHandle->c_str(), *wrapperStream ) ) { void const * buffer = 0; unsigned int length = 0; if ( wrapperStream->getData( buffer, length ) ) { return ( stream.write( buffer, length ) ); } else { MERROR( "Cannot get buffer for \"" << m_structureName << "\"." ) } } else { MERROR( "Cannot serialise \"" << m_structureName << "\"." ) } } __finally { if ( wrapperStream ) { m_schemaFactory->destroyStream( *wrapperStream ); wrapperStream = 0; } } return ( false ); //## end TransactionStructure::write%4207140A0268.body } //## Operation: write%4236929B00A3 const bool TransactionStructure::write (XMLSchema::IXmlSchemaWrapperStream& stream, XMLSchema::IXmlSchemaWrapperQualification &qualifier) { //## begin TransactionStructure::write%4236929B00A3.body preserve=yes return ( m_schema->serialise( m_structureHandle->c_str(), stream, &qualifier ) ); //## end TransactionStructure::write%4236929B00A3.body } // Additional Declarations //## begin TransactionStructure%4205D0C403E2.declarations preserve=yes //## end TransactionStructure%4205D0C403E2.declarations //## begin module%4205D0C403E2.epilog preserve=yes //## end module%4205D0C403E2.epilog