| 2263 |
kivins |
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%421040A40076.cm preserve=no
|
|
|
7 |
//## end module%421040A40076.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%421040A40076.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%421040A40076.cp
|
|
|
19 |
|
|
|
20 |
//## Module: SequenceCollection%421040A40076; Pseudo Package body
|
|
|
21 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
22 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\SequenceCollection.cpp
|
|
|
23 |
|
|
|
24 |
//## begin module%421040A40076.additionalIncludes preserve=no
|
|
|
25 |
//## end module%421040A40076.additionalIncludes
|
|
|
26 |
|
|
|
27 |
//## begin module%421040A40076.includes preserve=yes
|
|
|
28 |
#pragma warn -com
|
|
|
29 |
#include <LoggingMacros.h>
|
|
|
30 |
#pragma warn +com
|
|
|
31 |
//## end module%421040A40076.includes
|
|
|
32 |
|
|
|
33 |
// SequenceCollection
|
|
|
34 |
#include "SequenceCollection.h"
|
|
|
35 |
// Sequence
|
|
|
36 |
#include "Sequence.h"
|
|
|
37 |
//## begin module%421040A40076.additionalDeclarations preserve=yes
|
|
|
38 |
//## end module%421040A40076.additionalDeclarations
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
// Class SequenceCollection
|
|
|
42 |
|
|
|
43 |
SequenceCollection::SequenceCollection()
|
|
|
44 |
//## begin SequenceCollection::SequenceCollection%421040A40076_const.initialization preserve=yes
|
|
|
45 |
//## end SequenceCollection::SequenceCollection%421040A40076_const.initialization
|
|
|
46 |
{
|
|
|
47 |
//## begin SequenceCollection::SequenceCollection%421040A40076_const.body preserve=yes
|
|
|
48 |
//## end SequenceCollection::SequenceCollection%421040A40076_const.body
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
SequenceCollection::~SequenceCollection()
|
|
|
53 |
{
|
|
|
54 |
//## begin SequenceCollection::~SequenceCollection%421040A40076_dest.body preserve=yes
|
|
|
55 |
|
|
|
56 |
clear();
|
|
|
57 |
|
|
|
58 |
//## end SequenceCollection::~SequenceCollection%421040A40076_dest.body
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
//## Other Operations (implementation)
|
|
|
64 |
//## Operation: clear%4211667202C7
|
|
|
65 |
void SequenceCollection::clear ()
|
|
|
66 |
{
|
|
|
67 |
//## begin SequenceCollection::clear%4211667202C7.body preserve=yes
|
|
|
68 |
|
|
|
69 |
for ( std::map< std::string, Sequence * >::iterator
|
|
|
70 |
where = m_sequence.begin();
|
|
|
71 |
where != m_sequence.end();
|
|
|
72 |
++where )
|
|
|
73 |
{
|
|
|
74 |
delete where->second;
|
|
|
75 |
where->second = 0;
|
|
|
76 |
}
|
|
|
77 |
m_sequence.clear();
|
|
|
78 |
|
|
|
79 |
//## end SequenceCollection::clear%4211667202C7.body
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
//## Operation: getCollection%4211952E0066
|
|
|
83 |
const std::map< std::string, Sequence * > & SequenceCollection::getCollection () const
|
|
|
84 |
{
|
|
|
85 |
//## begin SequenceCollection::getCollection%4211952E0066.body preserve=yes
|
|
|
86 |
|
|
|
87 |
return ( m_sequence );
|
|
|
88 |
|
|
|
89 |
//## end SequenceCollection::getCollection%4211952E0066.body
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
//## Operation: getSequence%4211667202D7
|
|
|
93 |
Sequence& SequenceCollection::getSequence (const std::string &sequenceName, const bool &persisted, const int &first)
|
|
|
94 |
{
|
|
|
95 |
//## begin SequenceCollection::getSequence%4211667202D7.body preserve=yes
|
|
|
96 |
|
|
|
97 |
std::map< std::string, Sequence * >::const_iterator
|
|
|
98 |
instance = m_sequence.find( sequenceName );
|
|
|
99 |
|
|
|
100 |
if ( instance != m_sequence.end() )
|
|
|
101 |
{
|
|
|
102 |
return ( *instance->second );
|
|
|
103 |
}
|
|
|
104 |
else
|
|
|
105 |
{
|
|
|
106 |
Sequence * object = 0;
|
|
|
107 |
|
|
|
108 |
try
|
|
|
109 |
{
|
|
|
110 |
object = new Sequence( sequenceName, first );
|
|
|
111 |
|
|
|
112 |
if ( m_sequence.insert(
|
|
|
113 |
std::map< std::string, Sequence * >::value_type(
|
|
|
114 |
sequenceName,
|
|
|
115 |
object ) ).second )
|
|
|
116 |
{
|
|
|
117 |
object->setPersist( persisted );
|
|
|
118 |
return ( *object );
|
|
|
119 |
}
|
|
|
120 |
else
|
|
|
121 |
{
|
|
|
122 |
MTHROW( std::runtime_error, \
|
|
|
123 |
"Cannot add sequence \"" \
|
|
|
124 |
<< sequenceName \
|
|
|
125 |
<< "\" to sequence collection." );
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
catch ( ... )
|
|
|
129 |
{
|
|
|
130 |
delete object;
|
|
|
131 |
object = 0;
|
|
|
132 |
|
|
|
133 |
throw;
|
|
|
134 |
}
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
//## end SequenceCollection::getSequence%4211667202D7.body
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
// Additional Declarations
|
|
|
141 |
//## begin SequenceCollection%421040A40076.declarations preserve=yes
|
|
|
142 |
//## end SequenceCollection%421040A40076.declarations
|
|
|
143 |
|
|
|
144 |
//## begin module%421040A40076.epilog preserve=yes
|
|
|
145 |
//## end module%421040A40076.epilog
|