Skip to content

Commit 88de0a1

Browse files
committed
Split CppFunction into CppFunctionBase (for use with InternalFunction) and CppFunction (for use in a Module)
1 parent 3d9e34e commit 88de0a1

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

inst/include/Rcpp/module/CppFunction.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424

2525
namespace Rcpp {
2626

27-
/**
28-
* base class of all exported C++ functions. Template deduction in the
29-
* Module_generated_function.h file creates an instance of a class that
30-
* derives CppFunction (see Module_generated_CppFunction.h fr all the
31-
* definitions
32-
*/
33-
class CppFunction {
34-
public:
35-
CppFunction(const char* doc = 0) : docstring( doc == 0 ? "" : doc) {}
27+
/**
28+
* base class for a callable function. This limited functionality is
29+
* just barely enough for an InternalFunction, nothing more.
30+
*/
31+
class CppFunctionBase {
32+
public:
33+
CppFunctionBase() {}
34+
virtual ~CppFunctionBase(){} ;
3635

3736
/**
3837
* modules call the function with this interface. input: an array of SEXP
@@ -41,6 +40,18 @@ namespace Rcpp {
4140
virtual SEXP operator()(SEXP*) {
4241
return R_NilValue ;
4342
}
43+
44+
};
45+
46+
/**
47+
* base class of all exported C++ functions. Template deduction in the
48+
* Module_generated_function.h file creates an instance of a class that
49+
* derives CppFunction (see Module_generated_CppFunction.h for all the
50+
* definitions
51+
*/
52+
class CppFunction : public CppFunctionBase {
53+
public:
54+
CppFunction(const char* doc = 0) : docstring( doc == 0 ? "" : doc) {}
4455
virtual ~CppFunction(){} ;
4556

4657
/**

src/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
typedef Rcpp::XPtr<Rcpp::Module> XP_Module ;
2828
typedef Rcpp::XPtr<Rcpp::class_Base> XP_Class ;
29-
typedef Rcpp::XPtr<Rcpp::CppFunction> XP_Function ;
29+
typedef Rcpp::XPtr<Rcpp::CppFunctionBase> XP_Function ;
3030

3131
RCPP_FUN_1( bool, Class__has_default_constructor, XP_Class cl ){
3232
return cl->has_default_constructor() ;

0 commit comments

Comments
 (0)