Subversion Repositories DevTools

Rev

Rev 2218 | Details | Compare with Previous | 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%420720460243.cm preserve=no
7
//## end module%420720460243.cm
8
 
9
//## begin module%420720460243.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%420720460243.cp
19
 
20
//## Module: TransactionStream%420720460243; Pseudo Package specification
21
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
22
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\TransactionStream.h
23
 
24
#ifndef TransactionStream_h
25
#define TransactionStream_h 1
26
 
27
//## begin module%420720460243.additionalIncludes preserve=no
28
//## end module%420720460243.additionalIncludes
29
 
30
//## begin module%420720460243.includes preserve=yes
31
#include <fstream>
32
#include <string>
33
//## end module%420720460243.includes
34
 
35
 
36
class UdFileManifest;
37
 
38
//## begin module%420720460243.additionalDeclarations preserve=yes
39
//## end module%420720460243.additionalDeclarations
40
 
41
 
42
//## begin TransactionStream%420720460243.preface preserve=yes
43
//## end TransactionStream%420720460243.preface
44
 
45
//## Class: TransactionStream%420720460243; private
46
//	A stream of transactions.
47
//## Category: TransactionTestManager::Transaction Generation%4202F8EE0128
48
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
49
//## Persistence: Transient
50
//## Cardinality/Multiplicity: n
51
 
52
 
53
 
