treelite
compiler.h
Go to the documentation of this file.
1 
8 #ifndef TREELITE_COMPILER_H_
9 #define TREELITE_COMPILER_H_
10 
11 #include <dmlc/registry.h>
12 #include <treelite/common.h>
13 #include <functional>
14 #include <memory>
15 
16 namespace treelite {
17 
18 struct Model; // forward declaration
19 
20 namespace compiler {
21 
22 struct CompilerParam; // forward declaration
23 
24 } // namespace compiler
25 
26 namespace semantic {
27 
28 struct SemanticModel; // forward declaration
29 
30 } // namespace semantic
31 
33 class Compiler {
34  public:
36  virtual ~Compiler() = default;
41  virtual semantic::SemanticModel Compile(const Model& model) = 0;
47  static Compiler* Create(const std::string& name,
48  const compiler::CompilerParam& param);
49 };
50 
55  : public dmlc::FunctionRegEntryBase<CompilerReg,
56  std::function<Compiler* (const compiler::CompilerParam&)> > {
57 };
58 
71 #define TREELITE_REGISTER_COMPILER(UniqueId, Name) \
72  static DMLC_ATTRIBUTE_UNUSED ::treelite::CompilerReg & \
73  __make_ ## CompilerReg ## _ ## UniqueId ## __ = \
74  ::dmlc::Registry< ::treelite::CompilerReg>::Get()->__REGISTER__(Name)
75 
76 } // namespace treelite
77 
78 #endif // TREELITE_COMPILER_H_
thin wrapper for tree ensemble model
Definition: tree.h:350
parameters for tree compiler
Definition: param.h:16
interface of compiler
Definition: compiler.h:33
Some useful utilities.
semantic model consists of a header, function registry, and a list of translation units ...
Definition: semantic.h:90
Registry entry for compiler.
Definition: compiler.h:54