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

Method invoke

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

Source from the content-addressed store, hash-verified

172 }
173
174 SEXP invoke( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
175 BEGIN_RCPP
176
177 vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
178 typename vec_signed_method::iterator it = mets->begin() ;
179 size_t n = mets->size() ;
180 method_class* m = 0 ;
181 bool ok = false ;
182 for( size_t i=0; i<n; i++, ++it ){
183 if( ( (*it)->valid )( args, nargs) ){
184 m = (*it)->method ;
185 ok = true ;
186 break ;
187 }
188 }
189 if( !ok ){
190 throw std::range_error( "could not find valid method" ) ;
191 }
192 if( m->is_void() ){
193 m->operator()( XP(object), args );
194 return Rcpp::List::create( true ) ;
195 } else {
196 return Rcpp::List::create( false, m->operator()( XP(object), args ) ) ;
197 }
198 END_RCPP
199 }
200
201 SEXP invoke_void( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
202 BEGIN_RCPP

Callers 2

Module__invokeFunction · 0.45
CppMethod__invokeFunction · 0.45

Calls 4

beginMethod · 0.45
sizeMethod · 0.45
is_voidMethod · 0.45
operator()Method · 0.45

Tested by

no test coverage detected