|
Rcpp Version 0.9.10
|
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 00002 // 00003 // logical_operators__Vector__Vector.h: Rcpp R/C++ interface class library -- 00004 // logical operators for Vector to Vector comparisons 00005 // 00006 // Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois 00007 // 00008 // This file is part of Rcpp. 00009 // 00010 // Rcpp is free software: you can redistribute it and/or modify it 00011 // under the terms of the GNU General Public License as published by 00012 // the Free Software Foundation, either version 2 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // Rcpp is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 00022 00023 #ifndef Rcpp__sugar__logical_operators__Vector__Vector_h 00024 #define Rcpp__sugar__logical_operators__Vector__Vector_h 00025 00026 /* Vector < Vector */ 00027 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00028 inline Rcpp::sugar::Comparator< 00029 RTYPE , 00030 Rcpp::sugar::less<RTYPE>, 00031 LHS_NA, LHS_T, 00032 RHS_NA, RHS_T 00033 > 00034 operator<( 00035 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00036 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00037 ){ 00038 return Rcpp::sugar::Comparator< 00039 RTYPE, 00040 Rcpp::sugar::less<RTYPE>, 00041 LHS_NA, LHS_T, 00042 RHS_NA, RHS_T 00043 >( 00044 lhs, rhs 00045 ) ; 00046 } 00047 /* Vector > Vector */ 00048 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00049 inline Rcpp::sugar::Comparator< 00050 RTYPE , 00051 Rcpp::sugar::greater<RTYPE>, 00052 LHS_NA, LHS_T, 00053 RHS_NA, RHS_T 00054 > 00055 operator>( 00056 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00057 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00058 ){ 00059 return Rcpp::sugar::Comparator< 00060 RTYPE, 00061 Rcpp::sugar::greater<RTYPE>, 00062 LHS_NA, LHS_T, 00063 RHS_NA, RHS_T 00064 >( 00065 lhs, rhs 00066 ) ; 00067 } 00068 /* Vector <= Vector */ 00069 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00070 inline Rcpp::sugar::Comparator< 00071 RTYPE , 00072 Rcpp::sugar::less_or_equal<RTYPE>, 00073 LHS_NA, LHS_T, 00074 RHS_NA, RHS_T 00075 > 00076 operator<=( 00077 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00078 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00079 ){ 00080 return Rcpp::sugar::Comparator< 00081 RTYPE, 00082 Rcpp::sugar::less_or_equal<RTYPE>, 00083 LHS_NA, LHS_T, 00084 RHS_NA, RHS_T 00085 >( 00086 lhs, rhs 00087 ) ; 00088 } 00089 /* Vector >= Vector */ 00090 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00091 inline Rcpp::sugar::Comparator< 00092 RTYPE , 00093 Rcpp::sugar::greater_or_equal<RTYPE>, 00094 LHS_NA, LHS_T, 00095 RHS_NA, RHS_T 00096 > 00097 operator>=( 00098 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00099 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00100 ){ 00101 return Rcpp::sugar::Comparator< 00102 RTYPE, 00103 Rcpp::sugar::greater_or_equal<RTYPE>, 00104 LHS_NA, LHS_T, 00105 RHS_NA, RHS_T 00106 >( 00107 lhs, rhs 00108 ) ; 00109 } 00110 /* Vector == Vector */ 00111 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00112 inline Rcpp::sugar::Comparator< 00113 RTYPE , 00114 Rcpp::sugar::equal<RTYPE>, 00115 LHS_NA, LHS_T, 00116 RHS_NA, RHS_T 00117 > 00118 operator==( 00119 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00120 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00121 ){ 00122 return Rcpp::sugar::Comparator< 00123 RTYPE, 00124 Rcpp::sugar::equal<RTYPE>, 00125 LHS_NA, LHS_T, 00126 RHS_NA, RHS_T 00127 >( 00128 lhs, rhs 00129 ) ; 00130 } 00131 /* Vector != Vector */ 00132 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 00133 inline Rcpp::sugar::Comparator< 00134 RTYPE , 00135 Rcpp::sugar::not_equal<RTYPE>, 00136 LHS_NA, LHS_T, 00137 RHS_NA, RHS_T 00138 > 00139 operator!=( 00140 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 00141 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 00142 ){ 00143 return Rcpp::sugar::Comparator< 00144 RTYPE, 00145 Rcpp::sugar::not_equal<RTYPE>, 00146 LHS_NA, LHS_T, 00147 RHS_NA, RHS_T 00148 >( 00149 lhs, rhs 00150 ) ; 00151 } 00152 00153 #endif