• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
8 #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fxcrt/unowned_ptr.h"
14 
15 class CBC_ReedSolomonGF256;
16 
17 class CBC_ReedSolomonGF256Poly final {
18  public:
19   CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients);
20   CBC_ReedSolomonGF256Poly();
21   ~CBC_ReedSolomonGF256Poly();
22   bool Init(CBC_ReedSolomonGF256* field,
23             const std::vector<int32_t>* coefficients);
24 
25   int32_t GetCoefficients(int32_t degree) const;
26   const std::vector<int32_t>& GetCoefficients() const;
27   int32_t GetDegree() const;
28   bool IsZero() const;
29   int32_t EvaluateAt(int32_t a);
30   std::unique_ptr<CBC_ReedSolomonGF256Poly> AddOrSubtract(
31       const CBC_ReedSolomonGF256Poly* other);
32   std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply(
33       const CBC_ReedSolomonGF256Poly* other);
34   std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply(int32_t scalar);
35   std::unique_ptr<CBC_ReedSolomonGF256Poly> MultiplyByMonomial(
36       int32_t degree,
37       int32_t coefficient) const;
38   std::unique_ptr<CBC_ReedSolomonGF256Poly> Divide(
39       const CBC_ReedSolomonGF256Poly* other);
40   std::unique_ptr<CBC_ReedSolomonGF256Poly> Clone() const;
41 
42  private:
43   UnownedPtr<CBC_ReedSolomonGF256> m_field;
44   std::vector<int32_t> m_coefficients;
45 };
46 
47 #endif  // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
48