[Rcpp-commits] r3825 - in pkg/RcppBDT: . inst/include src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 23 18:09:08 CEST 2012
Author: romain
Date: 2012-10-23 18:09:07 +0200 (Tue, 23 Oct 2012)
New Revision: 3825
Modified:
pkg/RcppBDT/ChangeLog
pkg/RcppBDT/inst/include/RcppBDTdu.h
pkg/RcppBDT/inst/include/RcppBDTpt.h
pkg/RcppBDT/src/RcppBDTdu.cpp
pkg/RcppBDT/src/RcppBDTpt.cpp
Log:
using pointers as returns of functions
Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog 2012-10-23 15:54:22 UTC (rev 3824)
+++ pkg/RcppBDT/ChangeLog 2012-10-23 16:09:07 UTC (rev 3825)
@@ -1,3 +1,7 @@
+2012-10-23 Romain Francois <romain at r-enthusiasts.com>
+
+ * src/RcppBDTdu.cpp: using bdtDu* instead of object<bdtDu> for function returns
+
2012-10-22 Dirk Eddelbuettel <edd at debian.org>
* inst/include/RcppBDTdt.h:
Modified: pkg/RcppBDT/inst/include/RcppBDTdu.h
===================================================================
--- pkg/RcppBDT/inst/include/RcppBDTdu.h 2012-10-23 15:54:22 UTC (rev 3824)
+++ pkg/RcppBDT/inst/include/RcppBDTdu.h 2012-10-23 16:09:07 UTC (rev 3825)
@@ -56,11 +56,11 @@
private:
boost::posix_time::time_duration m_td;
- friend Rcpp::object<bdtDu> arith_bdtDu_bdtDu(Rcpp::object<bdtDu>, Rcpp::object<bdtDu>, std::string);
- friend Rcpp::object<bdtDu> arith_bdtDu_int(Rcpp::object<bdtDu>, int, std::string);
+ friend bdtDu* arith_bdtDu_bdtDu(Rcpp::object<bdtDu>, Rcpp::object<bdtDu>, std::string);
+ friend bdtDu* arith_bdtDu_int(Rcpp::object<bdtDu>, int, std::string);
friend bool compare_bdtDu_bdtDu(Rcpp::object<bdtDu>, Rcpp::object<bdtDu>, std::string);
- friend Rcpp::object<bdtPt> arith_bdtPt_bdtDu(Rcpp::object<bdtPt>, Rcpp::object<bdtDu>, std::string);
+ friend bdtPt* arith_bdtPt_bdtDu(Rcpp::object<bdtPt>, Rcpp::object<bdtDu>, std::string);
};
#endif
Modified: pkg/RcppBDT/inst/include/RcppBDTpt.h
===================================================================
--- pkg/RcppBDT/inst/include/RcppBDTpt.h 2012-10-23 15:54:22 UTC (rev 3824)
+++ pkg/RcppBDT/inst/include/RcppBDTpt.h 2012-10-23 16:09:07 UTC (rev 3825)
@@ -66,7 +66,7 @@
private:
boost::posix_time::ptime m_pt; // private ptime instace
- friend Rcpp::object<bdtPt> arith_bdtPt_bdtDu(Rcpp::object<bdtPt>, Rcpp::object<bdtDu>, std::string);
+ friend bdtPt* arith_bdtPt_bdtDu(Rcpp::object<bdtPt>, Rcpp::object<bdtDu>, std::string);
friend bool compare_bdtPt_bdtPt(Rcpp::object<bdtPt>, Rcpp::object<bdtPt>, std::string);
};
Modified: pkg/RcppBDT/src/RcppBDTdu.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTdu.cpp 2012-10-23 15:54:22 UTC (rev 3824)
+++ pkg/RcppBDT/src/RcppBDTdu.cpp 2012-10-23 16:09:07 UTC (rev 3825)
@@ -21,14 +21,14 @@
#include <RcppBDT.h>
-Rcpp::object<bdtDu> hours(int h) { return new bdtDu( boost::posix_time::hours(h) ); }
-Rcpp::object<bdtDu> minutes(int m) { return new bdtDu( boost::posix_time::minutes(m) ); }
-Rcpp::object<bdtDu> seconds(int s) { return new bdtDu( boost::posix_time::seconds(s) ); }
-Rcpp::object<bdtDu> milliseconds(int ms) { return new bdtDu( boost::posix_time::milliseconds(ms) ); }
-Rcpp::object<bdtDu> microseconds(int ms) { return new bdtDu( boost::posix_time::microseconds(ms) ); }
-Rcpp::object<bdtDu> nanoseconds(int ms) { return new bdtDu( boost::posix_time::nanoseconds(ms) ); }
+bdtDu* hours(int h) { return new bdtDu( boost::posix_time::hours(h) ); }
+bdtDu* minutes(int m) { return new bdtDu( boost::posix_time::minutes(m) ); }
+bdtDu* seconds(int s) { return new bdtDu( boost::posix_time::seconds(s) ); }
+bdtDu* milliseconds(int ms) { return new bdtDu( boost::posix_time::milliseconds(ms) ); }
+bdtDu* microseconds(int ms) { return new bdtDu( boost::posix_time::microseconds(ms) ); }
+bdtDu* nanoseconds(int ms) { return new bdtDu( boost::posix_time::nanoseconds(ms) ); }
-Rcpp::object<bdtDu> arith_bdtDu_bdtDu( Rcpp::object<bdtDu> e1, Rcpp::object<bdtDu> e2, std::string op ){
+bdtDu* arith_bdtDu_bdtDu( Rcpp::object<bdtDu> e1, Rcpp::object<bdtDu> e2, std::string op ){
if( ! op.compare("+") ){
return new bdtDu( e1->m_td + e2->m_td ) ;
} else if( ! op.compare("-") ){
@@ -39,7 +39,7 @@
return new bdtDu( 0,0,0,0 ) ;
}
-Rcpp::object<bdtDu> arith_bdtDu_int( Rcpp::object<bdtDu> e1, int e2, std::string op ){
+bdtDu* arith_bdtDu_int( Rcpp::object<bdtDu> e1, int e2, std::string op ){
if( ! op.compare("*") ){
return new bdtDu( e1->m_td * e2 ) ;
} else if( ! op.compare("/") ){
@@ -100,15 +100,15 @@
.method("getAddedPosixtime", &bdtDu::getAddedPosixtime, "adds duration to given posix time and returns posix time")
;
- function( "hours", &hours ) ;
- function( "minutes", &minutes ) ;
- function( "seconds", &seconds ) ;
- function( "milliseconds", &milliseconds ) ;
- function( "microseconds", µseconds ) ;
- function( "nanoseconds", &nanoseconds ) ;
+ Rcpp::function( "hours", &hours ) ;
+ Rcpp::function( "minutes", &minutes ) ;
+ Rcpp::function( "seconds", &seconds ) ;
+ Rcpp::function( "milliseconds", &milliseconds ) ;
+ Rcpp::function( "microseconds", µseconds ) ;
+ Rcpp::function( "nanoseconds", &nanoseconds ) ;
- function( "arith_bdtDu_bdtDu", &arith_bdtDu_bdtDu ) ;
- function( "arith_bdtDu_int", &arith_bdtDu_int ) ;
- function( "compare_bdtDu_bdtDu", &compare_bdtDu_bdtDu ) ;
+ Rcpp::function( "arith_bdtDu_bdtDu", &arith_bdtDu_bdtDu ) ;
+ Rcpp::function( "arith_bdtDu_int", &arith_bdtDu_int ) ;
+ Rcpp::function( "compare_bdtDu_bdtDu", &compare_bdtDu_bdtDu ) ;
}
Modified: pkg/RcppBDT/src/RcppBDTpt.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTpt.cpp 2012-10-23 15:54:22 UTC (rev 3824)
+++ pkg/RcppBDT/src/RcppBDTpt.cpp 2012-10-23 16:09:07 UTC (rev 3825)
@@ -38,7 +38,7 @@
}
}
-Rcpp::object<bdtPt> arith_bdtPt_bdtDu(Rcpp::object<bdtPt> e1, Rcpp::object<bdtDu> e2, std::string op){
+bdtPt* arith_bdtPt_bdtDu(Rcpp::object<bdtPt> e1, Rcpp::object<bdtDu> e2, std::string op){
if( ! op.compare("+") ){
return new bdtPt( e1->m_pt + e2->m_td ) ;
} else if( ! op.compare("-") ){
@@ -95,6 +95,6 @@
;
- function("arith_bdtPt_bdtDu", &arith_bdtPt_bdtDu);
- function("compare_bdtPt_bdtPt", &compare_bdtPt_bdtPt);
+ Rcpp::function("arith_bdtPt_bdtDu", &arith_bdtPt_bdtDu);
+ Rcpp::function("compare_bdtPt_bdtPt", &compare_bdtPt_bdtPt);
}
More information about the Rcpp-commits
mailing list