Skip to content

Commit a40c2ae

Browse files
committed
add Rcpp structure for #9
1 parent cabeecb commit a40c2ae

8 files changed

+63
-0
lines changed

DESCRIPTION

+4
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ Imports:
1717
httr2,
1818
memoise,
1919
pbapply,
20+
Rcpp,
2021
tokenizers
2122
Suggests:
2223
rappdirs,
2324
httptest2,
2425
roxygen2,
2526
testthat (>= 3.0.0),
2627
withr
28+
LinkingTo:
29+
Rcpp
2730
Depends: R (>= 3.5.0)
31+
NeedsCompilation: yes
2832
Encoding: UTF-8
2933
Language: en-GB
3034
Roxygen: list(markdown = TRUE)

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export(pkgsimil_load_data)
88
export(pkgsimil_similar_fns)
99
export(pkgsimil_similar_pkgs)
1010
export(text_is_code)
11+
importFrom(Rcpp,sourceCpp)
1112
importFrom(memoise,memoise)
13+
useDynLib(pkgsimil, .registration = TRUE)

R/RcppExports.R

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
2+
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3+
4+
rcpp_bm25 <- function (idfs, tokens, tokens_i) {
5+
.Call (`_pkgsimil_rcpp_bm25`, idfs, tokens, tokens_i)
6+
}

R/pkgsimil-package.R

+2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
# The following block is used by usethis to automatically manage
77
# roxygen namespace tags. Modify with care!
88
## usethis namespace: start
9+
#' @importFrom Rcpp sourceCpp
10+
#' @useDynLib pkgsimil, .registration = TRUE
911
## usethis namespace: end
1012
NULL

src/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.o
2+
*.so
3+
*.dll

src/RcppExports.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
2+
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3+
4+
#include <Rcpp.h>
5+
6+
using namespace Rcpp;
7+
8+
#ifdef RCPP_USE_GLOBAL_ROSTREAM
9+
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10+
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11+
#endif
12+
13+
// rcpp_bm25
14+
Rcpp::List rcpp_bm25(const Rcpp::DataFrame& idfs, const Rcpp::List& tokens, Rcpp::DataFrame& tokens_i);
15+
RcppExport SEXP _pkgsimil_rcpp_bm25(SEXP idfsSEXP, SEXP tokensSEXP, SEXP tokens_iSEXP) {
16+
BEGIN_RCPP
17+
Rcpp::RObject rcpp_result_gen;
18+
Rcpp::RNGScope rcpp_rngScope_gen;
19+
Rcpp::traits::input_parameter< const Rcpp::DataFrame& >::type idfs(idfsSEXP);
20+
Rcpp::traits::input_parameter< const Rcpp::List& >::type tokens(tokensSEXP);
21+
Rcpp::traits::input_parameter< Rcpp::DataFrame& >::type tokens_i(tokens_iSEXP);
22+
rcpp_result_gen = Rcpp::wrap(rcpp_bm25(idfs, tokens, tokens_i));
23+
return rcpp_result_gen;
24+
END_RCPP
25+
}
26+
27+
static const R_CallMethodDef CallEntries[] = {
28+
{"_pkgsimil_rcpp_bm25", (DL_FUNC) &_pkgsimil_rcpp_bm25, 3},
29+
{NULL, NULL, 0}
30+
};
31+
32+
RcppExport void R_init_pkgsimil(DllInfo *dll) {
33+
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
34+
R_useDynamicSymbols(dll, FALSE);
35+
}

src/bm25.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "bm25.h"
2+
3+
// [[Rcpp::export]]
4+
Rcpp::List rcpp_bm25 (const Rcpp::DataFrame &idfs, const Rcpp::List &tokens, Rcpp::DataFrame &tokens_i) {
5+
return Rcpp::List();
6+
}

src/bm25.h

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#include <Rcpp.h>
4+
5+
Rcpp::List rcpp_bm25 (const Rcpp::DataFrame &idfs, const Rcpp::List &tokens, Rcpp::DataFrame &tokens_i);

0 commit comments

Comments
 (0)