1/**
2 * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15
16 * \author Hechong.xyf
17 * \date Oct 2019
18 * \brief Interface of AiTheta Index Module
19 */
20
21#ifndef __AITHETA2_INDEX_MODULE_H__
22#define __AITHETA2_INDEX_MODULE_H__
23
24#include <memory>
25#include <string>
26
27namespace aitheta2 {
28
29struct IndexFactory;
30
31/*! Index Module
32 */
33class IndexModule {
34 public:
35 //! Index Module Pointer
36 typedef std::shared_ptr<IndexModule> Pointer;
37
38 //! Destructor
39 virtual ~IndexModule(void) {}
40
41 //! Retrieve debug information
42 virtual std::string debug_string(void) const {
43 return std::string();
44 }
45
46 //! Retrieve name of module
47 const std::string &name(void) const {
48 return name_;
49 }
50
51 //! Retrieve revision of module
52 uint32_t revision(void) const {
53 return revision_;
54 }
55
56 protected:
57 friend struct IndexFactory;
58
59 //! Set name of module
60 void set_name(const std::string &str) {
61 name_ = str;
62 }
63
64 //! Set revision of module
65 void set_revision(uint32_t val) {
66 revision_ = val;
67 }
68
69 private:
70 //! Members
71 uint32_t revision_{0u};
72 std::string name_{};
73};
74
75} // namespace aitheta2
76
77#endif // __AITHETA2_INDEX_MODULE_H__
78