[Rcpp-commits] r3807 - pkg/RcppBDT/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 22 21:02:07 CEST 2012
Author: edd
Date: 2012-10-22 21:02:07 +0200 (Mon, 22 Oct 2012)
New Revision: 3807
Modified:
pkg/RcppBDT/src/RcppBDTdu.cpp
Log:
minor editing but returning to explicit namespace before object<>
Modified: pkg/RcppBDT/src/RcppBDTdu.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTdu.cpp 2012-10-22 19:00:03 UTC (rev 3806)
+++ pkg/RcppBDT/src/RcppBDTdu.cpp 2012-10-22 19:02:07 UTC (rev 3807)
@@ -58,28 +58,16 @@
};
-using namespace Rcpp ;
+//using namespace Rcpp ;
-object<bdtDu> hours(int h){
- return new bdtDu( boost::posix_time::hours(h) ) ;
-}
-object<bdtDu> minutes(int m){
- return new bdtDu( boost::posix_time::minutes(m)) ;
-}
-object<bdtDu> seconds(int s){
- return new bdtDu( boost::posix_time::seconds(s)) ;
-}
-object<bdtDu> milliseconds(int ms){
- return new bdtDu( boost::posix_time::milliseconds(ms)) ;
-}
-object<bdtDu> microseconds(int ms){
- return new bdtDu( boost::posix_time::microseconds(ms)) ;
-}
-object<bdtDu> nanoseconds(int ms){
- return new bdtDu( boost::posix_time::nanoseconds(ms)) ;
-}
+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) ); }
-object<bdtDu> arith_bdtDu_bdtDu( object<bdtDu> e1, object<bdtDu> e2, std::string op ){
+Rcpp::object<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("-") ){
@@ -90,7 +78,7 @@
return new bdtDu( 0,0,0,0 ) ;
}
-object<bdtDu> arith_bdtDu_int( object<bdtDu> e1, int e2, std::string op ){
+Rcpp::object<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("/") ){
@@ -101,7 +89,7 @@
return new bdtDu( 0,0,0,0 ) ;
}
-bool compare_bdtDu_bdtDu( object<bdtDu> e1, object<bdtDu> e2, std::string op ){
+bool compare_bdtDu_bdtDu( Rcpp::object<bdtDu> e1, Rcpp::object<bdtDu> e2, std::string op ){
if( !op.compare( "==" ) ){
return e1->m_td == e2->m_td ;
} else if( !op.compare( "!=" ) ){
@@ -120,7 +108,7 @@
}
RCPP_MODULE(bdtDuMod) {
- class_<bdtDu>("bdtDu")
+ Rcpp::class_<bdtDu>("bdtDu")
.constructor<int,int,int,int>("constructor with hours, minutes, seconds and fractional_seconds")
@@ -145,15 +133,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 ) ;
+ function( "hours", &hours ) ;
+ function( "minutes", &minutes ) ;
+ function( "seconds", &seconds ) ;
+ function( "milliseconds", &milliseconds ) ;
+ function( "microseconds", µseconds ) ;
+ function( "nanoseconds", &nanoseconds ) ;
- function( "arith_bdtDu_bdtDu", &arith_bdtDu_bdtDu ) ;
- function( "arith_bdtDu_int", &arith_bdtDu_int ) ;
- function( "compare_bdtDu_bdtDu", &compare_bdtDu_bdtDu ) ;
+ function( "arith_bdtDu_bdtDu", &arith_bdtDu_bdtDu ) ;
+ function( "arith_bdtDu_int", &arith_bdtDu_int ) ;
+ function( "compare_bdtDu_bdtDu", &compare_bdtDu_bdtDu ) ;
}
More information about the Rcpp-commits
mailing list