XVector
xvec_hnsw_flat_index.hpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2026 XCENA Inc.
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 
34 #pragma once
35 
36 #ifdef __cplusplus
37 
38 #include <string>
39 
40 #include "xvector/xvec_hnsw_flat.h"
41 #include "xvector/xvec_types.h"
42 
44 
45 namespace xvec
46 {
47 
58 {
59 public:
66  static HnswFlatIndex fromFaissFile(xvecExecutionContextTag* context, const std::string& path);
67 
76  static HnswFlatIndex fromDescriptor(xvecExecutionContextTag* context,
77  const xvecHnswFlatDescriptor& descriptor);
78 
79  virtual ~HnswFlatIndex();
80 
81  HnswFlatIndex(HnswFlatIndex&& other) noexcept;
83 
84  HnswFlatIndex(const HnswFlatIndex&) = delete;
86 
90  xvecHnswFlatIndexTag* handle() const noexcept;
91 
92 private:
93  HnswFlatIndex(xvecExecutionContextTag* context, xvecHnswFlatIndexTag* handle);
94 
95  xvecExecutionContextTag* context_ = nullptr;
96  xvecHnswFlatIndexTag* handle_ = nullptr;
97 };
98 
99 } // namespace xvec
100 
101 #endif // __cplusplus
RAII wrapper for xvecHnswFlatIndexTag.
xvecHnswFlatIndexTag * handle() const noexcept
Get the underlying C API handle.
static HnswFlatIndex fromDescriptor(xvecExecutionContextTag *context, const xvecHnswFlatDescriptor &descriptor)
Load an HNSW-Flat index from a FAISS-free descriptor (and upload it to device).
static HnswFlatIndex fromFaissFile(xvecExecutionContextTag *context, const std::string &path)
Load an HNSW-Flat index from a Faiss file (and upload it to device).
HnswFlatIndex(HnswFlatIndex &&other) noexcept
virtual ~HnswFlatIndex()
HnswFlatIndex & operator=(HnswFlatIndex &&other) noexcept
HnswFlatIndex & operator=(const HnswFlatIndex &)=delete
HnswFlatIndex(const HnswFlatIndex &)=delete
FAISS-free description of an HNSW-Flat index.
Exception types for C++ XVECTOR wrappers.
HNSW-Flat (Hierarchical Navigable Small World) index interface.
Core types, enums, and structures for the XVector library.