* 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 */
| 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 |
nothing calls this directly
no test coverage detected