/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.12
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */

// source: n2gomodule.i

#define SWIGMODULE n2

#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
  struct SwigMovePointer {
    T *ptr;
    SwigMovePointer(T *p) : ptr(p) { }
    ~SwigMovePointer() { delete ptr; }
    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  } pointer;
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
  SwigValueWrapper() : pointer(0) { }
  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  operator T&() const { return *pointer.ptr; }
  T *operator&() { return pointer.ptr; }
};

template <typename T> T SwigValueInit() {
  return T();
}
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__))
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__))
# else
#   define SWIGUNUSED
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif

/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif


#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>



typedef long long intgo;
typedef unsigned long long uintgo;


# if !defined(__clang__) && (defined(__i386__) || defined(__x86_64__))
#   define SWIGSTRUCTPACKED __attribute__((__packed__, __gcc_struct__))
# else
#   define SWIGSTRUCTPACKED __attribute__((__packed__))
# endif



typedef struct { char *p; intgo n; } _gostring_;
typedef struct { void* array; intgo len; intgo cap; } _goslice_;




#define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1];
#define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n)

swiggo_size_assert(char, 1)
swiggo_size_assert(short, 2)
swiggo_size_assert(int, 4)
typedef long long swiggo_long_long;
swiggo_size_assert(swiggo_long_long, 8)
swiggo_size_assert(float, 4)
swiggo_size_assert(double, 8)

#ifdef __cplusplus
extern "C" {
#endif
extern void crosscall2(void (*fn)(void *, int), void *, int);
extern char* _cgo_topofstack(void) __attribute__ ((weak));
extern void _cgo_allocate(void *, int);
extern void _cgo_panic(void *, int);
#ifdef __cplusplus
}
#endif

static char *_swig_topofstack() {
  if (_cgo_topofstack) {
    return _cgo_topofstack();
  } else {
    return 0;
  }
}

static void _swig_gopanic(const char *p) {
  struct {
    const char *p;
  } SWIGSTRUCTPACKED a;
  a.p = p;
  crosscall2(_cgo_panic, &a, (int) sizeof a);
}




#define SWIG_contract_assert(expr, msg) \
  if (!(expr)) { _swig_gopanic(msg); } else


static void Swig_free(void* p) {
  free(p);
}

static void* Swig_malloc(int c) {
  return malloc(c);
}


#include "n2gomodule.h"
#include <vector>


#ifdef __cplusplus
extern "C" {
#endif

void _wrap_Swig_free_n2_ab9ec64a84e85a64(void *_swig_go_0) {
  void *arg1 = (void *) 0 ;
  
  arg1 = *(void **)&_swig_go_0; 
  
  Swig_free(arg1);
  
}


void *_wrap_Swig_malloc_n2_ab9ec64a84e85a64(intgo _swig_go_0) {
  int arg1 ;
  void *result = 0 ;
  void *_swig_go_result;
  
  arg1 = (int)_swig_go_0; 
  
  result = (void *)Swig_malloc(arg1);
  *(void **)&_swig_go_result = (void *)result; 
  return _swig_go_result;
}


n2::HnswIndex *_wrap_new_HnswIndex__SWIG_0_n2_ab9ec64a84e85a64(intgo _swig_go_0) {
  int arg1 ;
  n2::HnswIndex *result = 0 ;
  n2::HnswIndex *_swig_go_result;
  
  arg1 = (int)_swig_go_0; 
  
  result = (n2::HnswIndex *)new n2::HnswIndex(arg1);
  *(n2::HnswIndex **)&_swig_go_result = (n2::HnswIndex *)result; 
  return _swig_go_result;
}


n2::HnswIndex *_wrap_new_HnswIndex__SWIG_1_n2_ab9ec64a84e85a64(intgo _swig_go_0, _gostring_ _swig_go_1) {
  int arg1 ;
  char *arg2 = (char *) 0 ;
  n2::HnswIndex *result = 0 ;
  n2::HnswIndex *_swig_go_result;
  
  arg1 = (int)_swig_go_0; 
  
  arg2 = (char *)calloc((((_gostring_)_swig_go_1).n + 1), sizeof(char));
  strncpy(arg2, (((_gostring_)_swig_go_1).p), ((_gostring_)_swig_go_1).n);
  
  
  result = (n2::HnswIndex *)new n2::HnswIndex(arg1,(char const *)arg2);
  *(n2::HnswIndex **)&_swig_go_result = (n2::HnswIndex *)result; 
  
  free(arg2);
  
  return _swig_go_result;
}


void _wrap_delete_HnswIndex_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  delete arg1;
  
}


