[Rcpp-commits] r1523 - in pkg/Rcpp: . inst inst/include src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 12 19:48:27 CEST 2010


Author: edd
Date: 2010-06-12 19:48:27 +0200 (Sat, 12 Jun 2010)
New Revision: 1523

Modified:
   pkg/Rcpp/NEWS
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/RcppDate.h
   pkg/Rcpp/src/RcppDate.cpp
Log:
added simple RcppDate(SEXP d) constructor (using as<int> internally)
documented some of the recent additions in NEWS


Modified: pkg/Rcpp/NEWS
===================================================================
--- pkg/Rcpp/NEWS	2010-06-12 02:46:03 UTC (rev 1522)
+++ pkg/Rcpp/NEWS	2010-06-12 17:48:27 UTC (rev 1523)
@@ -1,3 +1,11 @@
+0.8.3   (under development)
+
+    o   New helper function so that "Rcpp?something" brings up Rcpp help
+
+    o   Rcpp Modules can now expose public data members
+
+    o   RcppDate now has a constructor from SEXP as well
+
 0.8.2   2010-06-09
 
     o   Bug-fix release for suncc compiler with thanks to Brian Ripley for

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-06-12 02:46:03 UTC (rev 1522)
+++ pkg/Rcpp/inst/ChangeLog	2010-06-12 17:48:27 UTC (rev 1523)
@@ -1,9 +1,9 @@
 2010-06-11  Romain Francois <romain at r-enthusiasts.com>
 
-	* R/help.R: workaround to allow the syntax "Rcpp ? something" to 
+	* R/help.R: workaround to allow the syntax "Rcpp ? something" to
 	bring Rcpp documentation
 
-	* inst/include/Rcpp/Module.h: support for exposing public data 
+	* inst/include/Rcpp/Module.h: support for exposing public data
 	members
 
 	* inst/doc/Rcpp-modules/Rcpp-modules.Rnw: a section to mention fields

Modified: pkg/Rcpp/inst/include/RcppDate.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDate.h	2010-06-12 02:46:03 UTC (rev 1522)
+++ pkg/Rcpp/inst/include/RcppDate.h	2010-06-12 17:48:27 UTC (rev 1523)
@@ -39,6 +39,7 @@
     RcppDate();
     RcppDate(int Rjdn);
     RcppDate(int month_, int day_, int year_);
+    RcppDate(SEXP dt);
     int getMonth() const { return month; }
     int getDay()  const  { return day; }
     int getYear() const  { return year; }

Modified: pkg/Rcpp/src/RcppDate.cpp
===================================================================
--- pkg/Rcpp/src/RcppDate.cpp	2010-06-12 02:46:03 UTC (rev 1522)
+++ pkg/Rcpp/src/RcppDate.cpp	2010-06-12 17:48:27 UTC (rev 1523)
@@ -45,6 +45,11 @@
     mdy2jdn();
 }
 
+RcppDate::RcppDate(SEXP dt) {
+    jdn = Rcpp::as<int>(dt) + Jan1970Offset;
+    jdn2mdy();
+}
+
 // Print an RcppDate.
 std::ostream& operator<<(std::ostream& os, const RcppDate& date) {
     os << date.getYear() << "-" << date.getMonth() << "-" << date.getDay();



More information about the Rcpp-commits mailing list