In addition to Java-based index structures, it is possible to integrate C++-based indexes as shared libraries into
QuEval as well. To this end, there is the same mechanism to include indexes as for Java making the integration quite intuitive.
How to?
To make the index integration as easy as possible, we implemented a Java/C++ Wrapper using Java Native Interface. There are three steps to integrate a C++ index into
QuEval.
- On the C++ side, you have to inherit from the base class (a clone of the Java abstract class) and implement all virtual methods.
- Copy the compiled sources to /DEST if not already located in that directory.
- Add the name of your index to the global factory function createInstance()*.
*The factory function takes the name of the index that shall be created and returns a pointer to the index. In case no index with the given name could be found or another error occured a null pointer is returned. The mapping of Java and C++ parameters is done by the wrapper, so the programmer does not need any knowlegde of Java Native Interface.
On the Java side, you need to create a simple dummy class which inherits from the class CPP_Wrapper which takes care of calling your C++ functions. The only improtant thing is, that you pass the right name of your C++ index as a string to the parent class CPP_Wrapper. This is necessary, because the framework loads indexes dynamically via reflection and hence the existence of the dummy Java class is crucial.
Example source code
For getting started with the C++ handler, we provide example code implementing a simple sequential scan. The C++ subframework will be provided as a seperate package. The source code will be available soon.
Current limitations and requirements
The current limitations of the C++ handler are the following:
- Plattform dependent: Tested for Linux, should work under Windows with Cygwin (QuEval itself remains plattform independant)