54
class TransactionStream 
55
{
56
  //## begin TransactionStream%420720460243.initialDeclarations preserve=yes
57
  //## end TransactionStream%420720460243.initialDeclarations
58
 
59
  public:
60
    //## Constructors (specified)
61
      //## Operation: TransactionStream%4207228700FB
62
      //	The only constructor.
63
      TransactionStream (const std::string &folder, 	// The folder in the file-system into which to write the transaction stream.
64
      const std::string &batchPrefix, 	// The prefix given to batch filenames opened by this instance.
65
      const std::string &batchSuffix, 	// The suffix given to batch filenames opened by this instance.
66
      const bool &buildManifest = true, 	// When true, build a manifest of the files created by this stream, otherwise
67
      	// don't build a manifest.
68
      const std::string &manifestPrefix = "udMan", 	// The prefix given to manifest filenames opened by this instance.
2226 sbetterm 69
      const std::string &manifestSuffix = ".txt", 	// The suffix given to manifest filenames opened by this instance.
70
      const std::string &pathmapTarget = ""	// The folder in the file-system that shall contain the drain file.
2218 sbetterm 71
      );
72
 
73
    //## Destructor (generated)
74
      virtual ~TransactionStream();
75
 
76
 
77
    //## Other Operations (specified)
78
      //## Operation: buildFileName%420821AD02EF
79
      //	Build a filename for naming transaction stream files, and evaluate to it.
80
      static std::string & buildFileName (std::string &filename, 	// The value to which this method evaluates, and which shall hold the built
81
      	// filename.
82
      const std::string &folder, 	// The folder in the file-system into which to write the file.
83
      const std::string &prefix, 	// The prefix asigned to this filename.
84
      const std::string &suffix, 	// The suffix asigned to this filename.
85
      const std::string &batchName, 	// The name of this batch.  When passing a string of zero-length, the batch is
86
      	// not named.
87
      const unsigned &batchNumber	// The batch number.
88
      );
89
 
90
      //## Operation: incrementCount%420723C60224
91
      //	Increment the number of transactions that have been written into the
92
      //	stream.  When the current batch is full, the batch number is incremented and
93
      //	another batch is opened.
94
      void incrementCount ();
95
 
96
      //## Operation: newBatch%420722B50215
97
      //	Open a new batch of the given batch size, and evaluate to true, or false
98
      //	when a new batch cannot be opened.  The current batch number is reset to 1
99
      //	when the new batch is opened.
100
      const bool newBatch (const unsigned &size, 	// The number of transactions that make up a batch.  When setting batch size
101
      	// to 0, the stream is not batched; i.e., it is a continuous stream of
102
      	// transactions.
103
      const std::string &name	// The name of this batch.  When passing a string of zero-length, the batch is
104
      	// not named.
105
      );
106
 
107
      //## Operation: write%4207231D014A
108
      //	Write the given structure into the stream and evaluate to true, and to false
109
      //	when the structure cannot be written into the stream.  As transactions may
110
      //	comprise of multiple structures, we must rely on the caller to increment the
111
      //	transaction count.
112
      const bool write (const void *buffer, 	// The starting address of the buffer that contains the structure to be
113
      	// written into the stream.
114
      const unsigned &length	// The number of bytes contained in the buffer.
115
      );
116
 
117
    // Additional Public Declarations
118
      //## begin TransactionStream%420720460243.public preserve=yes
119
      //## end TransactionStream%420720460243.public
120
 
121
  protected:
122
    // Additional Protected Declarations
123
      //## begin TransactionStream%420720460243.protected preserve=yes
124
      //## end TransactionStream%420720460243.protected
125
 
126
  private:
127
    //## Constructors (generated)
128
      TransactionStream();
129
 
130
      TransactionStream(const TransactionStream &right);
131
 
132
    //## Assignment Operation (generated)
133
      TransactionStream & operator=(const TransactionStream &right);
134
 
135
 
136
    //## Other Operations (specified)
137
      //## Operation: close%420819C203E4
138
      //	Close the transaction stream.
139
      void close ();
140
 
141
      //## Operation: open%420819AE03C4
142
      //	Open the transaction stream.
143
      const bool open ();
144
 
145
    // Data Members for Class Attributes
146
 
147
      //## Attribute: batchNumber%420722630244
148
      //	The current batch number.
149
      //## begin TransactionStream::batchNumber%420722630244.attr preserve=no  private: unsigned {VA} 1
150
      unsigned m_batchNumber;
151
      //## end TransactionStream::batchNumber%420722630244.attr
152
 
153
      //## Attribute: batchCount%4207240B0186
154
      //	The number of transactions that have been written to the current batch.
155
      //## begin TransactionStream::batchCount%4207240B0186.attr preserve=no  private: unsigned {VA} 0
156
      unsigned m_batchCount;
157
      //## end TransactionStream::batchCount%4207240B0186.attr
158
 
159
      //## Attribute: batchName%42084F7F0094
160
      //	When a non-zero-length string, this defines the name of the batch.
161
      //## begin TransactionStream::batchName%42084F7F0094.attr preserve=no  private: std::string {VA} 
162
      std::string m_batchName;
163
      //## end TransactionStream::batchName%42084F7F0094.attr
164
 
165
      //## Attribute: batchPrefix%42081637001D
166
      //	The prefix given to batch filenames opened by this instance.
167
      //## begin TransactionStream::batchPrefix%42081637001D.attr preserve=no  private: std::string {VA} batchPrefix
168
      std::string m_batchPrefix;
169
      //## end TransactionStream::batchPrefix%42081637001D.attr
170
 
171
      //## Attribute: batchSize%420720DA032E
172
      //	The number of transactions that make up a batch.  When setting batch size to
173
      //	0, the stream is not batched; i.e., it is a continuous stream of
174
      //	transactions.
175
      //## begin TransactionStream::batchSize%420720DA032E.attr preserve=no  private: unsigned {VA} 0
176
      unsigned m_batchSize;
177
      //## end TransactionStream::batchSize%420720DA032E.attr
178
 
179
      //## Attribute: batchSuffix%420724ED01A6
180
      //	The suffix given to batch filenames opened by this instance.
181
      //## begin TransactionStream::batchSuffix%420724ED01A6.attr preserve=no  private: std::string {VA} batchSuffix
182
      std::string m_batchSuffix;
183
      //## end TransactionStream::batchSuffix%420724ED01A6.attr
184
 
185
      //## Attribute: folder%420720B3005F
186
      //	The folder in the file-system to which we write the transaction stream.
187
      //## begin TransactionStream::folder%420720B3005F.attr preserve=no  private: std::string {VA} folder
188
      std::string m_folder;
189
      //## end TransactionStream::folder%420720B3005F.attr
190
 
191
      //## Attribute: stream%42081DC203B0
192
      //	The underlying stream currently open for writing.
193
      //## begin TransactionStream::stream%42081DC203B0.attr preserve=no  private: std::ofstream {RA} 0
194
      std::ofstream *m_stream;
195
      //## end TransactionStream::stream%42081DC203B0.attr
196
 
197
    // Data Members for Associations
198
 
199
      //## Association: TransactionTestManager::Transaction Generation::<unnamed>%4209BA7B01B4
200
      //## Role: TransactionStream::manifest%4209BA7B0389
201
      //	The instance that builds a manifest, when the stream is to build a manifest.
202
      //## begin TransactionStream::manifest%4209BA7B0389.role preserve=no  private: UdFileManifest {1 -> 1RFHgAN}
203
      UdFileManifest *m_manifest;
204
      //## end TransactionStream::manifest%4209BA7B0389.role
205
 
206
    // Additional Private Declarations
207
      //## begin TransactionStream%420720460243.private preserve=yes
208
      //## end TransactionStream%420720460243.private
209
 
210
  private: //## implementation
211
    // Additional Implementation Declarations
212
      //## begin TransactionStream%420720460243.implementation preserve=yes
213
      //## end TransactionStream%420720460243.implementation
214
 
215
};
216
 
217
//## begin TransactionStream%420720460243.postscript preserve=yes
218
//## end TransactionStream%420720460243.postscript
219
 
220
// Class TransactionStream 
221
 
222
//## begin module%420720460243.epilog preserve=yes
223
//## end module%420720460243.epilog
224
 
225
 
226
#endif