Subversion Repositories DevTools

Rev

Rev 2263 | Details | Compare with Previous | Last modification | View Log | RSS feed

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