YPC  0.2.0
parser.h
1 #pragma once
2 #include "iodef.h"
3 #include "ypc/common/parser_type.h"
4 #include "ypc/core/sealed_file.h"
5 #include "ypc/core/sgx/parser_sgx_module.h"
6 #include "ypc/keymgr/default/keymgr_sgx_module.h"
7 #include <memory>
8 #include <unordered_map>
9 
10 class parser {
11 public:
12  parser(const input_param_t &param);
13 
14  virtual ~parser();
15 
16  virtual uint32_t parse();
17 
18  virtual uint32_t next_data_batch(const uint8_t *data_hash, uint32_t hash_size,
19  uint8_t **data, uint32_t *len);
20  virtual void free_data_batch(uint8_t *data);
21 
22  inline std::shared_ptr<keymgr_sgx_module> keymgr() const { return m_keymgr; }
23 
24  inline const std::string &get_result_str() const { return m_result_str; }
25 
26 protected:
27  uint32_t feed_datasource();
28  uint32_t feed_model();
29  uint32_t feed_param();
30  uint32_t dump_result(const ypc::bytes &res);
31 
32 protected:
33  input_param_t m_param;
34  ypc::utc::parser_type_t m_ptype{};
35 
36  std::shared_ptr<ypc::parser_sgx_module> m_parser;
37  std::shared_ptr<keymgr_sgx_module> m_keymgr;
38  std::unordered_map<ypc::bytes, std::shared_ptr<ypc::simple_sealed_file>>
39  m_data_sources;
40  std::string m_result_str;
41 };
parser
Definition: parser.h:10
ypc::utc::parser_type_t
Definition: parser_type.h:24
ypc::utc::bytes< byte_t, ::ypc::utc::byte_encode::raw_bytes >