-
-
Notifications
You must be signed in to change notification settings - Fork 591
Closed
Labels
Description
I am trying to write a faiss index to a java output stream. The write_index
method accept an IOWriter struct, and write data using its ()
operator. The generated code contains a super_operator ()
method that fails to compile. Some kind of name escaping seems required for it to work.
void write_index (const Index *idx, IOWriter *writer);
struct IOWriter {
// name that can be used in error messages
std::string name;
// fwrite
virtual size_t operator()(
const void *ptr, size_t size, size_t nitems) = 0;
// return a file number that can be memory-mapped
virtual int fileno ();
virtual ~IOWriter() {}
};
@Namespace("faiss")
@NoOffset
@Properties(@Platform(
link = { "faiss", "gomp" },
preload = "faiss",
include = { "faiss/impl/io.h" }))
public class IOWriter extends Pointer {
static { Loader.load(); }
public IOWriter() { allocate(); }
private native void allocate();
@Cast("size_t")
@Name("operator ()")
@Virtual(true)
public native long apply(@Const Pointer ptr, @Cast("size_t") long size, @Cast("size_t") long nitems);
}
class JavaCPP_hidden JavaCPP_faiss_0003a_0003aIOWriter : public faiss::IOWriter {
public:
jobject obj;
static jmethodID apply__Lorg_bytedeco_javacpp_Pointer_2JJ;
using faiss::IOWriter::operator ();
virtual size_t operator ()(const void* arg0, size_t arg1, size_t arg2);
size_t super_operator ()(const void* arg0, size_t arg1, size_t arg2) { throw JavaCPP_exception("Cannot call pure virtual function faiss::IOWriter::operator ()()."); }
JavaCPP_faiss_0003a_0003aIOWriter() : faiss::IOWriter(), obj(NULL) { }
};