Rev 2218 | Go to most recent revision | Blame | Compare with Previous | 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%420310A60071.cm preserve=no//## end module%420310A60071.cm//## begin module%420310A60071.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%420310A60071.cp//## Module: Iteration%420310A60071; Pseudo Package body//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\Iteration.cpp//## begin module%420310A60071.additionalIncludes preserve=no//## end module%420310A60071.additionalIncludes//## begin module%420310A60071.includes preserve=yes#pragma warn -com#include <LoggingMacros.h>#pragma warn +com//## end module%420310A60071.includes// EvaluationContext#include "EvaluationContext.h"// TransactionStream#include "TransactionStream.h"// Iteration#include "Iteration.h"// TestScenario#include "TestScenario.h"// IXmlSchemaWrapperSchema#include "IXmlSchemaWrapperSchema.h"// IXmlSchemaWrapperString#include "IXmlSchemaWrapperString.h"// IXmlSchemaWrapperFactory#include "IXmlSchemaWrapperFactory.h"//## begin module%420310A60071.additionalDeclarations preserve=yes//## end module%420310A60071.additionalDeclarations// Class Iteration//## Operation: Iteration%420311980081Iteration::Iteration (const std::string &projectCode, const int &iteration, XMLSchema::IXmlSchemaWrapperFactory &factory, XMLSchema::IXmlSchemaWrapperSchema &schema, const std::string &schemaHandle)//## begin Iteration::Iteration%420311980081.hasinit preserve=no: m_schemaHandle(schemaHandle),m_schema(0),m_factory(0)//## end Iteration::Iteration%420311980081.hasinit//## begin Iteration::Iteration%420311980081.initialization preserve=yes, m_projectCode( projectCode ),m_iteration( iteration )//## end Iteration::Iteration%420311980081.initialization{//## begin Iteration::Iteration%420311980081.body preserve=yesm_factory = &factory;m_schema = &schema;//## end Iteration::Iteration%420311980081.body}Iteration::~Iteration(){//## begin Iteration::~Iteration%420310A60071_dest.body preserve=yesfor ( std::map< int, TestScenario * >::iteratorwhere = m_scenario.begin();where != m_scenario.end();++where ){delete where->second;where->second = 0;}m_schema = 0; // We don't own this object.m_factory = 0; // We don't own this object.//## end Iteration::~Iteration%420310A60071_dest.body}//## Other Operations (implementation)//## Operation: findTestScenario%428D756A034DTestScenario& Iteration::findTestScenario (const int &scenario){//## begin Iteration::findTestScenario%428D756A034D.body preserve=yesstd::map< int, TestScenario * >::const_iteratorinstance = m_scenario.find( scenario );if ( instance != m_scenario.end() ){return ( *instance->second );}MTHROW( std::runtime_error, \"Cannot find scenario " << scenario << '.' );//## end Iteration::findTestScenario%428D756A034D.body}//## Operation: generate%42045A4D0198const bool Iteration::generate (TransactionStream& stream, const bool &generateHeaders, EvaluationContext& evaluationContext){//## begin Iteration::generate%42045A4D0198.body preserve=yesbool generated = true;for ( std::vector< TestScenario * >::iteratorwhere = m_orderedScenarioCollection.begin();where != m_orderedScenarioCollection.end();++where ){if ( !(*where)->generate(stream,generateHeaders,evaluationContext ) ){generated = false;break;}}return ( generated );//## end Iteration::generate%42045A4D0198.body}//## Operation: getFormatVersion%4208BDE6025Bconst int Iteration::getFormatVersion () const{//## begin Iteration::getFormatVersion%4208BDE6025B.body preserve=yesXMLSchema::IXmlSchemaWrapperString * attributeValue = 0;try{attributeValue = &m_factory->createString();if ( m_schema->getAttributeProperty(m_schemaHandle.c_str(),"","majorversion",*attributeValue ) ){const int majorVersion = atoi( attributeValue->c_str() );if ( m_schema->getAttributeProperty(m_schemaHandle.c_str(),"","minorversion",*attributeValue ) ){const int minorVersion = atoi( attributeValue->c_str() );return ( ( majorVersion << 16 ) + ( minorVersion << 8 ) );}}}__finally{m_factory->destroyString( *attributeValue );attributeValue = 0;}MTHROW( std::runtime_error, \"Cannot read format version from schema." );//## end Iteration::getFormatVersion%4208BDE6025B.body}//## Operation: getIterationId%4203119303ADconst int & Iteration::getIterationId () const{//## begin Iteration::getIterationId%4203119303AD.body preserve=yesreturn ( m_iteration );//## end Iteration::getIterationId%4203119303AD.body}//## Operation: getProjectCode%4203118E02F2const std::string & Iteration::getProjectCode () const{//## begin Iteration::getProjectCode%4203118E02F2.body preserve=yesreturn ( m_projectCode );//## end Iteration::getProjectCode%4203118E02F2.body}//## Operation: getSchema%420460A8000EXMLSchema::IXmlSchemaWrapperSchema & Iteration::getSchema () const{//## begin Iteration::getSchema%420460A8000E.body preserve=yesreturn ( *m_schema );//## end Iteration::getSchema%420460A8000E.body}//## Operation: getSchemaWrapperFactory%42045F8B030BXMLSchema::IXmlSchemaWrapperFactory & Iteration::getSchemaWrapperFactory () const{//## begin Iteration::getSchemaWrapperFactory%42045F8B030B.body preserve=yesreturn ( *m_factory );//## end Iteration::getSchemaWrapperFactory%42045F8B030B.body}//## Operation: getTestScenario%420312AF031ETestScenario& Iteration::getTestScenario (const int &scenario){//## begin Iteration::getTestScenario%420312AF031E.body preserve=yesstd::map< int, TestScenario * >::const_iteratorinstance = m_scenario.find( scenario );if ( instance != m_scenario.end() ){return ( *instance->second );}else{TestScenario * object = 0;try{object = new TestScenario( scenario, *this );m_orderedScenarioCollection.push_back( object );if ( m_scenario.insert(std::map< int, TestScenario * >::value_type(scenario,object ) ).second ){return ( *object );}else{MTHROW( std::runtime_error, \"Cannot add scenario \"" \<< scenario \<< "\" to iteration " \<< m_iteration \<< '.' );}}catch ( ... ){delete object;object = 0;throw;}}//## end Iteration::getTestScenario%420312AF031E.body}//## Operation: getTransactionCount%420890E2017Cconst unsigned Iteration::getTransactionCount () const{//## begin Iteration::getTransactionCount%420890E2017C.body preserve=yesunsigned int count = 0;for ( std::map< int, TestScenario * >::const_iteratorwhere = m_scenario.begin();where != m_scenario.end();++where ){count += where->second->getTransactionCount();}return ( count );//## end Iteration::getTransactionCount%420890E2017C.body}// Additional Declarations//## begin Iteration%420310A60071.declarations preserve=yes//## end Iteration%420310A60071.declarations//## begin module%420310A60071.epilog preserve=yes//## end module%420310A60071.epilog