void _wrap_HnswIndex_Build_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, intgo _swig_go_1, intgo _swig_go_2, intgo _swig_go_3, intgo _swig_go_4, float _swig_go_5, _gostring_ _swig_go_6, _gostring_ _swig_go_7) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  int arg5 ;
  float arg6 ;
  char *arg7 = (char *) 0 ;
  char *arg8 = (char *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  arg2 = (int)_swig_go_1; 
  arg3 = (int)_swig_go_2; 
  arg4 = (int)_swig_go_3; 
  arg5 = (int)_swig_go_4; 
  arg6 = (float)_swig_go_5; 
  
  arg7 = (char *)calloc((((_gostring_)_swig_go_6).n + 1), sizeof(char));
  strncpy(arg7, (((_gostring_)_swig_go_6).p), ((_gostring_)_swig_go_6).n);
  
  
  arg8 = (char *)calloc((((_gostring_)_swig_go_7).n + 1), sizeof(char));
  strncpy(arg8, (((_gostring_)_swig_go_7).p), ((_gostring_)_swig_go_7).n);
  
  
  (arg1)->Build(arg2,arg3,arg4,arg5,arg6,(char const *)arg7,(char const *)arg8);
  
  
  free(arg7);
  
  
  free(arg8);
  
}


bool _wrap_HnswIndex_SaveModel_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _gostring_ _swig_go_1) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  char *arg2 = (char *) 0 ;
  bool result;
  bool _swig_go_result;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  arg2 = (char *)calloc((((_gostring_)_swig_go_1).n + 1), sizeof(char));
  strncpy(arg2, (((_gostring_)_swig_go_1).p), ((_gostring_)_swig_go_1).n);
  
  
  result = (bool)(arg1)->SaveModel((char const *)arg2);
  _swig_go_result = result; 
  
  free(arg2);
  
  return _swig_go_result;
}


bool _wrap_HnswIndex_LoadModel__SWIG_0_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _gostring_ _swig_go_1) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  char *arg2 = (char *) 0 ;
  bool result;
  bool _swig_go_result;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  arg2 = (char *)calloc((((_gostring_)_swig_go_1).n + 1), sizeof(char));
  strncpy(arg2, (((_gostring_)_swig_go_1).p), ((_gostring_)_swig_go_1).n);
  
  
  result = (bool)(arg1)->LoadModel((char const *)arg2);
  _swig_go_result = result; 
  
  free(arg2);
  
  return _swig_go_result;
}


bool _wrap_HnswIndex_LoadModel__SWIG_1_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _gostring_ _swig_go_1, bool _swig_go_2) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  char *arg2 = (char *) 0 ;
  bool arg3 ;
  bool result;
  bool _swig_go_result;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  arg2 = (char *)calloc((((_gostring_)_swig_go_1).n + 1), sizeof(char));
  strncpy(arg2, (((_gostring_)_swig_go_1).p), ((_gostring_)_swig_go_1).n);
  
  arg3 = (bool)_swig_go_2; 
  
  result = (bool)(arg1)->LoadModel((char const *)arg2,arg3);
  _swig_go_result = result; 
  
  free(arg2);
  
  return _swig_go_result;
}


void _wrap_HnswIndex_UnloadModel_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  (arg1)->UnloadModel();
  
}


void _wrap_HnswIndex_AddData_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _goslice_ _swig_go_1) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  std::vector< float > arg2 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  float *v;
  std::vector<float> w;
  v = (float *)_swig_go_1.array;
  for (int i = 0; i < _swig_go_1.len; i++) {
    w.push_back(v[i]);
  }
  arg2 = w;
  
  
  (arg1)->AddData(arg2);
  
}


void _wrap_HnswIndex_SearchByVector__SWIG_0_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _goslice_ _swig_go_1, intgo _swig_go_2, intgo _swig_go_3, _goslice_* _swig_go_4) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  std::vector< float > arg2 ;
  int arg3 ;
  int arg4 ;
  std::vector< int > *arg5 = (std::vector< int > *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  float *v;
  std::vector<float> w;
  v = (float *)_swig_go_1.array;
  for (int i = 0; i < _swig_go_1.len; i++) {
    w.push_back(v[i]);
  }
  arg2 = w;
  
  arg3 = (int)_swig_go_2; 
  arg4 = (int)_swig_go_3; 
  
  arg5 = new std::vector<int>();
  
  
  (arg1)->SearchByVector(arg2,arg3,arg4,arg5);
  
  
  {
    _swig_go_4->len = arg5->size();
    _swig_go_4->cap = arg5->size();
    _swig_go_4->array = malloc(_swig_go_4->len * sizeof(intgo));
    for (int i = 0; i < arg5->size(); i++) {
      ((intgo *)_swig_go_4->array)[i] = (intgo)(*arg5)[i];
    }
  }
  
  
  delete arg5;
  
}


