| 221 | } |
| 222 | |
| 223 | SEXP invoke_notvoid( SEXP method_xp, SEXP object, SEXP *args, int nargs ){ |
| 224 | BEGIN_RCPP |
| 225 | |
| 226 | vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ; |
| 227 | typename vec_signed_method::iterator it = mets->begin() ; |
| 228 | size_t n = mets->size() ; |
| 229 | method_class* m = 0 ; |
| 230 | bool ok = false ; |
| 231 | for( size_t i=0; i<n; i++, ++it ){ |
| 232 | if( ( (*it)->valid )( args, nargs) ){ |
| 233 | m = (*it)->method ; |
| 234 | ok = true ; |
| 235 | break ; |
| 236 | } |
| 237 | } |
| 238 | if( !ok ){ |
| 239 | throw std::range_error( "could not find valid method" ) ; |
| 240 | } |
| 241 | return m->operator()( XP(object), args ) ; |
| 242 | END_RCPP |
| 243 | } |
| 244 | |
| 245 | |
| 246 | self& AddMethod( const char* name_, method_class* m, ValidMethod valid = &yes, const char* docstring = 0){ |
no test coverage detected