22 #ifndef Rcpp_api_meat_is_h
23 #define Rcpp_api_meat_is_h
28 inline bool is_atomic(SEXP x) {
return Rf_length(x) == 1; }
30 SEXP dim = Rf_getAttrib( x, R_DimSymbol);
31 return dim != R_NilValue && Rf_length(dim) == 2;
34 return is_atomic(x) && TYPEOF(x) == INTSXP;
37 return is_atomic(x) && TYPEOF(x) == REALSXP;
40 return is_atomic(x) && TYPEOF(x) == LGLSXP;
42 template <>
inline bool is__simple<std::string>(SEXP x) {
43 return is_atomic(x) && TYPEOF(x) == STRSXP;
46 return is_atomic(x) && TYPEOF(x) == STRSXP;
49 return is_atomic(x) && TYPEOF(x) == CPLXSXP;
52 return TYPEOF(x) == STRSXP;
55 return TYPEOF(x) == STRSXP &&
is_matrix(x);
61 return TYPEOF(x) == INTSXP;
64 return TYPEOF(x) == CPLXSXP;
67 return TYPEOF(x) == RAWSXP;
70 return TYPEOF(x) == REALSXP;
73 return TYPEOF(x) == LGLSXP;
76 return TYPEOF(x) == LANGSXP;
79 return (TYPEOF(x) == LANGSXP) || (TYPEOF(x) == LISTSXP);
82 return TYPEOF(x) == VECSXP;
85 return TYPEOF(x) == INTSXP &&
is_matrix(x);
88 return TYPEOF(x) == CPLXSXP &&
is_matrix(x);
91 return TYPEOF(x) == RAWSXP &&
is_matrix(x);
94 return TYPEOF(x) == REALSXP &&
is_matrix(x);
97 return TYPEOF(x) == LGLSXP &&
is_matrix(x);
100 return TYPEOF(x) == VECSXP &&
is_matrix(x);
105 if( TYPEOF(x) != VECSXP )
return false;
106 return Rf_inherits( x,
"data.frame" );
109 return TYPEOF(x) == WEAKREFSXP;
112 return TYPEOF(x) == SYMSXP;
118 if( ! ::Rf_isS4(x) )
return false;
119 return ::Rf_inherits(x,
"envRefClass" );
122 return TYPEOF(x) == PROMSXP;
125 return TYPEOF(x) == LISTSXP;
128 return TYPEOF(x) == CLOSXP || TYPEOF(x) == SPECIALSXP || TYPEOF(x) == BUILTINSXP;
131 return TYPEOF(x) == ENVSXP;
134 if( TYPEOF(x) != LANGSXP )
return false;
135 return Rf_inherits(x,
"formula");
139 return is_atomic(x) && TYPEOF(x) == REALSXP && Rf_inherits(x,
"Date");
142 return is_atomic(x) && TYPEOF(x) == REALSXP && Rf_inherits(x,
"POSIXt");
145 return TYPEOF(x) == REALSXP && Rf_inherits(x,
"Date");
148 return TYPEOF(x) == REALSXP && Rf_inherits(x,
"POSIXt");
151 #ifndef RCPP_NO_MODULES
155 SEXP sexp = env.get(
".cppclass");
156 if (TYPEOF(sexp) != EXTPTRSXP)
return false;
158 return xp->has_typeinfo_name(clazz);
bool is__simple< LogicalVector >(SEXP x)
bool is__simple< Symbol >(SEXP x)
bool is__simple< int >(SEXP x)
bool is__simple< CharacterVector >(SEXP x)
bool is__simple< String >(SEXP x)
bool is__simple< Reference >(SEXP x)
bool is__simple< ComplexMatrix >(SEXP x)
bool is__simple< Datetime >(SEXP x)
bool is__simple< CharacterMatrix >(SEXP x)
bool is__simple< List >(SEXP x)
bool is__simple< Environment >(SEXP x)
bool is__simple< RObject >(SEXP)
bool is__simple< DataFrame >(SEXP x)
bool is__simple< Formula >(SEXP x)
bool is__simple< DateVector >(SEXP x)
bool is__simple< Pairlist >(SEXP x)
bool is__simple< WeakReference >(SEXP x)
bool is__simple< double >(SEXP x)
bool is__simple< bool >(SEXP x)
bool is__simple< IntegerMatrix >(SEXP x)
bool is__simple< Function >(SEXP x)
bool is__simple< DatetimeVector >(SEXP x)
bool is__simple< NumericVector >(SEXP x)
bool is__simple< IntegerVector >(SEXP x)
bool is__simple< LogicalMatrix >(SEXP x)
bool is__simple< RawVector >(SEXP x)
bool is__simple< DottedPair >(SEXP x)
bool is__simple< Language >(SEXP x)
bool is__simple< Rcomplex >(SEXP x)
bool is__simple< ComplexVector >(SEXP x)
bool is__simple< Date >(SEXP x)
bool is__simple< S4 >(SEXP x)
bool is__simple< RawMatrix >(SEXP x)
bool is_module_object_internal(SEXP obj, const char *clazz)
bool is__simple< NumericMatrix >(SEXP x)
bool is__simple< Promise >(SEXP x)
bool is__simple< GenericMatrix >(SEXP x)
bool is__module__object(SEXP x)
Environment_Impl< PreserveStorage > Environment