From 751016b7a81f00793a6346869f61c5b9dfa50ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 2 Jan 2020 08:18:02 +0100 Subject: [PATCH] Add namespacing --- src/NN.cc | 15 ++++++++++++++- src/ann2.cpp | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/NN.cc b/src/NN.cc index 6ea6668..b9d71a1 100755 --- a/src/NN.cc +++ b/src/NN.cc @@ -1,7 +1,18 @@ +#include // C standard lib defs +#include // I/O manipulators +#include // math includes +#include // I/O streams +#include // C-style strings + #include // math routines -#include // ANN library header #include // R header +namespace ann2 { + +#include // ANN library header + +} + //------------------------------------------------------------------------------------------------ // Near Neighbours Program //------------------------------------------------------------------------------------------------ @@ -10,6 +21,8 @@ extern "C" void get_NN_2Set(double *data, double *query, int *D, int *ND, int *NQ, int *K, double *EPS, int *SEARCHTYPE, int *USEBDTREE, double *SQRAD, int *nn_index, double *distances) { + using namespace ann2; + const int d = *D; // Number of Dimensions for points const int nd = *ND; // Number of Data points const int nq= *NQ; // Number of Query points diff --git a/src/ann2.cpp b/src/ann2.cpp index 14952cb..091b28f 100644 --- a/src/ann2.cpp +++ b/src/ann2.cpp @@ -1,3 +1,16 @@ +#include // C standard lib defs +#include // I/O manipulators +#include // math includes +#include // I/O streams +#include // C-style strings + +#ifdef RANN +#include // R headers for error handling +#endif + + +namespace ann2 { + #include "vendor/ann/ANN.cpp" #include "vendor/ann/bd_fix_rad_search.cpp" #include "vendor/ann/bd_pr_search.cpp" @@ -11,3 +24,5 @@ #include "vendor/ann/kd_split.cpp" #include "vendor/ann/kd_tree.cpp" #include "vendor/ann/kd_util.cpp" + +}