void _wrap_HnswIndex_SearchByVector__SWIG_1_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, _goslice_ _swig_go_1, intgo _swig_go_2, intgo _swig_go_3, _goslice_* _swig_go_4, _goslice_* _swig_go_5) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  std::vector< float > arg2 ;
  int arg3 ;
  int arg4 ;
  std::vector< int > *arg5 = (std::vector< int > *) 0 ;
  std::vector< float > *arg6 = (std::vector< float > *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  float *v;
  std::vector<float> w;
  v = (float *)_swig_go_1.array;
  for (int i = 0; i < _swig_go_1.len; i++) {
    w.push_back(v[i]);
  }
  arg2 = w;
  
  arg3 = (int)_swig_go_2; 
  arg4 = (int)_swig_go_3; 
  
  arg5 = new std::vector<int>();
  
  
  arg6 = new std::vector<float>();
  
  
  (arg1)->SearchByVector(arg2,arg3,arg4,arg5,arg6);
  
  
  {
    _swig_go_4->len = arg5->size();
    _swig_go_4->cap = arg5->size();
    _swig_go_4->array = malloc(_swig_go_4->len * sizeof(intgo));
    for (int i = 0; i < arg5->size(); i++) {
      ((intgo *)_swig_go_4->array)[i] = (intgo)(*arg5)[i];
    }
  }
  
  
  {
    _swig_go_5->len = arg6->size();
    _swig_go_5->cap = arg6->size();
    _swig_go_5->array = malloc(_swig_go_5->len * sizeof(float));
    for (int i = 0; i < arg6->size(); i++) {
      ((float *)_swig_go_5->array)[i] = (float)(*arg6)[i];
    }
  }
  
  
  delete arg5;
  
  
  delete arg6;
  
}


void _wrap_HnswIndex_SearchById__SWIG_0_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, intgo _swig_go_1, intgo _swig_go_2, intgo _swig_go_3, _goslice_* _swig_go_4) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  std::vector< int > *arg5 = (std::vector< int > *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  arg2 = (int)_swig_go_1; 
  arg3 = (int)_swig_go_2; 
  arg4 = (int)_swig_go_3; 
  
  arg5 = new std::vector<int>();
  
  
  (arg1)->SearchById(arg2,arg3,arg4,arg5);
  
  
  {
    _swig_go_4->len = arg5->size();
    _swig_go_4->cap = arg5->size();
    _swig_go_4->array = malloc(_swig_go_4->len * sizeof(intgo));
    for (int i = 0; i < arg5->size(); i++) {
      ((intgo *)_swig_go_4->array)[i] = (intgo)(*arg5)[i];
    }
  }
  
  
  delete arg5;
  
}


void _wrap_HnswIndex_SearchById__SWIG_1_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0, intgo _swig_go_1, intgo _swig_go_2, intgo _swig_go_3, _goslice_* _swig_go_4, _goslice_* _swig_go_5) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  std::vector< int > *arg5 = (std::vector< int > *) 0 ;
  std::vector< float > *arg6 = (std::vector< float > *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  arg2 = (int)_swig_go_1; 
  arg3 = (int)_swig_go_2; 
  arg4 = (int)_swig_go_3; 
  
  arg5 = new std::vector<int>();
  
  
  arg6 = new std::vector<float>();
  
  
  (arg1)->SearchById(arg2,arg3,arg4,arg5,arg6);
  
  
  {
    _swig_go_4->len = arg5->size();
    _swig_go_4->cap = arg5->size();
    _swig_go_4->array = malloc(_swig_go_4->len * sizeof(intgo));
    for (int i = 0; i < arg5->size(); i++) {
      ((intgo *)_swig_go_4->array)[i] = (intgo)(*arg5)[i];
    }
  }
  
  
  {
    _swig_go_5->len = arg6->size();
    _swig_go_5->cap = arg6->size();
    _swig_go_5->array = malloc(_swig_go_5->len * sizeof(float));
    for (int i = 0; i < arg6->size(); i++) {
      ((float *)_swig_go_5->array)[i] = (float)(*arg6)[i];
    }
  }
  
  
  delete arg5;
  
  
  delete arg6;
  
}


void _wrap_HnswIndex_PrintDegreeDist_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  (arg1)->PrintDegreeDist();
  
}


void _wrap_HnswIndex_PrintConfigs_n2_ab9ec64a84e85a64(n2::HnswIndex *_swig_go_0) {
  n2::HnswIndex *arg1 = (n2::HnswIndex *) 0 ;
  
  arg1 = *(n2::HnswIndex **)&_swig_go_0; 
  
  (arg1)->PrintConfigs();
  
}


#ifdef __cplusplus
}
#endif

