Skip to content

Commit bea30d4

Browse files
move functions to headers
1 parent bedc6af commit bea30d4

3 files changed

Lines changed: 10 additions & 19 deletions

File tree

inst/include/Rcpp/api/meat/is.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ namespace internal{
145145
return TYPEOF(x) == REALSXP && Rf_inherits( x, "POSIXt" ) ;
146146
}
147147

148-
bool is_module_object_internal(SEXP, const char*) ;
148+
inline bool is_module_object_internal(SEXP obj, const char* clazz){
149+
Environment env(obj) ;
150+
XPtr<class_Base> xp( env.get(".cppclass") );
151+
return xp->has_typeinfo_name( clazz ) ;
152+
}
149153
template <typename T> bool is__module__object( SEXP x){
150154
typedef typename Rcpp::traits::un_pointer<T>::type CLASS ;
151155
return is_module_object_internal(x, typeid(CLASS).name() ) ;

inst/include/Rcpp/as.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ namespace Rcpp{
8383
return exporter.get() ;
8484
}
8585

86-
void* as_module_object_internal(SEXP) ;
86+
inline void* as_module_object_internal(SEXP obj) {
87+
Environment env(obj) ;
88+
SEXP xp = env.get(".pointer") ;
89+
return R_ExternalPtrAddr(xp );
90+
}
8791
template <typename T> object<T> as_module_object(SEXP x){
8892
return (T*) as_module_object_internal(x) ;
8993
}

src/Module.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,3 @@ extern "C" void R_init_Rcpp( DllInfo* info){
239239
init_Rcpp_routines(info) ;
240240
}
241241

242-
namespace Rcpp{
243-
244-
namespace internal{
245-
void* as_module_object_internal(SEXP obj){
246-
Environment env(obj) ;
247-
SEXP xp = env.get(".pointer") ;
248-
return R_ExternalPtrAddr(xp );
249-
}
250-
bool is_module_object_internal(SEXP obj, const char* clazz){
251-
Environment env(obj) ;
252-
XPtr<class_Base> xp( env.get(".cppclass") );
253-
return xp->has_typeinfo_name( clazz ) ;
254-
}
255-
}
256-
257-
}
258-

0 commit comments

Comments
 (0)