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

Method get_function

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

* Returns a list that contains: * - an external pointer that encapsulates a CppFunction* * - voidness of the function (logical) * - docstring (character) * - signature (character) * - formal arguments of the function * * The R code in Module.R uses this information to create a C++Function * object */

Source from the content-addressed store, hash-verified

152 * object
153 */
154 inline SEXP get_function( const std::string& name_ ){
155 MAP::iterator it = functions.begin() ;
156 size_t n = functions.size() ;
157 CppFunction* fun = 0 ;
158 for( size_t i=0; i<n; i++, ++it){
159 if( name_.compare( it->first ) == 0){
160 fun = it->second ;
161 break ;
162 }
163 }
164 std::string sign ;
165 fun->signature( sign, name_.data() ) ;
166 return List::create(
167 XPtr<CppFunction>( fun, false ),
168 fun->is_void(),
169 fun->docstring,
170 sign,
171 fun->get_formals(),
172 fun->nargs()
173 ) ;
174 }
175
176 /**
177 * get the underlying C++ function pointer as a DL_FUNC

Callers 1

RCPP_FUN_2Function · 0.80

Calls 6

beginMethod · 0.45
sizeMethod · 0.45
signatureMethod · 0.45
is_voidMethod · 0.45
get_formalsMethod · 0.45
nargsMethod · 0.45

Tested by

no test coverage detected