| 31 | namespace Rcpp{ |
| 32 | |
| 33 | RCPP_API_CLASS(InternalFunction_Impl) { |
| 34 | public: |
| 35 | |
| 36 | RCPP_GENERATE_CTOR_ASSIGN(InternalFunction_Impl) |
| 37 | |
| 38 | template <typename RESULT_TYPE, typename... Args> |
| 39 | InternalFunction_Impl(const std::function<RESULT_TYPE(Args...)> &fun) { |
| 40 | set( |
| 41 | XPtr<Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...> >( |
| 42 | new Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...>(fun), |
| 43 | false |
| 44 | ) |
| 45 | ); |
| 46 | } |
| 47 | template <typename RESULT_TYPE, typename... T> |
| 48 | InternalFunction_Impl(RESULT_TYPE (*fun)(T...)) { |
| 49 | set(XPtr<CppFunctionN<RESULT_TYPE, T...> >(new CppFunctionN<RESULT_TYPE, T...>(fun), true)); |
| 50 | } |
| 51 | |
| 52 | void update(SEXP){} |
| 53 | private: |
| 54 | |
| 55 | inline void set( SEXP xp){ |
| 56 | Environment RCPP = Environment::Rcpp_namespace() ; |
| 57 | Function intf = RCPP["internal_function"] ; |
| 58 | Storage::set__( intf( xp ) ) ; |
| 59 | } |
| 60 | |
| 61 | }; |
| 62 |
nothing calls this directly
no test coverage detected