1 | #ifndef COMMISSION_RATE_DATA_FILE_RECORD_H |
2 | #define COMMISSION_RATE_DATA_FILE_RECORD_H |
3 | |
4 | /* |
5 | * Legal Notice |
6 | * |
7 | * This document and associated source code (the "Work") is a part of a |
8 | * benchmark specification maintained by the TPC. |
9 | * |
10 | * The TPC reserves all right, title, and interest to the Work as provided |
11 | * under U.S. and international laws, including without limitation all patent |
12 | * and trademark rights therein. |
13 | * |
14 | * No Warranty |
15 | * |
16 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION |
17 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE |
18 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER |
19 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, |
20 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, |
21 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR |
22 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF |
23 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. |
24 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, |
25 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT |
26 | * WITH REGARD TO THE WORK. |
27 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO |
28 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE |
29 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS |
30 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, |
31 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, |
32 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT |
33 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD |
34 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. |
35 | * |
36 | * Contributors |
37 | * - Doug Johnson |
38 | */ |
39 | |
40 | #include <deque> |
41 | #include <string> |
42 | |
43 | namespace TPCE { |
44 | // |
45 | // Description: |
46 | // A class to represent a single record in the CommissionRate data file. |
47 | // |
48 | // Exception Safety: |
49 | // The Basic guarantee is provided. |
50 | // |
51 | // Copy Behavior: |
52 | // Copying is allowed. |
53 | // |
54 | |
55 | class CommissionRateDataFileRecord { |
56 | private: |
57 | int cr_c_tier; |
58 | |
59 | static const int maxCr_tt_idLen = 3; |
60 | char cr_tt_idCStr[maxCr_tt_idLen + 1]; |
61 | std::string cr_tt_id; |
62 | |
63 | static const int maxCr_ex_idLen = 6; |
64 | char cr_ex_idCStr[maxCr_ex_idLen + 1]; |
65 | std::string cr_ex_id; |
66 | |
67 | int cr_from_qty; |
68 | int cr_to_qty; |
69 | double cr_rate; |
70 | |
71 | static const unsigned int fieldCount = 6; |
72 | |
73 | public: |
74 | explicit CommissionRateDataFileRecord(const std::deque<std::string> &fields); |
75 | |
76 | // |
77 | // Default copies and destructor are ok. |
78 | // |
79 | // ~CommissionRateDataFileRecord() |
80 | // CommissionRateDataFileRecord(const CommissionRateDataFileRecord&); |
81 | // CommissionRateDataFileRecord& operator=(const |
82 | // CommissionRateDataFileRecord&); |
83 | // |
84 | |
85 | int CR_C_TIER() const; |
86 | |
87 | const std::string &CR_TT_ID() const; |
88 | const char *CR_TT_ID_CSTR() const; |
89 | |
90 | const std::string &CR_EX_ID() const; |
91 | const char *CR_EX_ID_CSTR() const; |
92 | |
93 | int CR_FROM_QTY() const; |
94 | int CR_TO_QTY() const; |
95 | double CR_RATE() const; |
96 | |
97 | std::string ToString(char fieldSeparator = '\t') const; |
98 | }; |
99 | |
100 | } // namespace TPCE |
101 | #endif // COMMISSION_RATE_DATA_FILE_RECORD_H |
102 | |