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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 15 04:47:42 CEST 2010


Author: edd
Date: 2010-06-15 04:47:41 +0200 (Tue, 15 Jun 2010)
New Revision: 1542

Modified:
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/NEWS
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/RcppDateVector.h
   pkg/Rcpp/inst/include/RcppDatetimeVector.h
   pkg/Rcpp/src/RcppDateVector.cpp
   pkg/Rcpp/src/RcppDatetimeVector.cpp
Log:
new minor version 
RcppDate(time)?Vector now have a ctor from int scalar 
Also added simple methods set(i, element) to assign


Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/DESCRIPTION	2010-06-15 02:47:41 UTC (rev 1542)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Rcpp R/C++ interface package
-Version: 0.8.2.3
+Version: 0.8.2.4
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, with contributions 
  by Simon Urbanek, David Reiss and Douglas Bates; based on code written during 

Modified: pkg/Rcpp/NEWS
===================================================================
--- pkg/Rcpp/NEWS	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/NEWS	2010-06-15 02:47:41 UTC (rev 1542)
@@ -6,6 +6,9 @@
 
     o   RcppDate now has a constructor from SEXP as well
 
+    o   RcppDateVector and RcppDatetimeVector get constructors from int,
+        and simple setter functions for individual elements
+
 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-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/inst/ChangeLog	2010-06-15 02:47:41 UTC (rev 1542)
@@ -1,3 +1,10 @@
+2010-06-14  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/RcppDatetimeVector.cpp: Add ctor from int and setter method
+	* inst/include/RcppDatetimeVector.h: Idem
+	* src/RcppDateVector.cpp: Add ctor from int and setter method
+	* inst/include/RcppDateVector.h: Idem
+
 2010-06-13  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/RcppResultSet.cpp: Proper template specialisation for wrap

Modified: pkg/Rcpp/inst/include/RcppDateVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDateVector.h	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/inst/include/RcppDateVector.h	2010-06-15 02:47:41 UTC (rev 1542)
@@ -30,9 +30,11 @@
 class RcppDateVector {
 public:
     RcppDateVector(SEXP vec);
+    RcppDateVector(int n);
     ~RcppDateVector();
     RcppDate& operator()(int i) const;
     int size() const;
+    void set(int i, const RcppDate &d);
 private:
     RcppDate *v;
     int length;

Modified: pkg/Rcpp/inst/include/RcppDatetimeVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetimeVector.h	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/inst/include/RcppDatetimeVector.h	2010-06-15 02:47:41 UTC (rev 1542)
@@ -28,9 +28,11 @@
 class RcppDatetimeVector {
 public:
     RcppDatetimeVector(SEXP vec);
+    RcppDatetimeVector(int n);
     ~RcppDatetimeVector();
     RcppDatetime &operator()(int i) const;
     int size() const;
+    void set(int i, const RcppDatetime &dt);
 private:
     RcppDatetime *v;
     int length;

Modified: pkg/Rcpp/src/RcppDateVector.cpp
===================================================================
--- pkg/Rcpp/src/RcppDateVector.cpp	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/src/RcppDateVector.cpp	2010-06-15 02:47:41 UTC (rev 1542)
@@ -35,6 +35,11 @@
     length = len;
 }
 
+RcppDateVector::RcppDateVector(int n) {
+    v = new RcppDate[n];
+    length = n;
+}
+
 RcppDateVector::~RcppDateVector() {
     delete [] v;
 }
@@ -51,3 +56,12 @@
 int RcppDateVector::size() const { 
     return length; 
 }
+
+void RcppDateVector::set(int i, const RcppDate &d) {
+    if (i < 0 || i >= length) {
+	std::ostringstream oss;
+	oss << "RcppDateVector: subscript out of range: " << i;
+	throw std::range_error(oss.str());
+    }
+    v[i] = d;
+}

Modified: pkg/Rcpp/src/RcppDatetimeVector.cpp
===================================================================
--- pkg/Rcpp/src/RcppDatetimeVector.cpp	2010-06-15 00:51:06 UTC (rev 1541)
+++ pkg/Rcpp/src/RcppDatetimeVector.cpp	2010-06-15 02:47:41 UTC (rev 1542)
@@ -51,3 +51,11 @@
     return length; 
 }
 
+void RcppDatetimeVector::set(int i, const RcppDatetime &dt) {
+    if (i < 0 || i >= length) {
+	std::ostringstream oss;
+	oss << "RcppDatetimeVector: subscript out of range: " << i;
+	throw std::range_error(oss.str());
+    }
+    v[i] = dt;
+}



More information about the Rcpp-commits mailing list