[Rcpp-commits] r1554 - in pkg/Rcpp: . inst inst/include src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 16 16:17:13 CEST 2010
Author: edd
Date: 2010-06-16 16:17:13 +0200 (Wed, 16 Jun 2010)
New Revision: 1554
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:
non-const operator() for RcppDateVector and RcppDatetimeVector
Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/DESCRIPTION 2010-06-16 14:17:13 UTC (rev 1554)
@@ -1,6 +1,6 @@
Package: Rcpp
Title: Rcpp R/C++ interface package
-Version: 0.8.2.7
+Version: 0.8.2.8
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-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/NEWS 2010-06-16 14:17:13 UTC (rev 1554)
@@ -6,10 +6,10 @@
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
+ o RcppDateVector and RcppDatetimeVector get constructors from int
+ and both const / non-const operator(int i) functions
- o new API class Rcpp::InternalFunction that can expose C++ functions
+ o New API class Rcpp::InternalFunction that can expose C++ functions
to R without modules. The function is exposed as an S4 object of
class C++Function
Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/inst/ChangeLog 2010-06-16 14:17:13 UTC (rev 1554)
@@ -1,12 +1,17 @@
-2010-06-13 Romain Francois <romain at r-enthusiasts.com>
+2010-06-16 Dirk Eddelbuettel <edd at debian.org>
+ * src/RcppDateVector.cpp: Also provide non-const operator()(int i)
+ * inst/include/RcppDateVector.h: Idem
+
+2010-06-16 Romain Francois <romain at r-enthusiasts.com>
+
* inst/include/Rcpp/InternalFunction.h: new class Rcpp::InternalFunction
* R/Module.R: R support for Rcpp::InternalFunction
-
- * inst/include/Rcpp/Module.h: added the LOAD_RCPP_MODULE macro to
+
+ * inst/include/Rcpp/Module.h: added the LOAD_RCPP_MODULE macro to
allow loading a module from C++
-
- * R/Module.R: if the first argument is an external pointer already,
+
+ * R/Module.R: if the first argument is an external pointer already,
Module assumes it is a module pointer. (R support for the item above)
2010-06-15 Dirk Eddelbuettel <edd at debian.org>
@@ -18,9 +23,9 @@
2010-06-14 Dirk Eddelbuettel <edd at debian.org>
- * src/RcppDatetimeVector.cpp: Add ctor from int and setter method
+ * src/RcppDatetimeVector.cpp: Add constructor from int
* inst/include/RcppDatetimeVector.h: Idem
- * src/RcppDateVector.cpp: Add ctor from int and setter method
+ * src/RcppDateVector.cpp: Add constructor from int
* inst/include/RcppDateVector.h: Idem
2010-06-13 Dirk Eddelbuettel <edd at debian.org>
@@ -29,7 +34,7 @@
* inst/include/RcppResultSet.h: Idem
* src/RcppDateVector.cpp: Add const qualifier to operator()(int i)
- * inst/include/RcppResultSet.h: Idem
+ * inst/include/RcppDateVector.h: Idem
2010-06-13 Romain Francois <romain at r-enthusiasts.com>
Modified: pkg/Rcpp/inst/include/RcppDateVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDateVector.h 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/inst/include/RcppDateVector.h 2010-06-16 14:17:13 UTC (rev 1554)
@@ -33,8 +33,8 @@
RcppDateVector(int n);
~RcppDateVector() {};
const RcppDate& operator()(unsigned int i) const;
+ RcppDate& operator()(unsigned int i);
int size() const;
- void set(unsigned int i, const RcppDate &d);
private:
std::vector<RcppDate> v;
};
Modified: pkg/Rcpp/inst/include/RcppDatetimeVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetimeVector.h 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/inst/include/RcppDatetimeVector.h 2010-06-16 14:17:13 UTC (rev 1554)
@@ -32,8 +32,8 @@
RcppDatetimeVector(int n);
~RcppDatetimeVector() {};
const RcppDatetime &operator()(unsigned int i) const;
+ RcppDatetime &operator()(unsigned int i);
int size() const;
- void set(unsigned int i, const RcppDatetime &dt);
private:
std::vector<RcppDatetime> v;
};
Modified: pkg/Rcpp/src/RcppDateVector.cpp
===================================================================
--- pkg/Rcpp/src/RcppDateVector.cpp 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/src/RcppDateVector.cpp 2010-06-16 14:17:13 UTC (rev 1554)
@@ -48,15 +48,16 @@
return v[i];
}
-int RcppDateVector::size() const {
- return v.size();
-}
-
-void RcppDateVector::set(unsigned int i, const RcppDate &d) {
+RcppDate& RcppDateVector::operator()(unsigned int i) {
if (i >= v.size()) {
std::ostringstream oss;
oss << "RcppDateVector: subscript out of range: " << i;
throw std::range_error(oss.str());
}
- v[i] = d;
+ return v[i];
}
+
+int RcppDateVector::size() const {
+ return v.size();
+}
+
Modified: pkg/Rcpp/src/RcppDatetimeVector.cpp
===================================================================
--- pkg/Rcpp/src/RcppDatetimeVector.cpp 2010-06-16 12:51:18 UTC (rev 1553)
+++ pkg/Rcpp/src/RcppDatetimeVector.cpp 2010-06-16 14:17:13 UTC (rev 1554)
@@ -43,15 +43,16 @@
return v[i];
}
-int RcppDatetimeVector::size() const {
- return v.size();
-}
-
-void RcppDatetimeVector::set(unsigned int i, const RcppDatetime &dt) {
+RcppDatetime & RcppDatetimeVector::operator()(unsigned int i) {
if (i >= v.size()) {
std::ostringstream oss;
oss << "RcppDatetimeVector: subscript out of range: " << i;
throw std::range_error(oss.str());
}
- v[i] = dt;
+ return v[i];
}
+
+int RcppDatetimeVector::size() const {
+ return v.size();
+}
+
More information about the Rcpp-commits
mailing list