Subversion Repositories DevTools

Rev

Rev 2222 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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%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 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%4209BA4C03B8.cp
19
 
20
//## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body
21
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
22
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\UdFileManifest.cpp
23
 
24
//## begin module%4209BA4C03B8.additionalIncludes preserve=no
25
//## end module%4209BA4C03B8.additionalIncludes
26
 
27
//## begin module%4209BA4C03B8.includes preserve=yes
28
#pragma warn -com
29
#include <LoggingMacros.h>
30
#pragma warn +com
31
//## end module%4209BA4C03B8.includes
32
 
33
// TransactionStream
34
#include "TransactionStream.h"
35
// UdFileManifest
36
#include "UdFileManifest.h"
37
//## begin module%4209BA4C03B8.additionalDeclarations preserve=yes
38
 
39
/**
40
	Example UD Manifest file.  Lines starting with a # are comments and are
41
	ignored.
42
 
43
	#UD Manifest
44
	#0000000101-SY1-903ECU-00000005
45
	/afc/ergdce/var/DCE/ud/drained/CvXK71l0_903ECU.devud
46
	/afc/ergdce/var/DCE/ud/drained/CvXLn1Y0_903ECU.devud
47
	/afc/ergdce/var/DCE/ud/drained/CvXP49b0_903ECU.devud
48
	/afc/ergdce/var/DCE/ud/drained/CvXtDCw0_903ECU.devud
49
	/afc/ergdce/var/DCE/ud/drained/CvXtE0U0_903ECU.devud
50
	/afc/ergdce/var/DCE/ud/drained/CvnNj8c0_903ECU.devud
51
	/afc/ergdce/var/DCE/ud/drained/CvnRVA10_903ECU.devud
52
	#total = 7
53
	#end
54
 */
55
//## end module%4209BA4C03B8.additionalDeclarations
56
 
57
 
58
// Class UdFileManifest 
59
 
60
//## Operation: UdFileManifest%4209BAA8031C
61
UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix)
62
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no
63
      : m_count(0),
64
        m_folder(folder),
65
        m_prefix(prefix),
66
        m_stream(0),
67
        m_suffix(suffix)
68
  //## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit
69
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes
70
  //## end UdFileManifest::UdFileManifest%4209BAA8031C.initialization
71
{
72
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.body preserve=yes
73
 
74
	open();  
75
 
76
  //## end UdFileManifest::UdFileManifest%4209BAA8031C.body
77
}
78
 
79
 
80
UdFileManifest::~UdFileManifest()
81
{
82
  //## begin UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body preserve=yes
83
 
84
	close();
85
 
86
  //## end UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body
87
}
88
 
89
 
90
 
91
//## Other Operations (implementation)
92
//## Operation: addUdFile%4209BAC703E7
93
void UdFileManifest::addUdFile (const std::string &file)
94
{
95
  //## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes
96
 
97
	if ( file.length() )
98
	{
99
		(*m_stream) << file << std::endl;
100
		++m_count;
101
	}
102
 
103
  //## end UdFileManifest::addUdFile%4209BAC703E7.body
104
}
105
 
106
//## Operation: close%4209BAC10389
107
void UdFileManifest::close ()
108
{
109
  //## begin UdFileManifest::close%4209BAC10389.body preserve=yes
110
 
111
	if ( m_stream )
112
	{
113
		(*m_stream)
114
			<< "#total = " << m_count << std::endl
115
			<< "#end" << std::endl;
116
 
117
		m_stream->close();
118
 
119
		delete m_stream;
120
		m_stream = 0;
121
	}
122
 
123
  //## end UdFileManifest::close%4209BAC10389.body
124
}
125
 
126
//## Operation: open%4209BAC10399
127
const bool UdFileManifest::open ()
128
{
129
  //## begin UdFileManifest::open%4209BAC10399.body preserve=yes
130
 
131
	close();	// Close the stream should it be open.
132
 
133
	std::string filename;
134
	TransactionStream::buildFileName(
135
		filename,
136
		m_folder,
137
		m_prefix,
138
		m_suffix,
139
		"",
140
 
141
 
142
	m_stream = new std::ofstream(
143
		filename.c_str(),
144
		std::ios_base::out );
145
	if ( m_stream->is_open() )
146
	{
147
		(*m_stream)
148
			<< "#UD Manifest" << std::endl
149
			<< '#' << std::endl;
150
 
151
		return ( true );
152
	}
153
 
154
	// When we can't open the file, then roll back.
155
	delete m_stream;
156
	m_stream = 0;
157
 
158
	MERROR( "Cannot open \"" << filename << "\" for writing." );
159
	return ( false );
160
 
161
  //## end UdFileManifest::open%4209BAC10399.body
162
}
163
 
164
// Additional Declarations
165
  //## begin UdFileManifest%4209BA4C03B8.declarations preserve=yes
166
  //## end UdFileManifest%4209BA4C03B8.declarations
167
 
168
//## begin module%4209BA4C03B8.epilog preserve=yes
169
//## end module%4209BA4C03B8.epilog