-
Notifications
You must be signed in to change notification settings - Fork 13
/
annoyindexwrapper.h
43 lines (36 loc) · 1.74 KB
/
annoyindexwrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef ANNOYINDEXWRAPPER_H
#define ANNOYINDEXWRAPPER_H
#include <nan.h>
#include "annoylib.h"
class AnnoyIndexWrapper : public Nan::ObjectWrap {
public:
static void Init(v8::Local<v8::Object> exports);
int getDimensions();
AnnoyIndexInterface<int, float> *annoyIndex;
private:
explicit AnnoyIndexWrapper(int dimensions, const char *metricString);
virtual ~AnnoyIndexWrapper();
static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void AddItem(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void Build(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void Save(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void Load(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void Unload(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetItem(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNNSByVector(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNNSByItem(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNItems(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetDistance(const Nan::FunctionCallbackInfo<v8::Value>& info);
static Nan::Persistent<v8::Function> constructor;
static bool getFloatArrayParam(const Nan::FunctionCallbackInfo<v8::Value>& info,
int paramIndex, float *vec);
static void setNNReturnValues(
int numberOfNeighbors, bool includeDistances,
const std::vector<int>& nnIndexes, const std::vector<float>& distances,
const Nan::FunctionCallbackInfo<v8::Value>& info);
static void getSupplementaryGetNNsParams(
const Nan::FunctionCallbackInfo<v8::Value>& info,
int& numberOfNeighbors, int& searchK, bool& includeDistances);
int annoyDimensions;
};
#endif