[Rcpp-commits] r971 - in pkg/Rcpp: R inst/include src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 4 09:14:00 CEST 2010
Author: romain
Date: 2010-04-04 09:13:59 +0200 (Sun, 04 Apr 2010)
New Revision: 971
Added:
pkg/Rcpp/inst/include/Rcpp.h
pkg/Rcpp/inst/include/Rcpp/
pkg/Rcpp/inst/include/RcppCommon.h
pkg/Rcpp/inst/include/RcppDate.h
pkg/Rcpp/inst/include/RcppDateVector.h
pkg/Rcpp/inst/include/RcppDatetime.h
pkg/Rcpp/inst/include/RcppDatetimeVector.h
pkg/Rcpp/inst/include/RcppDoxygenExamples.h
pkg/Rcpp/inst/include/RcppFrame.h
pkg/Rcpp/inst/include/RcppFunction.h
pkg/Rcpp/inst/include/RcppList.h
pkg/Rcpp/inst/include/RcppMatrix.h
pkg/Rcpp/inst/include/RcppMatrixView.h
pkg/Rcpp/inst/include/RcppNumList.h
pkg/Rcpp/inst/include/RcppParams.h
pkg/Rcpp/inst/include/RcppResultSet.h
pkg/Rcpp/inst/include/RcppStringVector.h
pkg/Rcpp/inst/include/RcppStringVectorView.h
pkg/Rcpp/inst/include/RcppVector.h
pkg/Rcpp/inst/include/RcppVectorView.h
Removed:
pkg/Rcpp/src/Rcpp.h
pkg/Rcpp/src/Rcpp/
pkg/Rcpp/src/RcppCommon.h
pkg/Rcpp/src/RcppDate.h
pkg/Rcpp/src/RcppDateVector.h
pkg/Rcpp/src/RcppDatetime.h
pkg/Rcpp/src/RcppDatetimeVector.h
pkg/Rcpp/src/RcppDoxygenExamples.h
pkg/Rcpp/src/RcppFrame.h
pkg/Rcpp/src/RcppFunction.h
pkg/Rcpp/src/RcppList.h
pkg/Rcpp/src/RcppMatrix.h
pkg/Rcpp/src/RcppMatrixView.h
pkg/Rcpp/src/RcppNumList.h
pkg/Rcpp/src/RcppParams.h
pkg/Rcpp/src/RcppResultSet.h
pkg/Rcpp/src/RcppStringVector.h
pkg/Rcpp/src/RcppStringVectorView.h
pkg/Rcpp/src/RcppVector.h
pkg/Rcpp/src/RcppVectorView.h
Modified:
pkg/Rcpp/R/RcppLdpath.R
pkg/Rcpp/src/Makevars
pkg/Rcpp/src/Makevars.win
Log:
move Rcpp headers to inst/include
Modified: pkg/Rcpp/R/RcppLdpath.R
===================================================================
--- pkg/Rcpp/R/RcppLdpath.R 2010-04-04 00:52:07 UTC (rev 970)
+++ pkg/Rcpp/R/RcppLdpath.R 2010-04-04 07:13:59 UTC (rev 971)
@@ -39,7 +39,8 @@
## Provide compiler flags -- i.e. -I/path/to/Rcpp.h
RcppCxxFlags <- function(cxx0x=FALSE) {
- path <- RcppLdPath()
+ # path <- RcppLdPath()
+ path <- system.file( "include", package = "Rcpp" )
if (.Platform$OS.type=="windows") {
path <- shQuote(path)
}
Copied: pkg/Rcpp/inst/include/Rcpp (from rev 965, pkg/Rcpp/src/Rcpp)
Copied: pkg/Rcpp/inst/include/Rcpp.h (from rev 965, pkg/Rcpp/src/Rcpp.h)
===================================================================
--- pkg/Rcpp/inst/include/Rcpp.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,71 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// Rcpp.h: R/C++ interface class library
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+// Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef Rcpp_hpp
+#define Rcpp_hpp
+
+/* it is important that this comes first */
+#include <RcppCommon.h>
+
+/* classic api */
+#include <RcppDate.h>
+#include <RcppDateVector.h>
+#include <RcppDatetime.h>
+#include <RcppDatetimeVector.h>
+#include <RcppFrame.h>
+#include <RcppFunction.h>
+#include <RcppList.h>
+#include <RcppMatrix.h>
+#include <RcppMatrixView.h>
+#include <RcppNumList.h>
+#include <RcppParams.h>
+#include <RcppResultSet.h>
+#include <RcppStringVector.h>
+#include <RcppStringVectorView.h>
+#include <RcppVector.h>
+#include <RcppVectorView.h>
+
+/* new api */
+#include <Rcpp/exceptions.h>
+
+#include <Rcpp/RObject.h>
+#include <Rcpp/Named.h>
+
+#include <Rcpp/S4.h>
+#include <Rcpp/clone.h>
+#include <Rcpp/grow.h>
+#include <Rcpp/Dimension.h>
+#include <Rcpp/Environment.h>
+#include <Rcpp/Evaluator.h>
+#include <Rcpp/Vector.h>
+#include <Rcpp/XPtr.h>
+#include <Rcpp/Symbol.h>
+#include <Rcpp/Language.h>
+#include <Rcpp/DottedPair.h>
+#include <Rcpp/Pairlist.h>
+#include <Rcpp/Function.h>
+#include <Rcpp/WeakReference.h>
+#include <Rcpp/StringTransformer.h>
+#include <Rcpp/Formula.h>
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppCommon.h (from rev 965, pkg/Rcpp/src/RcppCommon.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppCommon.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,241 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppCommon.h: Rcpp R/C++ interface class library -- common include and defines statements
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+// Copyright (C) 2009 Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppCommon_h
+#define RcppCommon_h
+
+void logTxtFunction(const char* file, const int line, const char* expression ) ;
+
+#define ___RCPP_HANDLE_CASE___( ___RTYPE___ , ___FUN___ , ___OBJECT___ , ___RCPPTYPE___ ) \
+ case ___RTYPE___ : \
+ return ___FUN___( ::Rcpp::___RCPPTYPE___< ___RTYPE___ >( ___OBJECT___ ) ) ;
+
+#define ___RCPP_RETURN___( __FUN__, __SEXP__ , __RCPPTYPE__ ) \
+ SEXP __TMP__ = __SEXP__ ; \
+ switch( TYPEOF( __TMP__ ) ){ \
+ ___RCPP_HANDLE_CASE___( INTSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( REALSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( RAWSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( LGLSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( CPLXSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( STRSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( VECSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ ___RCPP_HANDLE_CASE___( EXPRSXP , __FUN__ , __TMP__ , __RCPPTYPE__ ) \
+ default: \
+ throw std::range_error( "not a vector" ) ; \
+ }
+
+#define RCPP_RETURN_VECTOR( _FUN_, _SEXP_ ) ___RCPP_RETURN___( _FUN_, _SEXP_ , Vector )
+#define RCPP_RETURN_MATRIX( _FUN_, _SEXP_ ) ___RCPP_RETURN___( _FUN_, _SEXP_ , Matrix )
+
+/**
+ * \brief Rcpp API
+ */
+namespace Rcpp{
+/**
+ * \brief traits used to dispatch wrap
+ */
+namespace traits{
+} // traits
+/**
+ * \brief internal implementation details
+ */
+namespace internal{
+} // internal
+} // Rcpp
+
+#ifdef __GNUC__
+ #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+ #ifdef __GXX_EXPERIMENTAL_CXX0X__
+ #define HAS_CXX0X
+ #if GCC_VERSION >= 40300
+ #define HAS_VARIADIC_TEMPLATES
+ #endif
+ #if GCC_VERSION >= 40400
+ #define HAS_INIT_LISTS
+ #endif
+ #endif
+ // FIXME: [romain] I did not actually check, tr1::unordered_map was
+ // probably introduced before GCC 4.3
+ #if GCC_VERSION >= 40300
+ #define HAS_TR1
+ #define HAS_TR1_UNORDERED_MAP
+ #define HAS_TR1_UNORDERED_SET
+ #endif
+#endif
+
+#include <iterator>
+#include <exception>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <list>
+#include <map>
+#include <set>
+#include <stdexcept>
+#include <vector>
+#include <deque>
+#include <functional>
+#include <numeric>
+#include <algorithm>
+#include <complex>
+
+#ifdef HAS_INIT_LISTS
+#include <initializer_list>
+#endif
+
+#ifdef HAS_TR1_UNORDERED_MAP
+#include <tr1/unordered_map>
+#endif
+
+#ifdef HAS_TR1_UNORDERED_SET
+#include <tr1/unordered_set>
+#endif
+
+std::string demangle( const std::string& name) ;
+#define DEMANGLE(__TYPE__) demangle( typeid(__TYPE__).name() ).c_str()
+
+// include R headers, but set R_NO_REMAP and access everything via Rf_ prefixes
+#define R_NO_REMAP
+#include <R.h>
+#include <Rinternals.h>
+#include <R_ext/Callbacks.h>
+#include <R_ext/Complex.h>
+#include <R_ext/Parse.h>
+#include <Rversion.h>
+#define RCPP_GET_NAMES(x) Rf_getAttrib(x, R_NamesSymbol)
+
+// #ifdef BUILDING_DLL
+// #define RcppExport extern "C" __declspec(dllexport)
+// #else
+#define RcppExport extern "C"
+// #endif
+
+
+namespace Rcpp{
+namespace internal{
+template <typename T> int rcpp_call_test(T t){
+ return T::r_type::value ;
+}
+int rcpp_call_test_(SEXP) ;
+}
+}
+
+extern "C" SEXP rcpp_call_test(SEXP x) ;
+
+char *copyMessageToR(const char* const mesg);
+
+/* in exceptions.cpp */
+void forward_uncaught_exceptions_to_r() ;
+RcppExport SEXP initUncaughtExceptionHandler() ;
+
+/* just testing variadic templates */
+#ifdef HAS_VARIADIC_TEMPLATES
+template<typename... Args>
+int variadic_length( const Args&... args) { return sizeof...(Args) ; }
+#endif
+
+#ifdef HAS_VARIADIC_TEMPLATES
+RcppExport inline SEXP canUseCXX0X(){ return Rf_ScalarLogical( TRUE ); }
+#else
+RcppExport inline SEXP canUseCXX0X(){ return Rf_ScalarLogical( FALSE ); }
+#endif
+
+RcppExport SEXP test_named() ;
+RcppExport SEXP capabilities() ;
+
+const char * sexp_to_name(int sexp_type);
+
+RcppExport SEXP initRcpp() ;
+
+namespace Rcpp{
+/* internal namespace for things not intended to be used by the
+ user */
+namespace internal{
+
+ /* defined in Evaluator.cpp */
+ SEXP convert_using_rfunction(SEXP x, const char* const fun) ;
+
+ SEXP try_catch( SEXP expr, SEXP env ) ;
+ SEXP try_catch( SEXP expr ) ;
+
+} // namespace internal
+
+inline bool Rboolean_to_bool( int x){ return x == TRUE ; }
+inline bool int_to_bool(int x){ return x != 0 ; }
+inline bool double_to_bool(double x){ return x != 0.0 ; }
+inline bool Rbyte_to_bool(Rbyte x){ return x != static_cast<Rbyte>(0) ; }
+
+} // namespace Rcpp
+
+// simple logging help
+#define RCPP_DEBUG_LEVEL 0
+
+#ifndef logTxt
+ #if RCPP_DEBUG_LEVEL > 0
+ #define logTxt(x) ::logTxtFunction(__FILE__, __LINE__, x);
+ #else
+ #define logTxt(x)
+ #endif
+#endif
+
+#if RCPP_DEBUG_LEVEL > 0
+ #define RCPP_DEBUG( fmt , ... ) Rprintf( "%s:%d " fmt "\n" , __FILE__, __LINE__,##__VA_ARGS__ ) ;
+#else
+ #define RCPP_DEBUG( fmt , ... )
+#endif
+
+SEXP stack_trace( const char *file, int line) ;
+#define GET_STACKTRACE() stack_trace( __FILE__, __LINE__ )
+#define Rcpp_error(MESSAGE) throw new Rcpp::exception( MESSAGE, __FILE__, __LINE__ )
+
+// DO NOT CHANGE THE ORDER OF THESE INCLUDES
+#include <Rcpp/traits/integral_constant.h>
+#include <Rcpp/traits/same_type.h>
+#include <Rcpp/traits/named_object.h>
+#include <Rcpp/traits/is_convertible.h>
+#include <Rcpp/traits/has_iterator.h>
+#include <Rcpp/traits/has_na.h>
+#include <Rcpp/traits/storage_type.h>
+#include <Rcpp/traits/r_sexptype_traits.h>
+#include <Rcpp/traits/storage_type.h>
+#include <Rcpp/traits/r_type_traits.h>
+#include <Rcpp/traits/wrap_type_traits.h>
+
+#include <Rcpp/internal/caster.h>
+#include <Rcpp/internal/r_vector.h>
+#include <Rcpp/r_cast.h>
+
+#include <Rcpp/internal/export.h>
+#include <Rcpp/traits/Exporter.h>
+#include <Rcpp/internal/r_coerce.h>
+#include <Rcpp/as.h>
+#include <Rcpp/internal/wrap.h>
+
+#include <Rcpp/internal/ListInitialization.h>
+#include <Rcpp/internal/Proxy_Iterator.h>
+
+RcppExport SEXP RcppXPtrExample_create_external_pointer() ;
+RcppExport SEXP RcppXPtrExample_get_external_pointer(SEXP );
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppDate.h (from rev 965, pkg/Rcpp/src/RcppDate.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppDate.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppDate.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,60 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppDate.h: Rcpp R/C++ interface class library -- Date type support
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 Dirk Eddelbuettel
+// Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppDate_h
+#define RcppDate_h
+
+#include <RcppCommon.h>
+
+class RcppDate {
+private:
+ void mdy2jdn(); // month/day/year to Julian day number.
+ void jdn2mdy(); // Julian day number to month/day/year.
+ int month, day, year;
+ int jdn; // Julian day number
+
+public:
+ static const int Jan1970Offset; // offset between Jan 1, 1970 and Julian Day Number
+ static const int QLtoJan1970Offset; // offset between Jan 1, 1970 and QuantLib BaseDate
+ RcppDate();
+ RcppDate(int Rjdn);
+ RcppDate(int month_, int day_, int year_);
+ int getMonth() const { return month; }
+ int getDay() const { return day; }
+ int getYear() const { return year; }
+ int getJDN() const { return jdn; }
+ int getJulian() const { return jdn - Jan1970Offset; }
+
+ // Minimal set of date operations.
+ friend RcppDate operator+(const RcppDate &date, int offset);
+ friend int operator-(const RcppDate& date1, const RcppDate& date2);
+ friend bool operator<(const RcppDate &date1, const RcppDate& date2);
+ friend bool operator>(const RcppDate &date1, const RcppDate& date2);
+ friend bool operator==(const RcppDate &date1, const RcppDate& date2);
+ friend bool operator>=(const RcppDate &date1, const RcppDate& date2);
+ friend bool operator<=(const RcppDate &date1, const RcppDate& date2);
+
+ friend std::ostream& operator<<(std::ostream& os, const RcppDate& date);
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppDateVector.h (from rev 965, pkg/Rcpp/src/RcppDateVector.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppDateVector.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppDateVector.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,40 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppDateVector.h: Rcpp R/C++ interface class library -- Date vector support
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppDateVector_h
+#define RcppDateVector_h
+
+#include <RcppCommon.h>
+#include <RcppDate.h>
+
+class RcppDateVector {
+public:
+ RcppDateVector(SEXP vec);
+ ~RcppDateVector();
+ RcppDate& operator()(int i);
+ int size() const;
+private:
+ RcppDate *v;
+ int length;
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppDatetime.h (from rev 965, pkg/Rcpp/src/RcppDatetime.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetime.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppDatetime.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,64 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppDatetime.h: Rcpp R/C++ interface class library -- Datetime type support
+//
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppDatetime_h
+#define RcppDatetime_h
+
+#include <RcppCommon.h>
+#include <time.h>
+
+class RcppDatetime {
+private:
+ double m_d; // fractional seconds since epoch as eg POSIXct
+ bool m_parsed; // has m_tm been set based on m_d ?
+ int m_us; // microseconds not in POSIX time structure
+ struct tm m_tm; // time structure as eg POSIXlt
+ void parseTime(); // sets m_tm and m_us based on m_d
+
+protected:
+ friend class ColDatum;
+
+public:
+ RcppDatetime(void);
+ RcppDatetime(const double d);
+ RcppDatetime(SEXP ds);
+
+ double getFractionalTimestamp(void) const { return m_d; }
+ int getYear(void) { if (!m_parsed) parseTime(); return m_tm.tm_year + 1900; }
+ int getMonth(void) { if (!m_parsed) parseTime(); return m_tm.tm_mon + 1; }
+ int getDay(void) { if (!m_parsed) parseTime(); return m_tm.tm_mday; }
+ int getWeekday(void) { if (!m_parsed) parseTime(); return m_tm.tm_wday; }
+ int getHour(void) { if (!m_parsed) parseTime(); return m_tm.tm_hour; }
+ int getMinute(void) { if (!m_parsed) parseTime(); return m_tm.tm_min; }
+ int getSecond(void) { if (!m_parsed) parseTime(); return m_tm.tm_sec; }
+ int getMicroSec(void) { if (!m_parsed) parseTime(); return m_us; }
+
+ friend double operator-(const RcppDatetime& dt1, const RcppDatetime& dt2) { return dt1.m_d - dt2.m_d; }
+ friend bool operator<(const RcppDatetime &dt1, const RcppDatetime& dt2) { return dt1.m_d < dt2.m_d; }
+ friend bool operator<=(const RcppDatetime &dt1, const RcppDatetime& dt2) { return dt1.m_d <= dt2.m_d; }
+ friend bool operator>(const RcppDatetime &dt1, const RcppDatetime& dt2) { return dt1.m_d > dt2.m_d; }
+ friend bool operator>=(const RcppDatetime &dt1, const RcppDatetime& dt2) { return dt1.m_d >= dt2.m_d; }
+ friend bool operator==(const RcppDatetime &dt1, const RcppDatetime& dt2) { return dt1.m_d == dt2.m_d; } // remember float math...
+ friend std::ostream& operator<<(std::ostream& os, const RcppDatetime &datetime);
+ friend RcppDatetime operator+(const RcppDatetime &date, double offset);
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppDatetimeVector.h (from rev 965, pkg/Rcpp/src/RcppDatetimeVector.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetimeVector.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppDatetimeVector.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,39 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppDatetimeeVector.h: Rcpp R/C++ interface class library -- Datetime vector support
+//
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppDatetimeVector_h
+#define RcppDatetimeVector_h
+
+#include <RcppCommon.h>
+#include <RcppDatetime.h>
+
+class RcppDatetimeVector {
+public:
+ RcppDatetimeVector(SEXP vec);
+ ~RcppDatetimeVector();
+ RcppDatetime &operator()(int i) const;
+ int size() const;
+private:
+ RcppDatetime *v;
+ int length;
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppDoxygenExamples.h (from rev 965, pkg/Rcpp/src/RcppDoxygenExamples.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppDoxygenExamples.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppDoxygenExamples.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,95 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// Rcpp.h: R/C++ interface class library
+//
+// Copyright (C) 2009 - 2010 Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+// This file is not used by any code but exists solely to group
+// example macros for Doxygen.
+//
+// Note that there is some serious brain-damagedness going on doxygen will only
+// include the examples if we do this:
+//
+// cd src && ln -s ../inst/examples examples cd -
+// doxygen doxyfile
+// cd src && rm examples cd -
+//
+// ie without the softlink nothing happens, despite the recursive example path set
+// in doxyfile etc and numerous other attempts I made.
+
+
+//! \example functionCallback/RcppFunctionCallExample.cpp
+//! An example providing a class RVectorFuncCall derived from class RcppFunction which
+//! implements a vector-values function transformVector(); the class gets initialized
+//! with an R function vecfunc passed along using Rcpp.
+
+//! \example functionCallback/ExampleRCode.R
+//! This files defines the R function vecfunc passed down to C++ and called via the
+//! wrapper function built using the sub-class of RcppFunction to call it.
+
+
+
+//! \example RcppInline/external_pointer.r
+//! A simple example (using inline) of external Pointer use via Rcpp::XPtr
+
+//! \example RcppInline/RcppInlineExample.r
+//! The 'distribution of determinant' example as a demonstration of how to use
+//! inline and Rcpp for a simple function.
+
+//! \example RcppInline/RcppInlineWithLibsExamples.r
+//! Four simple examples of how to combine Rcpp and an external library
+//! (where we use the GNU GSL) using inline.
+
+//! \example RcppInline/RObject.r
+//! A number of examples on how to use wrap() to automatically convert data types.
+
+//! \example RcppInline/RcppSimpleExample.r
+//! A very simple example of using inline without Rcpp.
+
+//! \example RcppInline/RcppSimpleTests.r
+//! This file provides a few simple tests that preceded the creation of the
+//! numerous formal unit tests that followed.
+
+//! \example RcppInline/UncaughtExceptions.r
+//! An example of how to catch C++ exceptions even without a try / catch block.
+
+
+
+
+//! \example ConvolveBenchmarks/convolve2_c.c
+//! The basic convolution example from Section 5.10.1 of 'Writing R Extensions'
+
+//! \example ConvolveBenchmarks/convolve2_cpp.c
+//! A simple version of the basic convolution example from Section 5.10.1
+//! of 'Writing R Extensions', now rewritten for Rcpp using RcppVector<double>.
+
+//! \example ConvolveBenchmarks/convolve3_cpp.c
+//! A more efficient version of the basic convolution example from Section 5.10.1
+//! of 'Writing R Extensions', now rewritten for Rcpp and using Rcpp::NumericVector.
+
+//! \example ConvolveBenchmarks/convolve4_cpp.c
+//! An even more efficient version of the basic convolution example from Section 5.10.1
+//! of 'Writing R Extensions', now rewritten for Rcpp and using Rcpp::NumericVector as
+//! well as direct pointer operations for better performance.
+
+//! \example ConvolveBenchmarks/convolve7_c.c
+//! The basic convolution example from Section 5.10.1 of 'Writing R Extensions', written
+//! using REAL(x)[i] accessor macros to demonstrate the performance hit imposed by these.
+
+//! \example ConvolveBenchmarks/exampleRCode.r
+//! R file / littler script to run and time the various implementations.
Copied: pkg/Rcpp/inst/include/RcppFrame.h (from rev 965, pkg/Rcpp/src/RcppFrame.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppFrame.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppFrame.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,93 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppFrame.h: Rcpp R/C++ interface class library -- data.framee support
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppFrame_h
+#define RcppFrame_h
+
+#include <RcppCommon.h>
+#include <RcppDate.h>
+#include <RcppDatetime.h>
+
+enum ColType { // Supported data frame column types.
+ COLTYPE_DOUBLE, COLTYPE_INT, COLTYPE_STRING,
+ COLTYPE_FACTOR, COLTYPE_LOGICAL,
+ COLTYPE_DATE, COLTYPE_DATETIME,
+ COLTYPE_UNKNOWN = -1
+};
+class ColDatum; // forward declaration, see below
+
+class RcppFrame {
+ std::vector<std::string> colNames;
+ std::vector<std::vector<ColDatum> > table; // table[row][col]
+
+public:
+ RcppFrame(SEXP df); // Construct from R data frame.
+ RcppFrame(std::vector<std::string> colNames);
+ std::vector<std::string>& getColNames();
+ std::vector<std::vector<ColDatum> >& getTableData();
+ void addRow(std::vector<ColDatum> rowData);
+ int rows();
+ int cols();
+};
+
+
+class ColDatum {
+public:
+ ColDatum();
+ ColDatum(const ColDatum& datum);
+ ~ColDatum();
+
+ ColType getType() const { return type; }
+ void setDoubleValue(double val);
+ void setIntValue(int val);
+ void setLogicalValue(int val);
+ void setStringValue(std::string val);
+ void setDateValue(RcppDate date);
+ void setDatetimeValue(RcppDatetime datetime);
+ void setFactorValue(std::string *names, int numNames, int factorLevel);
+
+ double getDoubleValue();
+ int getIntValue();
+ int getLogicalValue();
+ std::string getStringValue();
+ RcppDate getDateValue();
+ double getDateRCode();
+ RcppDatetime getDatetimeValue();
+ void checkFactorType();
+ int getFactorNumLevels();
+ int getFactorLevel();
+ std::string *getFactorLevelNames();
+ std::string getFactorLevelName();
+
+private:
+ ColType type;
+ std::string s;
+ double x; // used for double and datetime
+ int i; // used for int and logical
+ int level; // factor level
+ int numLevels; // number of levels for this factor
+ std::string *levelNames; // level name = levelNames[level-1]
+ RcppDate d;
+};
+
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppFunction.h (from rev 965, pkg/Rcpp/src/RcppFunction.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppFunction.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppFunction.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,51 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppFunction.h: Rcpp R/C++ interface class library -- function support
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppFunction_h
+#define RcppFunction_h
+
+#include <RcppCommon.h>
+#include <RcppDate.h>
+#include <RcppDatetime.h>
+
+class RcppFunction {
+public:
+ RcppFunction(SEXP fn_);
+ ~RcppFunction();
+ SEXP listCall();
+ SEXP vectorCall();
+ void setRVector(std::vector<double>& v);
+ void setRListSize(int size);
+ void appendToRList(std::string name, double value);
+ void appendToRList(std::string name, int value);
+ void appendToRList(std::string name, std::string value);
+ void appendToRList(std::string name, RcppDate& date);
+ void appendToRList(std::string name, RcppDatetime& datetime);
+ void clearProtectionStack();
+
+private:
+ SEXP fn, listArg, vectorArg;
+ int listSize, currListPosn, numProtected;
+ std::vector<std::string> names;
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppList.h (from rev 965, pkg/Rcpp/src/RcppList.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppList.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppList.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,52 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppList.h: Rcpp R/C++ interface class library -- 'list' type support
+//
+// Copyright (C) 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppList_h
+#define RcppList_h
+
+#include <RcppCommon.h>
+
+// This class was first used in the RProtoBuf project (currently on r-forge only)
+// but is more generally useful and hence moved over here
+class RcppList {
+public:
+ RcppList(void);
+ ~RcppList();
+ void setSize(int size);
+ void append(std::string name, double value);
+ void append(std::string name, int value);
+ void append(std::string name, std::string value);
+ //void append(std::string name, RcppDate& date);
+ //void append(std::string name, RcppDatetime& datetime);
+ void append(std::string name, SEXP sexp);
+ void clearProtectionStack();
+ SEXP getList(void) const;
+
+protected:
+ friend class RcppResultSet;
+
+private:
+ SEXP listArg;
+ int listSize, currListPosn, numProtected;
+ std::vector<std::string> names;
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppMatrix.h (from rev 965, pkg/Rcpp/src/RcppMatrix.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppMatrix.h (rev 0)
+++ pkg/Rcpp/inst/include/RcppMatrix.h 2010-04-04 07:13:59 UTC (rev 971)
@@ -0,0 +1,45 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// RcppMatrix.h: Rcpp R/C++ interface class library -- templated matrix support
+//
+// Copyright (C) 2005 - 2006 Dominick Samperi
+// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef RcppMatrix_h
+#define RcppMatrix_h
+
+#include <RcppCommon.h>
+
+template <typename T>
+class RcppMatrix {
+public:
+ RcppMatrix(SEXP mat);
+ RcppMatrix(int nx, int ny);
+ int getDim1() const;
+ int getDim2() const;
+ int rows() const;
+ int cols() const;
+ T& operator()(int i, int j) const;
+ T **cMatrix();
+ std::vector<std::vector<T> > stlMatrix();
+private:
+ int dim1, dim2;
+ T **a;
+};
+
+#endif
Copied: pkg/Rcpp/inst/include/RcppMatrixView.h (from rev 965, pkg/Rcpp/src/RcppMatrixView.h)
===================================================================
--- pkg/Rcpp/inst/include/RcppMatrixView.h (rev 0)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 971
More information about the Rcpp-commits
mailing list