Rcpp Version 1.0.9
get_na.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2 /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
3 //
4 // get_na.h: Rcpp R/C++ interface class library -- NA handling
5 //
6 // Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
7 //
8 // This file is part of Rcpp.
9 //
10 // Rcpp is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // Rcpp is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef Rcpp__traits__get_na__h
24 #define Rcpp__traits__get_na__h
25 
26 namespace Rcpp{
27 namespace traits{
28 
29 template<int RTYPE>
31 
32 template<>
33 inline int get_na<INTSXP>(){ return NA_INTEGER ; }
34 
35 template<>
36 inline int get_na<LGLSXP>(){ return NA_LOGICAL ; }
37 
38 template<>
39 inline double get_na<REALSXP>(){ return NA_REAL ; }
40 
41 template<>
42 inline Rcomplex get_na<CPLXSXP>(){
43  Rcomplex x ;
44  x.r = NA_REAL ;
45  x.i = NA_REAL ;
46  return x ;
47 }
48 
49 template<>
50 inline SEXP get_na<STRSXP>(){ return NA_STRING ; }
51 
52 // this is the list equivalent of an NA value
53 template<>
54 inline SEXP get_na<VECSXP>(){ return R_NilValue; }
55 
56 }
57 }
58 
59 #endif
double get_na< REALSXP >()
Definition: get_na.h:39
storage_type< RTYPE >::type get_na()
SEXP get_na< STRSXP >()
Definition: get_na.h:50
SEXP get_na< VECSXP >()
Definition: get_na.h:54
int get_na< INTSXP >()
Definition: get_na.h:33
int get_na< LGLSXP >()
Definition: get_na.h:36
Rcomplex get_na< CPLXSXP >()
Definition: get_na.h:42
Rcpp API.
Definition: algo.h:28