Blame | Last modification | View Log | RSS feed
//## 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%425A0C2601FD.cm preserve=no//## end module%425A0C2601FD.cm//## begin module%425A0C2601FD.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%425A0C2601FD.cp//## Module: UdDrainFile%425A0C2601FD; Pseudo Package body//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\UdDrainFile.cpp//## begin module%425A0C2601FD.additionalIncludes preserve=no//## end module%425A0C2601FD.additionalIncludes//## begin module%425A0C2601FD.includes preserve=yes#pragma warn -com#include <LoggingMacros.h>#pragma warn +com//## end module%425A0C2601FD.includes// IXmlSchemaWrapperElement#include "IXmlSchemaWrapperElement.h"// IXmlSchemaWrapperHandle#include "IXmlSchemaWrapperHandle.h"// IXmlSchemaWrapperFactory#include "IXmlSchemaWrapperFactory.h"// IXmlSchemaWrapperSchema#include "IXmlSchemaWrapperSchema.h"// UdDrainFile#include "UdDrainFile.h"//## begin module%425A0C2601FD.additionalDeclarations preserve=yes//## end module%425A0C2601FD.additionalDeclarations// Class UdDrainFile//## Operation: UdDrainFile%425A132E0282UdDrainFile::UdDrainFile (XMLSchema::IXmlSchemaWrapperFactory &schemaFactory, XMLSchema::IXmlSchemaWrapperSchema &schema)//## begin UdDrainFile::UdDrainFile%425A132E0282.hasinit preserve=no: m_headed(false),m_schemaFactory(&schemaFactory),m_schema(&schema),m_structureHandle(0),m_structure(0)//## end UdDrainFile::UdDrainFile%425A132E0282.hasinit//## begin UdDrainFile::UdDrainFile%425A132E0282.initialization preserve=yes//## end UdDrainFile::UdDrainFile%425A132E0282.initialization{//## begin UdDrainFile::UdDrainFile%425A132E0282.body preserve=yes//## end UdDrainFile::UdDrainFile%425A132E0282.body}UdDrainFile::~UdDrainFile(){//## begin UdDrainFile::~UdDrainFile%425A0C2601FD_dest.body preserve=yesif ( 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 UdDrainFile::~UdDrainFile%425A0C2601FD_dest.body}//## Other Operations (implementation)//## Operation: getTransactionCount%425A1A1901D3const unsigned int UdDrainFile::getTransactionCount () const{//## begin UdDrainFile::getTransactionCount%425A1A1901D3.body preserve=yesunsigned int count = 0;if ( m_structure ){XMLSchema::IXmlSchemaWrapperElement * attribute = 0;try{if ( m_headed ){attribute = m_structure->createSchemaElement( "NoOfItems" );}else{attribute = m_structure->createSchemaElement( "NoOfItems" );}if ( attribute ){if ( !attribute->getUnsignedInteger32( count ) ){MTHROW( std::runtime_error, \"Cannot read the number of transactions in drain file." );}}}__finally{m_structure->destroySchemaElement( *attribute );attribute = 0;}}return ( count );//## end UdDrainFile::getTransactionCount%425A1A1901D3.body}//## Operation: read%425A1133022Econst bool UdDrainFile::read (const bool &hasHeader, const int &iteration, const char *fileName){//## begin UdDrainFile::read%425A1133022E.body preserve=yesXMLSchema::IXmlSchemaWrapperStream * stream = 0;try{m_structureHandle = &m_schemaFactory->createHandle();m_headed = hasHeader;if ( m_schema->createStructure(( m_headed ? "Mass_BatchUsageData_t" : "Mass_UDRecords_t" ),iteration,*m_structureHandle ) ){if ( ( m_structure = m_schema->createSchemaElement(m_structureHandle->c_str(),"" ) ) != 0 ){stream = &m_schemaFactory->createXdrStream();if ( !m_schema->deserialise(m_structureHandle->c_str(),*stream ) ){MERROR( "Cannot serialise \"" << fileName << "\"." )return ( false );}return ( true );}}else{m_schemaFactory->destroyHandle( *m_structureHandle );m_structureHandle = 0;}}__finally{if ( stream ){m_schemaFactory->destroyStream( *stream );stream = 0;}}return ( false );//## end UdDrainFile::read%425A1133022E.body}// Additional Declarations//## begin UdDrainFile%425A0C2601FD.declarations preserve=yes//## end UdDrainFile%425A0C2601FD.declarations//## begin module%425A0C2601FD.epilog preserve=yes//## end module%425A0C2601FD.epilog