• 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,
20                            const std::vector<int32_t>& coefficients);
21   ~CBC_ReedSolomonGF256Poly();
22 
23   int32_t GetCoefficients(int32_t degree) const;
24   const std::vector<int32_t>& GetCoefficients() const;
25   int32_t GetDegree() const;
26   bool IsZero() const;
27   std::unique_ptr<CBC_ReedSolomonGF256Poly> AddOrSubtract(
28       const CBC_ReedSolomonGF256Poly* other);
29   std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply(
30       const CBC_ReedSolomonGF256Poly* other);
31   std::unique_ptr<CBC_ReedSolomonGF256Poly> MultiplyByMonomial(
32       int32_t degree,
33       int32_t coefficient) const;
34   std::unique_ptr<CBC_ReedSolomonGF256Poly> Divide(
35       const CBC_ReedSolomonGF256Poly* other);
36   std::unique_ptr<CBC_ReedSolomonGF256Poly> Clone() const;
37 
38  private:
39   UnownedPtr<CBC_ReedSolomonGF256> const m_field;
40   std::vector<int32_t> m_coefficients;
41 };
42 
43 #endif  // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
44