HEBench
tutorial_engine_seal.cpp
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
6 
7 #include <cstring>
8 
9 #include "tutorial_engine_seal.h"
10 #include "tutorial_error_seal.h"
11 
12 // include all benchmarks
14 
15 //-----------------
16 // Engine creation
17 //-----------------
18 
19 namespace hebench {
20 namespace cpp {
21 
22 BaseEngine *createEngine()
23 {
24  // It is a good idea to check here if the API Bridge version is correct for
25  // our backend by checking against the constants defined in `hebench/api_bridge/version_seal.h`
26  // HEBENCH_API_VERSION_*
27  // For simplicity purposes, no check is performed in this tutorial.
28 
29  return TutorialEngine::create();
30 }
31 
32 void destroyEngine(BaseEngine *p)
33 {
34  TutorialEngine *_p = dynamic_cast<TutorialEngine *>(p);
35  TutorialEngine::destroy(_p);
36 }
37 
38 } // namespace cpp
39 } // namespace hebench
40 
41 //---------------------
42 // class ExampleEngine
43 //---------------------
44 
45 TutorialEngine *TutorialEngine::create()
46 {
47  TutorialEngine *p_retval = new TutorialEngine();
48  p_retval->init();
49  return p_retval;
50 }
51 
52 void TutorialEngine::destroy(TutorialEngine *p)
53 {
54  if (p)
55  delete p;
56 }
57 
58 TutorialEngine::TutorialEngine()
59 {
60 }
61 
62 TutorialEngine::~TutorialEngine()
63 {
64 }
65 
67 void TutorialEngine::init()
68 {
70  // add any new error codes
71 
72  addErrorCode(TUTORIAL_ECODE_SEAL_ERROR, "SEAL error.");
74 
76  // add supported schemes
77 
78  //addSchemeName(HEBENCH_HE_SCHEME_PLAIN, "Plain");
79  addSchemeName(HEBENCH_HE_SCHEME_BFV, "BFV");
81 
83  // add supported security
84 
85  //addSecurityName(HEBENCH_HE_SECURITY_NONE, "None");
86  addSecurityName(TUTORIAL_HE_SECURITY_128, "128 bits");
88 
90  // add the all benchmark descriptors
91  addBenchmarkDescription(std::make_shared<TutorialEltwiseAddBenchmarkDescription>());
93 }
95 
BaseEngine * createEngine(const std::int8_t *p_buffer, std::uint64_t size)
Creates a new BaseEngine object.
void destroyEngine(BaseEngine *p)
Destroys and cleans up resources from an engine created by createEngine().
#define HEBENCH_HE_SCHEME_BFV
Definition: types.h:69