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_REEDSOLOMON_H_ 8 #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_ 9 10 #include <memory> 11 #include <vector> 12 13 #include "core/fxcrt/unowned_ptr.h" 14 15 class CBC_ReedSolomonGF256; 16 class CBC_ReedSolomonGF256Poly; 17 18 class CBC_ReedSolomonEncoder { 19 public: 20 explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field); 21 ~CBC_ReedSolomonEncoder(); 22 23 bool Encode(std::vector<int32_t>* toEncode, size_t ecBytes); 24 25 private: 26 CBC_ReedSolomonGF256Poly* BuildGenerator(size_t degree); 27 28 UnownedPtr<CBC_ReedSolomonGF256> const m_field; 29 std::vector<std::unique_ptr<CBC_ReedSolomonGF256Poly>> m_cachedGenerators; 30 }; 31 32 #endif // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_ 33