@@ -61,7 +61,7 @@ ECBlocks::~ECBlocks() {
61
61
}
62
62
}
63
63
64
- vector<Version* > Version::VERSIONS;
64
+ vector<Ref< Version> > Version::VERSIONS;
65
65
static int N_VERSIONS = Version::buildVersions();
66
66
67
67
Version::Version (int versionNumber, int symbolSizeRows, int symbolSizeColumns, int dataRegionSizeRows,
@@ -112,7 +112,7 @@ ECBlocks* Version::getECBlocks() const {
112
112
return ecBlocks_;
113
113
}
114
114
115
- Version* Version::getVersionForDimensions (int numRows, int numColumns) {
115
+ Ref< Version> Version::getVersionForDimensions (int numRows, int numColumns) {
116
116
if ((numRows & 0x01 ) != 0 || (numColumns & 0x01 ) != 0 ) {
117
117
throw ReaderException (" Number of rows and columns must be even" );
118
118
}
@@ -121,7 +121,7 @@ Version* Version::getVersionForDimensions(int numRows, int numColumns) {
121
121
// If we interleave the rectangular versions with the square versions we could
122
122
// do a binary search.
123
123
for (int i = 0 ; i < N_VERSIONS; ++i){
124
- Version* version = VERSIONS[i];
124
+ Ref< Version> version = VERSIONS[i];
125
125
if (version->getSymbolSizeRows () == numRows && version->getSymbolSizeColumns () == numColumns) {
126
126
return version;
127
127
}
@@ -133,66 +133,66 @@ Version* Version::getVersionForDimensions(int numRows, int numColumns) {
133
133
* See ISO 16022:2006 5.5.1 Table 7
134
134
*/
135
135
int Version::buildVersions () {
136
- VERSIONS.push_back (new Version (1 , 10 , 10 , 8 , 8 ,
137
- new ECBlocks (5 , new ECB (1 , 3 ))));
138
- VERSIONS.push_back (new Version (2 , 12 , 12 , 10 , 10 ,
139
- new ECBlocks (7 , new ECB (1 , 5 ))));
140
- VERSIONS.push_back (new Version (3 , 14 , 14 , 12 , 12 ,
141
- new ECBlocks (10 , new ECB (1 , 8 ))));
142
- VERSIONS.push_back (new Version (4 , 16 , 16 , 14 , 14 ,
143
- new ECBlocks (12 , new ECB (1 , 12 ))));
144
- VERSIONS.push_back (new Version (5 , 18 , 18 , 16 , 16 ,
145
- new ECBlocks (14 , new ECB (1 , 18 ))));
146
- VERSIONS.push_back (new Version (6 , 20 , 20 , 18 , 18 ,
147
- new ECBlocks (18 , new ECB (1 , 22 ))));
148
- VERSIONS.push_back (new Version (7 , 22 , 22 , 20 , 20 ,
149
- new ECBlocks (20 , new ECB (1 , 30 ))));
150
- VERSIONS.push_back (new Version (8 , 24 , 24 , 22 , 22 ,
151
- new ECBlocks (24 , new ECB (1 , 36 ))));
152
- VERSIONS.push_back (new Version (9 , 26 , 26 , 24 , 24 ,
153
- new ECBlocks (28 , new ECB (1 , 44 ))));
154
- VERSIONS.push_back (new Version (10 , 32 , 32 , 14 , 14 ,
155
- new ECBlocks (36 , new ECB (1 , 62 ))));
156
- VERSIONS.push_back (new Version (11 , 36 , 36 , 16 , 16 ,
157
- new ECBlocks (42 , new ECB (1 , 86 ))));
158
- VERSIONS.push_back (new Version (12 , 40 , 40 , 18 , 18 ,
159
- new ECBlocks (48 , new ECB (1 , 114 ))));
160
- VERSIONS.push_back (new Version (13 , 44 , 44 , 20 , 20 ,
161
- new ECBlocks (56 , new ECB (1 , 144 ))));
162
- VERSIONS.push_back (new Version (14 , 48 , 48 , 22 , 22 ,
163
- new ECBlocks (68 , new ECB (1 , 174 ))));
164
- VERSIONS.push_back (new Version (15 , 52 , 52 , 24 , 24 ,
165
- new ECBlocks (42 , new ECB (2 , 102 ))));
166
- VERSIONS.push_back (new Version (16 , 64 , 64 , 14 , 14 ,
167
- new ECBlocks (56 , new ECB (2 , 140 ))));
168
- VERSIONS.push_back (new Version (17 , 72 , 72 , 16 , 16 ,
169
- new ECBlocks (36 , new ECB (4 , 92 ))));
170
- VERSIONS.push_back (new Version (18 , 80 , 80 , 18 , 18 ,
171
- new ECBlocks (48 , new ECB (4 , 114 ))));
172
- VERSIONS.push_back (new Version (19 , 88 , 88 , 20 , 20 ,
173
- new ECBlocks (56 , new ECB (4 , 144 ))));
174
- VERSIONS.push_back (new Version (20 , 96 , 96 , 22 , 22 ,
175
- new ECBlocks (68 , new ECB (4 , 174 ))));
176
- VERSIONS.push_back (new Version (21 , 104 , 104 , 24 , 24 ,
177
- new ECBlocks (56 , new ECB (6 , 136 ))));
178
- VERSIONS.push_back (new Version (22 , 120 , 120 , 18 , 18 ,
179
- new ECBlocks (68 , new ECB (6 , 175 ))));
180
- VERSIONS.push_back (new Version (23 , 132 , 132 , 20 , 20 ,
181
- new ECBlocks (62 , new ECB (8 , 163 ))));
182
- VERSIONS.push_back (new Version (24 , 144 , 144 , 22 , 22 ,
183
- new ECBlocks (62 , new ECB (8 , 156 ), new ECB (2 , 155 ))));
184
- VERSIONS.push_back (new Version (25 , 8 , 18 , 6 , 16 ,
185
- new ECBlocks (7 , new ECB (1 , 5 ))));
186
- VERSIONS.push_back (new Version (26 , 8 , 32 , 6 , 14 ,
187
- new ECBlocks (11 , new ECB (1 , 10 ))));
188
- VERSIONS.push_back (new Version (27 , 12 , 26 , 10 , 24 ,
189
- new ECBlocks (14 , new ECB (1 , 16 ))));
190
- VERSIONS.push_back (new Version (28 , 12 , 36 , 10 , 16 ,
191
- new ECBlocks (18 , new ECB (1 , 22 ))));
192
- VERSIONS.push_back (new Version (29 , 16 , 36 , 14 , 16 ,
193
- new ECBlocks (24 , new ECB (1 , 32 ))));
194
- VERSIONS.push_back (new Version (30 , 16 , 48 , 14 , 22 ,
195
- new ECBlocks (28 , new ECB (1 , 49 ))));
136
+ VERSIONS.push_back (Ref<Version>( new Version (1 , 10 , 10 , 8 , 8 ,
137
+ new ECBlocks (5 , new ECB (1 , 3 ))))) ;
138
+ VERSIONS.push_back (Ref<Version>( new Version (2 , 12 , 12 , 10 , 10 ,
139
+ new ECBlocks (7 , new ECB (1 , 5 ))))) ;
140
+ VERSIONS.push_back (Ref<Version>( new Version (3 , 14 , 14 , 12 , 12 ,
141
+ new ECBlocks (10 , new ECB (1 , 8 ))))) ;
142
+ VERSIONS.push_back (Ref<Version>( new Version (4 , 16 , 16 , 14 , 14 ,
143
+ new ECBlocks (12 , new ECB (1 , 12 ))))) ;
144
+ VERSIONS.push_back (Ref<Version>( new Version (5 , 18 , 18 , 16 , 16 ,
145
+ new ECBlocks (14 , new ECB (1 , 18 ))))) ;
146
+ VERSIONS.push_back (Ref<Version>( new Version (6 , 20 , 20 , 18 , 18 ,
147
+ new ECBlocks (18 , new ECB (1 , 22 ))))) ;
148
+ VERSIONS.push_back (Ref<Version>( new Version (7 , 22 , 22 , 20 , 20 ,
149
+ new ECBlocks (20 , new ECB (1 , 30 ))))) ;
150
+ VERSIONS.push_back (Ref<Version>( new Version (8 , 24 , 24 , 22 , 22 ,
151
+ new ECBlocks (24 , new ECB (1 , 36 ))))) ;
152
+ VERSIONS.push_back (Ref<Version>( new Version (9 , 26 , 26 , 24 , 24 ,
153
+ new ECBlocks (28 , new ECB (1 , 44 ))))) ;
154
+ VERSIONS.push_back (Ref<Version>( new Version (10 , 32 , 32 , 14 , 14 ,
155
+ new ECBlocks (36 , new ECB (1 , 62 ))))) ;
156
+ VERSIONS.push_back (Ref<Version>( new Version (11 , 36 , 36 , 16 , 16 ,
157
+ new ECBlocks (42 , new ECB (1 , 86 ))))) ;
158
+ VERSIONS.push_back (Ref<Version>( new Version (12 , 40 , 40 , 18 , 18 ,
159
+ new ECBlocks (48 , new ECB (1 , 114 ))))) ;
160
+ VERSIONS.push_back (Ref<Version>( new Version (13 , 44 , 44 , 20 , 20 ,
161
+ new ECBlocks (56 , new ECB (1 , 144 ))))) ;
162
+ VERSIONS.push_back (Ref<Version>( new Version (14 , 48 , 48 , 22 , 22 ,
163
+ new ECBlocks (68 , new ECB (1 , 174 ))))) ;
164
+ VERSIONS.push_back (Ref<Version>( new Version (15 , 52 , 52 , 24 , 24 ,
165
+ new ECBlocks (42 , new ECB (2 , 102 ))))) ;
166
+ VERSIONS.push_back (Ref<Version>( new Version (16 , 64 , 64 , 14 , 14 ,
167
+ new ECBlocks (56 , new ECB (2 , 140 ))))) ;
168
+ VERSIONS.push_back (Ref<Version>( new Version (17 , 72 , 72 , 16 , 16 ,
169
+ new ECBlocks (36 , new ECB (4 , 92 ))))) ;
170
+ VERSIONS.push_back (Ref<Version>( new Version (18 , 80 , 80 , 18 , 18 ,
171
+ new ECBlocks (48 , new ECB (4 , 114 ))))) ;
172
+ VERSIONS.push_back (Ref<Version>( new Version (19 , 88 , 88 , 20 , 20 ,
173
+ new ECBlocks (56 , new ECB (4 , 144 ))))) ;
174
+ VERSIONS.push_back (Ref<Version>( new Version (20 , 96 , 96 , 22 , 22 ,
175
+ new ECBlocks (68 , new ECB (4 , 174 ))))) ;
176
+ VERSIONS.push_back (Ref<Version>( new Version (21 , 104 , 104 , 24 , 24 ,
177
+ new ECBlocks (56 , new ECB (6 , 136 ))))) ;
178
+ VERSIONS.push_back (Ref<Version>( new Version (22 , 120 , 120 , 18 , 18 ,
179
+ new ECBlocks (68 , new ECB (6 , 175 ))))) ;
180
+ VERSIONS.push_back (Ref<Version>( new Version (23 , 132 , 132 , 20 , 20 ,
181
+ new ECBlocks (62 , new ECB (8 , 163 ))))) ;
182
+ VERSIONS.push_back (Ref<Version>( new Version (24 , 144 , 144 , 22 , 22 ,
183
+ new ECBlocks (62 , new ECB (8 , 156 ), new ECB (2 , 155 ))))) ;
184
+ VERSIONS.push_back (Ref<Version>( new Version (25 , 8 , 18 , 6 , 16 ,
185
+ new ECBlocks (7 , new ECB (1 , 5 ))))) ;
186
+ VERSIONS.push_back (Ref<Version>( new Version (26 , 8 , 32 , 6 , 14 ,
187
+ new ECBlocks (11 , new ECB (1 , 10 ))))) ;
188
+ VERSIONS.push_back (Ref<Version>( new Version (27 , 12 , 26 , 10 , 24 ,
189
+ new ECBlocks (14 , new ECB (1 , 16 ))))) ;
190
+ VERSIONS.push_back (Ref<Version>( new Version (28 , 12 , 36 , 10 , 16 ,
191
+ new ECBlocks (18 , new ECB (1 , 22 ))))) ;
192
+ VERSIONS.push_back (Ref<Version>( new Version (29 , 16 , 36 , 14 , 16 ,
193
+ new ECBlocks (24 , new ECB (1 , 32 ))))) ;
194
+ VERSIONS.push_back (Ref<Version>( new Version (30 , 16 , 48 , 14 , 22 ,
195
+ new ECBlocks (28 , new ECB (1 , 49 ))))) ;
196
196
return int (VERSIONS.size ());
197
197
}
198
198
}
0 commit comments