MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / invoke

Method invoke

inst/include/Rcpp/module/Module.h:53–67  ·  view source on GitHub ↗

* calls a function from that module with the specified arguments * * @param name the name of the function to call * @param args an array of R objects to use as arguments for the function * @param nargs number of arguments */

Source from the content-addressed store, hash-verified

51 * @param nargs number of arguments
52 */
53 inline SEXP invoke( const std::string& name_, SEXP* args, int nargs){ // #nocov start
54 MAP::iterator it = functions.find( name_ );
55 if( it == functions.end() ){
56 throw std::range_error( "no such function" ) ;
57 }
58 CppFunction* fun = it->second ;
59 if( fun->nargs() > nargs ){
60 throw std::range_error( "incorrect number of arguments" ) ;
61 }
62
63 return List::create(
64 _["result"] = fun->operator()( args ),
65 _["void"] = fun->is_void()
66 ) ;
67 }
68
69 /**
70 * vector of arity of all the functions exported by the module

Callers

nothing calls this directly

Calls 4

endMethod · 0.45
nargsMethod · 0.45
operator()Method · 0.45
is_voidMethod · 0.45

Tested by

no test coverage detected