| 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%4209BA4C03B8.cm preserve=no
|
|
|
7 |
//## end module%4209BA4C03B8.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%4209BA4C03B8.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
|
|
|
12 |
// disclosed in whole
|
|
|
13 |
// or in part to any third party nor used in any manner
|
|
|
14 |
// whatsoever other
|
|
|
15 |
// than for the purposes expressly consented to by ERG in
|
|
|
16 |
// writing.
|
|
|
17 |
//
|
|
|
18 |
// This material is also copyright and may not be
|
|
|
19 |
// reproduced, stored in a
|
|
|
20 |
// retrieval system or transmitted in any form or by any
|
|
|
21 |
// means in whole or
|
|
|
22 |
// in part without the express written consent of ERG.
|
|
|
23 |
//## end module%4209BA4C03B8.cp
|
|
|
24 |
|
|
|
25 |
//## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body
|
|
|
26 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
27 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\UdFileManifest.cpp
|
|
|
28 |
|
|
|
29 |
//## begin module%4209BA4C03B8.additionalIncludes preserve=no
|
|
|
30 |
//## end module%4209BA4C03B8.additionalIncludes
|
|
|
31 |
|
|
|
32 |
//## begin module%4209BA4C03B8.includes preserve=yes
|
|
|
33 |
#pragma warn -com
|
|
|
34 |
#include <LoggingMacros.h>
|
|
|
35 |
#pragma warn +com
|
|
|
36 |
//## end module%4209BA4C03B8.includes
|
|
|
37 |
|
|
|
38 |
// UdFileManifest
|
|
|
39 |
#include "UdFileManifest.h"
|
|
|
40 |
// TransactionStream
|
|
|
41 |
#include "TransactionStream.h"
|
|
|
42 |
//## begin module%4209BA4C03B8.additionalDeclarations preserve=yes
|
|
|
43 |
|
|
|
44 |
#include <ctype>
|
|
|
45 |
/**
|
|
|
46 |
Example UD Manifest file. Lines starting with a # are comments and are
|
|
|
47 |
ignored.
|
|
|
48 |
|
|
|
49 |
#UD Manifest
|
|
|
50 |
#0000000101-SY1-903ECU-00000005
|
|
|
51 |
/afc/ergdce/var/DCE/ud/drained/CvXK71l0_903ECU.devud
|
|
|
52 |
/afc/ergdce/var/DCE/ud/drained/CvXLn1Y0_903ECU.devud
|
|
|
53 |
/afc/ergdce/var/DCE/ud/drained/CvXP49b0_903ECU.devud
|
|
|
54 |
/afc/ergdce/var/DCE/ud/drained/CvXtDCw0_903ECU.devud
|
|
|
55 |
/afc/ergdce/var/DCE/ud/drained/CvXtE0U0_903ECU.devud
|
|
|
56 |
/afc/ergdce/var/DCE/ud/drained/CvnNj8c0_903ECU.devud
|
|
|
57 |
/afc/ergdce/var/DCE/ud/drained/CvnRVA10_903ECU.devud
|
|
|
58 |
#total = 7
|
|
|
59 |
#end
|
|
|
60 |
*/
|
|
|
61 |
//## end module%4209BA4C03B8.additionalDeclarations
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
// Class UdFileManifest
|
|
|
65 |
|
|
|
66 |
//## Operation: UdFileManifest%4209BAA8031C
|
|
|
67 |
UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix, const std::string &pathmapTarget)
|
|
|
68 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no
|
|
|
69 |
: m_count(0),
|
|
|
70 |
m_folder("..\\summaries"),
|
|
|
71 |
m_pathmapTarget(pathmapTarget),
|
|
|
72 |
m_prefix(prefix),
|
|
|
73 |
m_stream(0),
|
|
|
74 |
m_suffix(suffix)
|
|
|
75 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit
|
|
|
76 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes
|
|
|
77 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.initialization
|
|
|
78 |
{
|
|
|
79 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.body preserve=yes
|
|
|
80 |
|
|
|
81 |
open();
|
|
|
82 |
|
|
|
83 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.body
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
UdFileManifest::~UdFileManifest()
|
|
|
88 |
{
|
|
|
89 |
//## begin UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body preserve=yes
|
|
|
90 |
|
|
|
91 |
close();
|
|
|
92 |
|
|
|
93 |
//## end UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
void UdFileManifest::addTestDetails (const std::string &testDetails)
|
|
|
97 |
{
|
|
|
98 |
(*m_stream) << testDetails;
|
|
|
99 |
(*m_stream) << std::endl;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
//## Other Operations (implementation)
|
|
|
104 |
//## Operation: addUdFile%4209BAC703E7
|
|
|
105 |
void UdFileManifest::addUdFile (const std::string &file)
|
|
|
106 |
{
|
|
|
107 |
//## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes
|
|
|
108 |
|
|
|
109 |
if ( file.length() )
|
|
|
110 |
{
|
|
|
111 |
// output some spacing
|
|
|
112 |
(*m_stream) << " ";
|
|
|
113 |
|
|
|
114 |
// format and output the path and filename
|
|
|
115 |
const bool slash
|
|
|
116 |
= m_pathmapTarget.find_last_of( "/\\" )
|
|
|
117 |
== m_pathmapTarget.length() - 1;
|
|
|
118 |
const std::string::size_type where = file.find_last_of( "/\\" );
|
|
|
119 |
|
|
|
120 |
(*m_stream) << m_pathmapTarget;
|
|
|
121 |
if ( where != std::string::npos )
|
|
|
122 |
{
|
|
|
123 |
if ( !slash )
|
|
|
124 |
{
|
|
|
125 |
(*m_stream) << '/';
|
|
|
126 |
}
|
|
|
127 |
(*m_stream) << file.substr( where + 1 );
|
|
|
128 |
}
|
|
|
129 |
else
|
|
|
130 |
{
|
|
|
131 |
if ( !slash )
|
|
|
132 |
{
|
|
|
133 |
(*m_stream) << '/';
|
|
|
134 |
}
|
|
|
135 |
(*m_stream) << file;
|
|
|
136 |
}
|
|
|
137 |
(*m_stream) << std::endl;
|
|
|
138 |
++m_count;
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
//## end UdFileManifest::addUdFile%4209BAC703E7.body
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
//## Operation: close%4209BAC10389
|
|
|
145 |
void UdFileManifest::close ()
|
|
|
146 |
{
|
|
|
147 |
//## begin UdFileManifest::close%4209BAC10389.body preserve=yes
|
|
|
148 |
|
|
|
149 |
if ( m_stream )
|
|
|
150 |
{
|
|
|
151 |
(*m_stream)
|
|
|
152 |
<< "#total UD files generated = " << m_count << std::endl
|
|
|
153 |
<< "#end" << std::endl;
|
|
|
154 |
|
|
|
155 |
m_stream->close();
|
|
|
156 |
|
|
|
157 |
delete m_stream;
|
|
|
158 |
m_stream = 0;
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
//## end UdFileManifest::close%4209BAC10389.body
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
//## Operation: open%4209BAC10399
|
|
|
165 |
const bool UdFileManifest::open ()
|
|
|
166 |
{
|
|
|
167 |
//## begin UdFileManifest::open%4209BAC10399.body preserve=yes
|
|
|
168 |
|
|
|
169 |
close(); // Close the stream should it be open.
|
|
|
170 |
|
|
|
171 |
std::string filename;
|
|
|
172 |
TransactionStream::buildFileName(
|
|
|
173 |
filename,
|
|
|
174 |
m_folder,
|
|
|
175 |
m_prefix,
|
|
|
176 |
m_suffix,
|
|
|
177 |
"",
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
m_stream = new std::ofstream(
|
|
|
181 |
filename.c_str(),
|
|
|
182 |
std::ios_base::out );
|
|
|
183 |
if ( m_stream->is_open() )
|
|
|
184 |
{
|
|
|
185 |
(*m_stream)
|
|
|
186 |
<< "#Transaction Scenario Builder log file" << std::endl
|
|
|
187 |
<< '#' << std::endl;
|
|
|
188 |
|
|
|
189 |
return ( true );
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
// When we can't open the file, then roll back.
|
|
|
193 |
delete m_stream;
|
|
|
194 |
m_stream = 0;
|
|
|
195 |
|
|
|
196 |
MERROR( "Cannot open \"" << filename << "\" for writing." );
|
|
|
197 |
return ( false );
|
|
|
198 |
|
|
|
199 |
//## end UdFileManifest::open%4209BAC10399.body
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
// Additional Declarations
|
|
|
203 |
//## begin UdFileManifest%4209BA4C03B8.declarations preserve=yes
|
|
|
204 |
//## end UdFileManifest%4209BA4C03B8.declarations
|
|
|
205 |
|
|
|
206 |
//## begin module%4209BA4C03B8.epilog preserve=yes
|
|
|
207 |
//## end module%4209BA4C03B8.epilog
|