Changed OneDReader::recordPattern to not throw exceptions. For now it just
[zxing.git] / cpp / core / src / zxing / oned / OneDReader.h
1 #ifndef __ONED_READER_H__
2 #define __ONED_READER_H__
3
4 /*
5  *  OneDReader.h
6  *  ZXing
7  *
8  *  Copyright 2010 ZXing authors All rights reserved.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22
23 #include <zxing/Reader.h>
24
25 namespace zxing {
26         namespace oned {
27                 class OneDReader : public Reader {
28                 private:
29                         static const int INTEGER_MATH_SHIFT = 8;
30
31                         Ref<Result> doDecode(Ref<BinaryBitmap> image, DecodeHints hints);
32                 public:
33                         static const int PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT;
34
35                         OneDReader();
36                         virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
37
38                         // Implementations must not throw any exceptions. If a barcode is not found on this row,
39                         // a empty ref should be returned e.g. return Ref<Result>();
40                         virtual Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row) = 0;
41
42                         static unsigned int patternMatchVariance(int counters[], int countersSize,
43                             const int pattern[], int maxIndividualVariance);
44                         static bool recordPattern(Ref<BitArray> row, int start, int counters[], int countersCount);
45                         virtual ~OneDReader();
46                 };
47         }
48 }
49
50 #endif