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