#ADD: DataMatrix reader.
[zxing.git] / cpp / core / src / zxing / datamatrix / Version.h
1 #ifndef __VERSION_H__
2 #define __VERSION_H__
3
4 /*
5  *  Version.h
6  *  zxing
7  *
8  *  Created by Luiz Silva on 09/02/2010.
9  *  Copyright 2010 ZXing authors All rights reserved.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23
24 #include <zxing/ReaderException.h>
25 #include <zxing/common/BitMatrix.h>
26 #include <zxing/common/Counted.h>
27 #include <vector>
28 #include <valarray>
29
30 namespace zxing {
31 namespace datamatrix {
32 using namespace std;
33
34 class ECB {
35 private:
36   int count_;
37   int dataCodewords_;
38 public:
39   ECB(int count, int dataCodewords);
40   int getCount();
41   int getDataCodewords();
42 };
43
44 class ECBlocks {
45 private:
46   int ecCodewords_;
47   std::vector<ECB*> ecBlocks_;
48 public:
49   ECBlocks(int ecCodewords, ECB *ecBlocks);
50   ECBlocks(int ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2);
51   int getECCodewords();
52   std::vector<ECB*>& getECBlocks();
53   ~ECBlocks();
54 };
55
56 class Version : public Counted {
57 private:\r
58   int versionNumber_;\r
59   int symbolSizeRows_;\r
60   int symbolSizeColumns_;\r
61   int dataRegionSizeRows_;\r
62   int dataRegionSizeColumns_;
63   ECBlocks* ecBlocks_;
64   int totalCodewords_;
65   Version(int versionNumber, int symbolSizeRows, int symbolSizeColumns, int dataRegionSizeRows,
66                   int dataRegionSizeColumns, ECBlocks *ecBlocks);
67
68 public:
69   static std::vector<Ref<Version> > VERSIONS;
70   
71   ~Version();
72   int getVersionNumber();\r
73   int getSymbolSizeRows();\r
74   int getSymbolSizeColumns();  \r
75   int getDataRegionSizeRows();  \r
76   int getDataRegionSizeColumns();
77   int getTotalCodewords();
78   ECBlocks* getECBlocks();
79   static int  buildVersions();  \r
80   Version* getVersionForDimensions(int numRows, int numColumns);
81 };
82 }
83 }
84
85 #endif // __VERSION_H__