1 | /* |
2 | * Legal Notice |
3 | * |
4 | * This document and associated source code (the "Work") is a part of a |
5 | * benchmark specification maintained by the TPC. |
6 | * |
7 | * The TPC reserves all right, title, and interest to the Work as provided |
8 | * under U.S. and international laws, including without limitation all patent |
9 | * and trademark rights therein. |
10 | * |
11 | * No Warranty |
12 | * |
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION |
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE |
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER |
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, |
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, |
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR |
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF |
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. |
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, |
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT |
23 | * WITH REGARD TO THE WORK. |
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO |
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE |
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS |
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, |
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, |
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT |
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD |
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. |
32 | * |
33 | * Contributors |
34 | * - Doug Johnson |
35 | */ |
36 | |
37 | /****************************************************************************** |
38 | * Description: This class provides Data-Maintenance functionality. |
39 | * It generates all necessary inputs for the |
40 | * Data-Maintenance transaction. These inputs are then |
41 | * made available to a sponsor provided callback interface |
42 | * to the SUT (see DMSUTInterface.h). |
43 | * |
44 | * The constructor to this class accepts the following |
45 | * parameters. |
46 | * |
47 | * - pSUT: a pointer to an instance of a sponsor provided |
48 | * subclassing of the CCESUTInterface class. |
49 | * - pLogger: a pointer to an |
50 | *instance of CEGenLogger or a sponsor provided subclassing of the CBaseLogger |
51 | *class. |
52 | * - dfm: a reference to an instance of the |
53 | * CInputFiles class containing all input files loaded |
54 | * into memory. |
55 | * - iActiveCustomerCount: the total number of customers |
56 | * to emulate. C_IDs will be generated in the range of |
57 | * 1 to iActiveCustomerCount. |
58 | * - RandomSeed: seed to be used for the RNG. |
59 | * |
60 | * The DM class provides the following entry point. |
61 | * |
62 | * - DoTxn: this entry point will generate all required |
63 | * inputs and provide those inputs to sponsor code at the |
64 | * - DoCleanupTxn: this entry point will execute the |
65 | * Trade-Cleanup transaction. This must be run at the |
66 | * start of each measurement run before any CE or MEE |
67 | * transactions are executed. |
68 | ******************************************************************************/ |
69 | |
70 | #ifndef DM_H |
71 | #define DM_H |
72 | |
73 | #include "utilities/EGenUtilities_stdafx.h" |
74 | #include "TxnHarnessStructs.h" |
75 | #include "DMSUTInterface.h" |
76 | #include "BaseLogger.h" |
77 | #include "DriverParamSettings.h" |
78 | |
79 | #include "input/DataFileManager.h" |
80 | |
81 | namespace TPCE { |
82 | |
83 | class CDM { |
84 | private: |
85 | CDriverGlobalSettings m_DriverGlobalSettings; |
86 | CDriverDMSettings m_DriverDMSettings; |
87 | |
88 | CRandom m_rnd; |
89 | CCustomerSelection m_CustomerSelection; |
90 | CCustomerAccountsAndPermissionsTable m_AccsAndPerms; |
91 | const CSecurityFile &m_Securities; |
92 | const CCompanyFile &m_Companies; |
93 | const TaxRateDivisionDataFile_t &m_TaxRatesDivision; |
94 | const StatusTypeDataFile_t &m_StatusType; |
95 | TIdent m_iSecurityCount; |
96 | TIdent m_iCompanyCount; |
97 | TIdent m_iStartFromCompany; |
98 | INT32 m_iDivisionTaxCount; |
99 | TIdent m_iStartFromCustomer; |
100 | |
101 | INT32 m_DataMaintenanceTableNum; |
102 | |
103 | TDataMaintenanceTxnInput m_TxnInput; |
104 | TTradeCleanupTxnInput m_CleanupTxnInput; |
105 | CDMSUTInterface *m_pSUT; |
106 | CBaseLogger *m_pLogger; |
107 | |
108 | // Automatically generate unique RNG seeds |
109 | void AutoSetRNGSeeds(UINT32 UniqueId); |
110 | |
111 | TIdent GenerateRandomCustomerId(); |
112 | |
113 | TIdent GenerateRandomCustomerAccountId(); |
114 | |
115 | TIdent GenerateRandomCompanyId(); |
116 | |
117 | TIdent GenerateRandomSecurityId(); |
118 | |
119 | // Initialization that is common for all constructors. |
120 | void Initialize(); |
121 | |
122 | public: |
123 | // Constructor - automatice RNG seed generation |
124 | CDM(CDMSUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount, |
125 | TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId); |
126 | |
127 | // Constructor - RNG seed provided |
128 | CDM(CDMSUTInterface *pSUT, CBaseLogger *pLogger, const DataFileManager &dfm, TIdent iConfiguredCustomerCount, |
129 | TIdent iActiveCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades, UINT32 UniqueId, RNGSEED RNGSeed); |
130 | |
131 | ~CDM(void); |
132 | |
133 | RNGSEED GetRNGSeed(void); |
134 | void DoTxn(void); |
135 | void DoCleanupTxn(void); |
136 | }; |
137 | |
138 | } // namespace TPCE |
139 | |
140 | #endif // #ifndef DM_H |
141 | |