Rcpp Version 0.12.12
Na_Proxy.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Romain Francois
2 //
3 // This file is part of Rcpp.
4 //
5 // Rcpp is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // Rcpp is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef Rcpp_Na_Proxy_h
19 #define Rcpp_Na_Proxy_h
20 
21 namespace Rcpp{
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) ; }
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 ; }
32  return Rcpp::traits::is_na<STRSXP>(x.get()) ;
33  }
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) ; }
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 ; }
46  return Rcpp::traits::is_na<STRSXP>(x.get()) ;
47  }
49  return Rcpp::traits::is_na<STRSXP>(x.get()) ;
50  }
51  } ;
52  static Na_Proxy NA ;
53 
55  return LogicalVector::create(
56  _["int"] = NA == NA_INTEGER,
57  _["double"] = NA == NA_REAL,
58  _["string"] = NA == NA_STRING
59  ) ;
60  }
61 }
62 #endif
friend bool operator==(Rcpp::String x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:26
friend bool operator==(double x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:24
friend bool operator==(Rcpp::Na_Proxy, Rcpp::internal::const_string_proxy< STRSXP > x)
Definition: Na_Proxy.h:48
static internal::NamedPlaceHolder _
Definition: Named.h:64
bool is_na< CPLXSXP >(Rcomplex x)
Definition: is_na.h:46
SEXP get_sexp() const
Definition: String.h:367
bool is_na< STRSXP >(SEXP x)
Definition: is_na.h:52
friend bool operator==(std::string, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:29
friend bool operator==(SEXP x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:28
LogicalVector shush_about_NA()
Definition: Na_Proxy.h:54
bool is_na< REALSXP >(double x)
Definition: is_na.h:41
friend bool operator==(Rcpp::Na_Proxy, int x)
Definition: Na_Proxy.h:39
friend bool operator==(Rcpp::internal::string_proxy< STRSXP > x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:31
friend bool operator==(Rcpp::Na_Proxy, double x)
Definition: Na_Proxy.h:38
friend bool operator==(Rcpp::Na_Proxy, Rcpp::String x)
Definition: Na_Proxy.h:40
friend bool operator==(int x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:25
friend bool operator==(Rcpp::internal::const_string_proxy< STRSXP > x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:34
static Vector create()
Definition: Vector.h:1117
static Na_Proxy NA
Definition: Na_Proxy.h:52
friend bool operator==(Rcpp::Na_Proxy, Rcomplex x)
Definition: Na_Proxy.h:42
friend bool operator==(Rcpp::Na_Proxy, std::string)
Definition: Na_Proxy.h:43
friend bool operator==(Rcpp::Na_Proxy, SEXP x)
Definition: Na_Proxy.h:41
friend bool operator==(Rcpp::Na_Proxy, Rcpp::internal::string_proxy< STRSXP > x)
Definition: Na_Proxy.h:45
Rcpp API.
Definition: algo.h:28
friend bool operator==(const char *, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:30
bool is_na< INTSXP >(int x)
Definition: is_na.h:36
friend bool operator==(Rcpp::Na_Proxy, const char *)
Definition: Na_Proxy.h:44
friend bool operator==(Rcomplex x, Rcpp::Na_Proxy)
Definition: Na_Proxy.h:27