|
2 | 2 | // |
3 | 3 | // This file is part of Rcpp. |
4 | 4 | // |
5 | | -// Rcppis free software: you can redistribute it and/or modify it |
| 5 | +// Rcpp is free software: you can redistribute it and/or modify it |
6 | 6 | // under the terms of the GNU General Public License as published by |
7 | 7 | // the Free Software Foundation, either version 2 of the License, or |
8 | 8 | // (at your option) any later version. |
|
19 | 19 | #define Rcpp_Na_Proxy_h |
20 | 20 |
|
21 | 21 | namespace Rcpp{ |
22 | | - class Na_Proxy{} ; |
| 22 | + class Na_Proxy{ |
| 23 | + |
| 24 | + friend inline bool operator==(double x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<REALSXP>(x) ; } |
| 25 | + friend inline bool operator==(int x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<INTSXP>(x) ; } |
| 26 | + friend inline bool operator==(Rcpp::String x, Rcpp::Na_Proxy){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; } |
| 27 | + friend inline bool operator==(Rcomplex x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<CPLXSXP>(x) ; } |
| 28 | + friend inline bool operator==(SEXP x , Rcpp::Na_Proxy){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; } |
| 29 | + friend inline bool operator==(std::string , Rcpp::Na_Proxy){ return false ; } |
| 30 | + friend inline bool operator==(const char* , Rcpp::Na_Proxy){ return false ; } |
| 31 | + friend inline bool operator==(Rcpp::internal::string_proxy<STRSXP> x, Rcpp::Na_Proxy){ |
| 32 | + return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
| 33 | + } |
| 34 | + friend inline bool operator==(Rcpp::internal::const_string_proxy<STRSXP> x, Rcpp::Na_Proxy){ |
| 35 | + return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
| 36 | + } |
| 37 | + |
| 38 | + friend inline bool operator==(Rcpp::Na_Proxy, double x ){ return Rcpp::traits::is_na<REALSXP>(x) ; } |
| 39 | + friend inline bool operator==(Rcpp::Na_Proxy, int x ){ return Rcpp::traits::is_na<INTSXP>(x) ; } |
| 40 | + friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::String x ){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; } |
| 41 | + friend inline bool operator==(Rcpp::Na_Proxy, SEXP x ){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; } |
| 42 | + friend inline bool operator==(Rcpp::Na_Proxy, Rcomplex x ){ return Rcpp::traits::is_na<CPLXSXP>(x) ; } |
| 43 | + friend inline bool operator==(Rcpp::Na_Proxy, std::string ){ return false ; } |
| 44 | + friend inline bool operator==(Rcpp::Na_Proxy, const char* ){ return false ; } |
| 45 | + friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::string_proxy<STRSXP> x){ |
| 46 | + return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
| 47 | + } |
| 48 | + friend inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::const_string_proxy<STRSXP> x){ |
| 49 | + return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
| 50 | + } |
| 51 | + } ; |
23 | 52 | static Na_Proxy NA ; |
24 | | -} |
25 | | - |
26 | | -inline bool operator==(double x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<REALSXP>(x) ; } |
27 | | -inline bool operator==(int x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<INTSXP>(x) ; } |
28 | | -inline bool operator==(Rcpp::String x, Rcpp::Na_Proxy){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; } |
29 | | -inline bool operator==(Rcomplex x , Rcpp::Na_Proxy){ return Rcpp::traits::is_na<CPLXSXP>(x) ; } |
30 | | -inline bool operator==(SEXP x , Rcpp::Na_Proxy){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; } |
31 | | -inline bool operator==(std::string , Rcpp::Na_Proxy){ return false ; } |
32 | | -inline bool operator==(const char* , Rcpp::Na_Proxy){ return false ; } |
33 | | -inline bool operator==(Rcpp::internal::string_proxy<STRSXP> x, Rcpp::Na_Proxy){ |
34 | | - return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
35 | | -} |
36 | | -inline bool operator==(Rcpp::internal::const_string_proxy<STRSXP> x, Rcpp::Na_Proxy){ |
37 | | - return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
38 | | -} |
39 | 53 |
|
40 | | -inline bool operator==(Rcpp::Na_Proxy, double x ){ return Rcpp::traits::is_na<REALSXP>(x) ; } |
41 | | -inline bool operator==(Rcpp::Na_Proxy, int x ){ return Rcpp::traits::is_na<INTSXP>(x) ; } |
42 | | -inline bool operator==(Rcpp::Na_Proxy, Rcpp::String x ){ return Rcpp::traits::is_na<STRSXP>(x.get_sexp()) ; } |
43 | | -inline bool operator==(Rcpp::Na_Proxy, SEXP x ){ return TYPEOF(x)==CHARSXP && Rcpp::traits::is_na<STRSXP>(x) ; } |
44 | | -inline bool operator==(Rcpp::Na_Proxy, Rcomplex x ){ return Rcpp::traits::is_na<CPLXSXP>(x) ; } |
45 | | -inline bool operator==(Rcpp::Na_Proxy, std::string ){ return false ; } |
46 | | -inline bool operator==(Rcpp::Na_Proxy, const char* ){ return false ; } |
47 | | -inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::string_proxy<STRSXP> x){ |
48 | | - return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
49 | | -} |
50 | | -inline bool operator==(Rcpp::Na_Proxy, Rcpp::internal::const_string_proxy<STRSXP> x){ |
51 | | - return Rcpp::traits::is_na<STRSXP>(x.get()) ; |
| 54 | + inline LogicalVector shush_about_NA(){ |
| 55 | + return LogicalVector::create( |
| 56 | + _["int"] = NA == NA_INTEGER, |
| 57 | + _["double"] = NA == NA_REAL, |
| 58 | + _["string"] = NA == NA_STRING |
| 59 | + ) ; |
| 60 | + } |
52 | 61 | } |
53 | | - |
54 | 62 | #endif |
0 commit comments