* @param name the name of the package of which we want the namespace * * @return the namespace of the package * * @throw no_such_namespace */
| 339 | * @throw no_such_namespace |
| 340 | */ |
| 341 | static Environment_Impl namespace_env(const std::string& package){ |
| 342 | Armor<SEXP> env ; |
| 343 | try{ |
| 344 | SEXP getNamespaceSym = Rf_install("getNamespace"); |
| 345 | Shield<SEXP> package_str( Rf_mkString(package.c_str()) ); |
| 346 | Shield<SEXP> call( Rf_lang2(getNamespaceSym, package_str) ); |
| 347 | env = Rcpp_fast_eval(call, R_GlobalEnv); |
| 348 | } catch( ... ){ |
| 349 | throw no_such_namespace( package ) ; |
| 350 | } |
| 351 | return Environment_Impl( env ) ; |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * The parent environment of this environment |
no test coverage detected