| 1 |
/* |
| 2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 |
* |
| 4 |
* This source code is licensed under the MIT license found in the |
| 5 |
* LICENSE file in the root directory of this source tree. |
| 6 |
*/ |
| 7 |
|
| 8 |
// -*- c -*- |
| 9 |
|
| 10 |
#ifndef FAISS_IO_C_H |
| 11 |
#define FAISS_IO_C_H |
| 12 |
|
| 13 |
#include <stddef.h> |
| 14 |
#include "../faiss_c.h" |
| 15 |
|
| 16 |
#ifdef __cplusplus |
| 17 |
extern "C" { |
| 18 |
#endif |
| 19 |
|
| 20 |
FAISS_DECLARE_CLASS(IOReader) |
| 21 |
FAISS_DECLARE_DESTRUCTOR(IOReader) |
| 22 |
|
| 23 |
FAISS_DECLARE_CLASS(IOWriter) |
| 24 |
FAISS_DECLARE_DESTRUCTOR(IOWriter) |
| 25 |
|
| 26 |
/******************************************************* |
| 27 |
* Custom reader + writer |
| 28 |
* |
| 29 |
* Reader and writer which wraps a function pointer, |
| 30 |
* primarily for FFI use. |
| 31 |
*******************************************************/ |
| 32 |
|
| 33 |
FAISS_DECLARE_CLASS(CustomIOReader) |
| 34 |
FAISS_DECLARE_DESTRUCTOR(CustomIOReader) |
| 35 |
|
| 36 |
int faiss_CustomIOReader_new( |
| 37 |
FaissCustomIOReader** p_out, |
| 38 |
size_t (*func_in)(void* ptr, size_t size, size_t nitems)); |
| 39 |
|
| 40 |
FAISS_DECLARE_CLASS(CustomIOWriter) |
| 41 |
FAISS_DECLARE_DESTRUCTOR(CustomIOWriter) |
| 42 |
|
| 43 |
int faiss_CustomIOWriter_new( |
| 44 |
FaissCustomIOWriter** p_out, |
| 45 |
size_t (*func_in)(const void* ptr, size_t size, size_t nitems)); |
| 46 |
|
| 47 |
#ifdef __cplusplus |
| 48 |
} |
| 49 |
#endif |
| 50 |
#endif |