[Rcpp-commits] r1563 - pkg/Rcpp/inst/include/Rcpp/sugar

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 17 11:50:57 CEST 2010


Author: romain
Date: 2010-06-17 11:50:56 +0200 (Thu, 17 Jun 2010)
New Revision: 1563

Added:
   pkg/Rcpp/inst/include/Rcpp/sugar/Comparator.h
   pkg/Rcpp/inst/include/Rcpp/sugar/Comparator_With_One_Value.h
Modified:
   pkg/Rcpp/inst/include/Rcpp/sugar/logical_operators.h
   pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h
Log:
moving Comparator in its own file

Added: pkg/Rcpp/inst/include/Rcpp/sugar/Comparator.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/Comparator.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/Comparator.h	2010-06-17 09:50:56 UTC (rev 1563)
@@ -0,0 +1,55 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// LessThan.h: Rcpp R/C++ interface class library -- vector operators
+//                                                                      
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef Rcpp__sugar__Comparator_h
+#define Rcpp__sugar__Comparator_h
+
+namespace Rcpp{
+namespace sugar{
+
+template <int RTYPE, typename Operator>
+class Comparator : public LogicalResult< Comparator<RTYPE,Operator> > {
+public:
+	typedef Vector<RTYPE> VEC ;
+	typedef typename traits::storage_type<RTYPE>::type STORAGE ;
+	typedef r_binary_op<RTYPE,Operator> R_OPERATOR ;
+	
+	Comparator( const VEC& lhs_, const VEC& rhs_) : 
+		op(), lhs(lhs_), rhs(rhs_){}
+	
+	inline int operator[]( int i ) const {
+		return op.compare( lhs[i], rhs[i] ) ;
+	}
+	
+	inline int size() const { return lhs.size() ; }
+	
+private:
+	R_OPERATOR op ;
+	const VEC& lhs ;
+	const VEC& rhs ;
+	
+} ;
+
+}
+}
+
+
+#endif

Added: pkg/Rcpp/inst/include/Rcpp/sugar/Comparator_With_One_Value.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/Comparator_With_One_Value.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/Comparator_With_One_Value.h	2010-06-17 09:50:56 UTC (rev 1563)
@@ -0,0 +1,57 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// LessThan.h: Rcpp R/C++ interface class library -- vector operators
+//                                                                      
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef Rcpp__sugar__Comparator_With_One_Value_h
+#define Rcpp__sugar__Comparator_With_One_Value_h
+
+namespace Rcpp{
+namespace sugar{
+
+template <int RTYPE, typename Operator>
+class Comparator_With_One_Value : public LogicalResult< Comparator_With_One_Value<RTYPE,Operator> > {
+public:
+	typedef Vector<RTYPE> VEC ;
+	typedef typename traits::storage_type<RTYPE>::type STORAGE ;
+	typedef r_binary_op<RTYPE,Operator> R_OPERATOR ;
+	
+	Comparator_With_One_Value( const VEC& lhs_, STORAGE rhs_ ) : 
+		op(), lhs(lhs_), rhs(rhs_){}
+	
+	inline int operator[]( int i ) const {
+		return op.compare( lhs[i], rhs ) ;
+	}
+	
+	inline int size() const { return lhs.size() ; }
+	
+private:
+	R_OPERATOR op ;
+	const VEC& lhs ;
+	STORAGE rhs ;
+} ;
+
+} // sugar
+} // Rcpp
+
+
+
+
+
+#endif

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/logical_operators.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/logical_operators.h	2010-06-17 09:47:23 UTC (rev 1562)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/logical_operators.h	2010-06-17 09:50:56 UTC (rev 1563)
@@ -22,60 +22,6 @@
 #ifndef Rcpp__sugar__logical_operators_h
 #define Rcpp__sugar__logical_operators_h
 
-namespace Rcpp{
-namespace sugar{
-
-template <int RTYPE, typename Operator>
-class Comparator : public LogicalResult< Comparator<RTYPE,Operator> > {
-public:
-	typedef Vector<RTYPE> VEC ;
-	typedef typename traits::storage_type<RTYPE>::type STORAGE ;
-	typedef r_binary_op<RTYPE,Operator> R_OPERATOR ;
-	
-	Comparator( const VEC& lhs_, const VEC& rhs_) : 
-		op(), lhs(lhs_), rhs(rhs_){}
-	
-	inline int operator[]( int i ) const {
-		return op.compare( lhs[i], rhs[i] ) ;
-	}
-	
-	inline int size() const { return lhs.size() ; }
-	
-private:
-	R_OPERATOR op ;
-	const VEC& lhs ;
-	const VEC& rhs ;
-	
-} ;
-
-template <int RTYPE, typename Operator>
-class Comparator_With_One_Value : public LogicalResult< Comparator_With_One_Value<RTYPE,Operator> > {
-public:
-	typedef Vector<RTYPE> VEC ;
-	typedef typename traits::storage_type<RTYPE>::type STORAGE ;
-	typedef r_binary_op<RTYPE,Operator> R_OPERATOR ;
-	
-	Comparator_With_One_Value( const VEC& lhs_, STORAGE rhs_ ) : 
-		op(), lhs(lhs_), rhs(rhs_){}
-	
-	inline int operator[]( int i ) const {
-		return op.compare( lhs[i], rhs ) ;
-	}
-	
-	inline int size() const { return lhs.size() ; }
-	
-private:
-	R_OPERATOR op ;
-	const VEC& lhs ;
-	STORAGE rhs ;
-} ;
-
-
-
-} // sugar
-} // Rcpp
-
-
 /* Vector op Vector */
 template <int RTYPE>
 inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::less<RTYPE> > 

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h	2010-06-17 09:47:23 UTC (rev 1562)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h	2010-06-17 09:50:56 UTC (rev 1563)
@@ -25,6 +25,9 @@
 // implementations
 #include <Rcpp/sugar/any.h>
 #include <Rcpp/sugar/all.h>
+
+#include <Rcpp/sugar/Comparator.h>
+#include <Rcpp/sugar/Comparator_With_One_Value.h>
 #include <Rcpp/sugar/logical_operators.h>
 
 #endif



More information about the Rcpp-commits mailing list