XVector
xvec_ivf_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_ivf_flat.h"
41 #include "xvector/xvec_types.h"
42 
44 
45 namespace xvec
46 {
47 
59 {
60 public:
67  static IvfFlatIndex fromFaissFile(xvecExecutionContextTag* context, const std::string& path);
68 
77  static IvfFlatIndex fromDescriptor(xvecExecutionContextTag* context,
78  const xvecIvfFlatDescriptor& descriptor);
79 
80  virtual ~IvfFlatIndex();
81 
82  IvfFlatIndex(IvfFlatIndex&& other) noexcept;
83  IvfFlatIndex& operator=(IvfFlatIndex&& other) noexcept;
84 
85  IvfFlatIndex(const IvfFlatIndex&) = delete;
86  IvfFlatIndex& operator=(const IvfFlatIndex&) = delete;
87 
91  xvecIvfFlatIndexTag* handle() const noexcept;
92 
93 private:
94  IvfFlatIndex(xvecExecutionContextTag* context, xvecIvfFlatIndexTag* handle);
95 
96  xvecExecutionContextTag* context_ = nullptr;
97  xvecIvfFlatIndexTag* handle_ = nullptr;
98 };
99 
100 } // namespace xvec
101 
102 #endif // __cplusplus
RAII wrapper for xvecIvfFlatIndexTag.
IvfFlatIndex(const IvfFlatIndex &)=delete
xvecIvfFlatIndexTag * handle() const noexcept
Get the underlying C API handle.
static IvfFlatIndex fromDescriptor(xvecExecutionContextTag *context, const xvecIvfFlatDescriptor &descriptor)
Load an IVF-Flat index from a FAISS-free descriptor.
IvfFlatIndex & operator=(IvfFlatIndex &&other) noexcept
virtual ~IvfFlatIndex()
IvfFlatIndex & operator=(const IvfFlatIndex &)=delete
static IvfFlatIndex fromFaissFile(xvecExecutionContextTag *context, const std::string &path)
Load an IVF-Flat index from a Faiss file.
IvfFlatIndex(IvfFlatIndex &&other) noexcept
FAISS-free description of an IVF-Flat index.
Definition: xvec_ivf_flat.h:74
Exception types for C++ XVECTOR wrappers.
IVF-Flat (Inverted File with Flat vectors) index interface.
Core types, enums, and structures for the XVector library.