| 2218 |
sbetterm |
1 |
//## begin module%1.7%.codegen_version preserve=yes
|
|
|
2 |
// Read the documentation to learn more about C++ code generator
|
|
|
3 |
// versioning.
|
|
|
4 |
//## end module%1.7%.codegen_version
|
|
|
5 |
|
|
|
6 |
//## begin module%420310A60071.cm preserve=no
|
|
|
7 |
//## end module%420310A60071.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%420310A60071.cp preserve=no
|
|
|
10 |
// C O P Y R I G H T N O T I C E
|
|
|
11 |
// This material is confidential to ERG and may not be disclosed in whole
|
|
|
12 |
// or in part to any third party nor used in any manner whatsoever other
|
|
|
13 |
// than for the purposes expressly consented to by ERG in writing.
|
|
|
14 |
//
|
|
|
15 |
// This material is also copyright and may not be reproduced, stored in a
|
|
|
16 |
// retrieval system or transmitted in any form or by any means in whole or
|
|
|
17 |
// in part without the express written consent of ERG.
|
|
|
18 |
//## end module%420310A60071.cp
|
|
|
19 |
|
|
|
20 |
//## Module: Iteration%420310A60071; Pseudo Package body
|
|
|
21 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
22 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\Iteration.cpp
|
|
|
23 |
|
|
|
24 |
//## begin module%420310A60071.additionalIncludes preserve=no
|
|
|
25 |
//## end module%420310A60071.additionalIncludes
|
|
|
26 |
|
|
|
27 |
//## begin module%420310A60071.includes preserve=yes
|
|
|
28 |
#pragma warn -com
|
|
|
29 |
#include <LoggingMacros.h>
|
|
|
30 |
#pragma warn +com
|
|
|
31 |
//## end module%420310A60071.includes
|
|
|
32 |
|
|
|
33 |
// EvaluationContext
|
|
|
34 |
#include "EvaluationContext.h"
|
|
|
35 |
// TransactionStream
|
|
|
36 |
#include "TransactionStream.h"
|
|
|
37 |
// Iteration
|
|
|
38 |
#include "Iteration.h"
|
|
|
39 |
// TestScenario
|
|
|
40 |
#include "TestScenario.h"
|
| 2228 |
sbetterm |
41 |
// IXmlSchemaWrapperSchema
|
|
|
42 |
#include "IXmlSchemaWrapperSchema.h"
|
|
|
43 |
// IXmlSchemaWrapperString
|
|
|
44 |
#include "IXmlSchemaWrapperString.h"
|
|
|
45 |
// IXmlSchemaWrapperFactory
|
|
|
46 |
#include "IXmlSchemaWrapperFactory.h"
|
| 2218 |
sbetterm |
47 |
//## begin module%420310A60071.additionalDeclarations preserve=yes
|
|
|
48 |
//## end module%420310A60071.additionalDeclarations
|
|
|
49 |
|
|
|
50 |
|
| 2228 |
sbetterm |
51 |
// Class Iteration
|
| 2218 |
sbetterm |
52 |
|
|
|
53 |
//## Operation: Iteration%420311980081
|
|
|
54 |
Iteration::Iteration (const std::string &projectCode, const int &iteration, XMLSchema::IXmlSchemaWrapperFactory &factory, XMLSchema::IXmlSchemaWrapperSchema &schema, const std::string &schemaHandle)
|
|
|
55 |
//## begin Iteration::Iteration%420311980081.hasinit preserve=no
|
|
|
56 |
: m_schemaHandle(schemaHandle),
|
|
|
57 |
m_schema(0),
|
|
|
58 |
m_factory(0)
|
|
|
59 |
//## end Iteration::Iteration%420311980081.hasinit
|
|
|
60 |
//## begin Iteration::Iteration%420311980081.initialization preserve=yes
|
|
|
61 |
|
|
|
62 |
, m_projectCode( projectCode ),
|
|
|
63 |
m_iteration( iteration )
|
|
|
64 |
|
|
|
65 |
//## end Iteration::Iteration%420311980081.initialization
|
|
|
66 |
{
|
|
|
67 |
//## begin Iteration::Iteration%420311980081.body preserve=yes
|
|
|
68 |
|
|
|
69 |
m_factory = &factory;
|
|
|
70 |
m_schema = &schema;
|
|
|
71 |
|
|
|
72 |
//## end Iteration::Iteration%420311980081.body
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
Iteration::~Iteration()
|
|
|
77 |
{
|
|
|
78 |
//## begin Iteration::~Iteration%420310A60071_dest.body preserve=yes
|
|
|
79 |
|
|
|
80 |
for ( std::map< int, TestScenario * >::iterator
|
|
|
81 |
where = m_scenario.begin();
|
|
|
82 |
where != m_scenario.end();
|
|
|
83 |
++where )
|
|
|
84 |
{
|
|
|
85 |
delete where->second;
|
|
|
86 |
where->second = 0;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
m_schema = 0; // We don't own this object.
|
|
|
90 |
m_factory = 0; // We don't own this object.
|
|
|
91 |
|
|
|
92 |
//## end Iteration::~Iteration%420310A60071_dest.body
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
//## Other Operations (implementation)
|
| 2228 |
sbetterm |
98 |
//## Operation: findTestScenario%428D756A034D
|
|
|
99 |
TestScenario& Iteration::findTestScenario (const int &scenario)
|
|
|
100 |
{
|
|
|
101 |
//## begin Iteration::findTestScenario%428D756A034D.body preserve=yes
|
|
|
102 |
|
|
|
103 |
std::map< int, TestScenario * >::const_iterator
|
|
|
104 |
instance = m_scenario.find( scenario );
|
|
|
105 |
|
|
|
106 |
if ( instance != m_scenario.end() )
|
|
|
107 |
{
|
|
|
108 |
return ( *instance->second );
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
MTHROW( std::runtime_error, \
|
|
|
112 |
"Cannot find scenario " << scenario << '.' );
|
|
|
113 |
|
|
|
114 |
//## end Iteration::findTestScenario%428D756A034D.body
|
|
|
115 |
}
|
|
|
116 |
|
| 2218 |
sbetterm |
117 |
//## Operation: generate%42045A4D0198
|
|
|
118 |
const bool Iteration::generate (TransactionStream& stream, const bool &generateHeaders, EvaluationContext& evaluationContext)
|
|
|
119 |
{
|
|
|
120 |
//## begin Iteration::generate%42045A4D0198.body preserve=yes
|
|
|
121 |
|
|
|
122 |
bool generated = true;
|
|
|
123 |
for ( std::vector< TestScenario * >::iterator
|
|
|
124 |
where = m_orderedScenarioCollection.begin();
|
|
|
125 |
where != m_orderedScenarioCollection.end();
|
|
|
126 |
++where )
|
|
|
127 |
{
|
|
|
128 |
if ( !(*where)->generate(
|
|
|
129 |
stream,
|
|
|
130 |
generateHeaders,
|
|
|
131 |
evaluationContext ) )
|
|
|
132 |
{
|
|
|
133 |
generated = false;
|
|
|
134 |
break;
|
|
|
135 |
}
|
|
|
136 |
}
|
|
|
137 |
return ( generated );
|
|
|
138 |
|
|
|
139 |
//## end Iteration::generate%42045A4D0198.body
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
//## Operation: getFormatVersion%4208BDE6025B
|
|
|
143 |
const int Iteration::getFormatVersion () const
|
|
|
144 |
{
|
|
|
145 |
//## begin Iteration::getFormatVersion%4208BDE6025B.body preserve=yes
|
|
|
146 |
|
|
|
147 |
XMLSchema::IXmlSchemaWrapperString * attributeValue = 0;
|
|
|
148 |
|
|
|
149 |
try
|
|
|
150 |
{
|
|
|
151 |
attributeValue = &m_factory->createString();
|
|
|
152 |
if ( m_schema->getAttributeProperty(
|
|
|
153 |
m_schemaHandle.c_str(),
|
|
|
154 |
"",
|
|
|
155 |
"majorversion",
|
|
|
156 |
*attributeValue ) )
|
|
|
157 |
{
|
|
|
158 |
const int majorVersion = atoi( attributeValue->c_str() );
|
|
|
159 |
|
|
|
160 |
if ( m_schema->getAttributeProperty(
|
|
|
161 |
m_schemaHandle.c_str(),
|
|
|
162 |
"",
|
|
|
163 |
"minorversion",
|
|
|
164 |
*attributeValue ) )
|
|
|
165 |
{
|
|
|
166 |
const int minorVersion = atoi( attributeValue->c_str() );
|
|
|
167 |
return ( ( majorVersion << 16 ) + ( minorVersion << 8 ) );
|
|
|
168 |
}
|
|
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
__finally
|
|
|
172 |
{
|
|
|
173 |
m_factory->destroyString( *attributeValue );
|
|
|
174 |
attributeValue = 0;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
MTHROW( std::runtime_error, \
|
|
|
178 |
"Cannot read format version from schema." );
|
|
|
179 |
|
|
|
180 |
//## end Iteration::getFormatVersion%4208BDE6025B.body
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
//## Operation: getIterationId%4203119303AD
|
|
|
184 |
const int & Iteration::getIterationId () const
|
|
|
185 |
{
|
|
|
186 |
//## begin Iteration::getIterationId%4203119303AD.body preserve=yes
|
|
|
187 |
|
|
|
188 |
return ( m_iteration );
|
|
|
189 |
|
|
|
190 |
//## end Iteration::getIterationId%4203119303AD.body
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
//## Operation: getProjectCode%4203118E02F2
|
|
|
194 |
const std::string & Iteration::getProjectCode () const
|
|
|
195 |
{
|
|
|
196 |
//## begin Iteration::getProjectCode%4203118E02F2.body preserve=yes
|
|
|
197 |
|
|
|
198 |
return ( m_projectCode );
|
|
|
199 |
|
|
|
200 |
//## end Iteration::getProjectCode%4203118E02F2.body
|
|
|
201 |
}
|
|
|
202 |
|
|
|
203 |
//## Operation: getSchema%420460A8000E
|
|
|
204 |
XMLSchema::IXmlSchemaWrapperSchema & Iteration::getSchema () const
|
|
|
205 |
{
|
|
|
206 |
//## begin Iteration::getSchema%420460A8000E.body preserve=yes
|
|
|
207 |
|
|
|
208 |
return ( *m_schema );
|
|
|
209 |
|
|
|
210 |
//## end Iteration::getSchema%420460A8000E.body
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
//## Operation: getSchemaWrapperFactory%42045F8B030B
|
|
|
214 |
XMLSchema::IXmlSchemaWrapperFactory & Iteration::getSchemaWrapperFactory () const
|
|
|
215 |
{
|
|
|
216 |
//## begin Iteration::getSchemaWrapperFactory%42045F8B030B.body preserve=yes
|
|
|
217 |
|
|
|
218 |
return ( *m_factory );
|
|
|
219 |
|
|
|
220 |
//## end Iteration::getSchemaWrapperFactory%42045F8B030B.body
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
//## Operation: getTestScenario%420312AF031E
|
|
|
224 |
TestScenario& Iteration::getTestScenario (const int &scenario)
|
|
|
225 |
{
|
|
|
226 |
//## begin Iteration::getTestScenario%420312AF031E.body preserve=yes
|
|
|
227 |
|
|
|
228 |
std::map< int, TestScenario * >::const_iterator
|
|
|
229 |
instance = m_scenario.find( scenario );
|
|
|
230 |
|
|
|
231 |
if ( instance != m_scenario.end() )
|
|
|
232 |
{
|
|
|
233 |
return ( *instance->second );
|
|
|
234 |
}
|
|
|
235 |
else
|
|
|
236 |
{
|
|
|
237 |
TestScenario * object = 0;
|
|
|
238 |
|
|
|
239 |
try
|
|
|
240 |
{
|
|
|
241 |
object = new TestScenario( scenario, *this );
|
|
|
242 |
|
|
|
243 |
m_orderedScenarioCollection.push_back( object );
|
|
|
244 |
if ( m_scenario.insert(
|
|
|
245 |
std::map< int, TestScenario * >::value_type(
|
|
|
246 |
scenario,
|
|
|
247 |
object ) ).second )
|
|
|
248 |
{
|
|
|
249 |
return ( *object );
|
|
|
250 |
}
|
|
|
251 |
else
|
|
|
252 |
{
|
|
|
253 |
MTHROW( std::runtime_error, \
|
|
|
254 |
"Cannot add scenario \"" \
|
|
|
255 |
<< scenario \
|
|
|
256 |
<< "\" to iteration " \
|
|
|
257 |
<< m_iteration \
|
|
|
258 |
<< '.' );
|
|
|
259 |
}
|
|
|
260 |
}
|
|
|
261 |
catch ( ... )
|
|
|
262 |
{
|
|
|
263 |
delete object;
|
|
|
264 |
object = 0;
|
|
|
265 |
|
|
|
266 |
throw;
|
|
|
267 |
}
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
//## end Iteration::getTestScenario%420312AF031E.body
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
//## Operation: getTransactionCount%420890E2017C
|
|
|
274 |
const unsigned Iteration::getTransactionCount () const
|
|
|
275 |
{
|
|
|
276 |
//## begin Iteration::getTransactionCount%420890E2017C.body preserve=yes
|
|
|
277 |
|
|
|
278 |
unsigned int count = 0;
|
|
|
279 |
|
|
|
280 |
for ( std::map< int, TestScenario * >::const_iterator
|
|
|
281 |
where = m_scenario.begin();
|
|
|
282 |
where != m_scenario.end();
|
|
|
283 |
++where )
|
|
|
284 |
{
|
|
|
285 |
count += where->second->getTransactionCount();
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
return ( count );
|
|
|
289 |
|
|
|
290 |
//## end Iteration::getTransactionCount%420890E2017C.body
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
// Additional Declarations
|
|
|
294 |
//## begin Iteration%420310A60071.declarations preserve=yes
|
|
|
295 |
//## end Iteration%420310A60071.declarations
|
|
|
296 |
|
|
|
297 |
//## begin module%420310A60071.epilog preserve=yes
|
|
|
298 |
//## end module%420310A60071.epilog
|