Skip to content

Commit

Permalink
Add namespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jan 2, 2020
1 parent ea1c9d6 commit 751016b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/NN.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#include <cstdlib> // C standard lib defs
#include <iomanip> // I/O manipulators
#include <cmath> // math includes
#include <iostream> // I/O streams
#include <cstring> // C-style strings

#include <math.h> // math routines
#include <ANN/ANN.h> // ANN library header
#include <R.h> // R header

namespace ann2 {

#include <ANN/ANN.h> // ANN library header

}

//------------------------------------------------------------------------------------------------
// Near Neighbours Program
//------------------------------------------------------------------------------------------------
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/ann2.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#include <cstdlib> // C standard lib defs
#include <iomanip> // I/O manipulators
#include <cmath> // math includes
#include <iostream> // I/O streams
#include <cstring> // C-style strings

#ifdef RANN
#include <R.h> // 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"
Expand All @@ -11,3 +24,5 @@
#include "vendor/ann/kd_split.cpp"
#include "vendor/ann/kd_tree.cpp"
#include "vendor/ann/kd_util.cpp"

}

0 comments on commit 751016b

Please sign in to comment.