[Rcpp-commits] r1734 - in pkg/Rcpp/inst/include: . classic
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 25 16:56:00 CEST 2010
Author: romain
Date: 2010-06-25 16:56:00 +0200 (Fri, 25 Jun 2010)
New Revision: 1734
Added:
pkg/Rcpp/inst/include/classic/RcppDate.h
pkg/Rcpp/inst/include/classic/RcppDateVector.h
pkg/Rcpp/inst/include/classic/RcppDatetime.h
pkg/Rcpp/inst/include/classic/RcppDatetimeVector.h
pkg/Rcpp/inst/include/classic/RcppFrame.h
pkg/Rcpp/inst/include/classic/RcppFunction.h
pkg/Rcpp/inst/include/classic/RcppList.h
pkg/Rcpp/inst/include/classic/RcppList__backward.h
pkg/Rcpp/inst/include/classic/RcppMatrix.h
pkg/Rcpp/inst/include/classic/RcppMatrixView.h
pkg/Rcpp/inst/include/classic/RcppMatrix__backward.h
pkg/Rcpp/inst/include/classic/RcppNumList.h
pkg/Rcpp/inst/include/classic/RcppParams.h
pkg/Rcpp/inst/include/classic/RcppResultSet.h
pkg/Rcpp/inst/include/classic/RcppResultSet__backward.h
pkg/Rcpp/inst/include/classic/RcppStringVector.h
pkg/Rcpp/inst/include/classic/RcppStringVectorView.h
pkg/Rcpp/inst/include/classic/RcppVector.h
pkg/Rcpp/inst/include/classic/RcppVectorView.h
Removed:
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/RcppFrame.h
pkg/Rcpp/inst/include/RcppFunction.h
pkg/Rcpp/inst/include/RcppList.h
pkg/Rcpp/inst/include/RcppList__backward.h
pkg/Rcpp/inst/include/RcppMatrix.h
pkg/Rcpp/inst/include/RcppMatrixView.h
pkg/Rcpp/inst/include/RcppMatrix__backward.h
pkg/Rcpp/inst/include/RcppNumList.h
pkg/Rcpp/inst/include/RcppParams.h
pkg/Rcpp/inst/include/RcppResultSet.h
pkg/Rcpp/inst/include/RcppResultSet__backward.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
Log:
moving the classic api in its own directory (step 2 of 3)
Deleted: pkg/Rcpp/inst/include/RcppDate.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDate.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppDate.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,61 +0,0 @@
-// -*- 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_);
- RcppDate(SEXP dt);
- 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
Deleted: pkg/Rcpp/inst/include/RcppDateVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDateVector.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppDateVector.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,42 +0,0 @@
-// -*- 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
-// Copyright (C) 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 RcppDateVector_h
-#define RcppDateVector_h
-
-#include <RcppCommon.h>
-#include <RcppDate.h>
-
-class RcppDateVector {
-public:
- RcppDateVector(SEXP vec);
- RcppDateVector(int n);
- ~RcppDateVector() {};
- const RcppDate& operator()(unsigned int i) const;
- RcppDate& operator()(unsigned int i);
- int size() const;
-private:
- std::vector<RcppDate> v;
-};
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppDatetime.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetime.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppDatetime.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,64 +0,0 @@
-// -*- 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
Deleted: pkg/Rcpp/inst/include/RcppDatetimeVector.h
===================================================================
--- pkg/Rcpp/inst/include/RcppDatetimeVector.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppDatetimeVector.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,41 +0,0 @@
-// -*- 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
-// Copyright (C) 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 RcppDatetimeVector_h
-#define RcppDatetimeVector_h
-
-#include <RcppCommon.h>
-#include <RcppDatetime.h>
-
-class RcppDatetimeVector {
-public:
- RcppDatetimeVector(SEXP vec);
- RcppDatetimeVector(int n);
- ~RcppDatetimeVector() {};
- const RcppDatetime &operator()(unsigned int i) const;
- RcppDatetime &operator()(unsigned int i);
- int size() const;
-private:
- std::vector<RcppDatetime> v;
-};
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppFrame.h
===================================================================
--- pkg/Rcpp/inst/include/RcppFrame.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppFrame.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,100 +0,0 @@
-// -*- 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() const ;
- int cols() const ;
-
- // the template is never defined, but
- // specializations are (in RcppFrame.cpp)
- template <int COLUMN_TYPE> SEXP getColumn( int col ) const ;
-
-};
-
-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() const ;
- int getIntValue() const ;
- int getLogicalValue() const ;
- std::string getStringValue() const ;
- RcppDate getDateValue() const ;
- double getDateRCode() const ;
- RcppDatetime getDatetimeValue() const;
- void checkFactorType() const ;
- int getFactorNumLevels() const ;
- int getFactorLevel() const;
- 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;
-};
-
-namespace Rcpp{
- template <> SEXP wrap<RcppFrame>( const RcppFrame& x) ;
-}
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppFunction.h
===================================================================
--- pkg/Rcpp/inst/include/RcppFunction.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppFunction.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,51 +0,0 @@
-// -*- 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
Deleted: pkg/Rcpp/inst/include/RcppList.h
===================================================================
--- pkg/Rcpp/inst/include/RcppList.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppList.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,57 +0,0 @@
-// -*- 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);
-
- // defined later because it needs wrap
- template <typename T>
- void append( const std::string& name, const T& value ) throw(std::range_error) ;
-
- void clearProtectionStack();
- SEXP getList(void) const;
-
-protected:
- friend class RcppResultSet;
-
-private:
- SEXP listArg;
- int listSize, currListPosn, numProtected;
- std::vector<std::string> names;
-};
-
-namespace Rcpp{
- template<> inline SEXP wrap<RcppList>( const RcppList& x ){
- return x.getList( ) ;
- }
-}
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppList__backward.h
===================================================================
--- pkg/Rcpp/inst/include/RcppList__backward.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppList__backward.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppList__backward.h: Rcpp R/C++ interface class library --
-//
-// Copyright (C) 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 RcppList__backward_h
-#define RcppList__backward_h
-
-template <typename T>
-void RcppList::append( const std::string& name, const T& value ) throw(std::range_error) {
- if (currListPosn < 0 || currListPosn >= listSize)
- throw std::range_error("RcppList::append(): list posn out of range");
-
- SET_VECTOR_ELT(listArg, currListPosn++, Rcpp::wrap(value) );
- names.push_back(name);
-}
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppMatrix.h
===================================================================
--- pkg/Rcpp/inst/include/RcppMatrix.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppMatrix.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,151 +0,0 @@
-// -*- 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;
-};
-
-template <typename T>
-RcppMatrix<T>::RcppMatrix(SEXP mat) {
-
- if (!Rf_isNumeric(mat) || !Rf_isMatrix(mat))
- throw std::range_error("RcppMatrix: invalid numeric matrix in constructor");
-
- // Get matrix dimensions
- SEXP dimAttr = Rf_getAttrib(mat, R_DimSymbol);
- dim1 = INTEGER(dimAttr)[0];
- dim2 = INTEGER(dimAttr)[1];
-
- // We guard against the possibility that R might pass an integer matrix.
- // Can be prevented using R code: temp <- as.double(a), dim(temp) <- dim(a)
- int i,j;
- int isInt = Rf_isInteger(mat);
- T *m = (T *)R_alloc(dim1*dim2, sizeof(T));
- a = (T **)R_alloc(dim1, sizeof(T *));
- for (i = 0; i < dim1; i++)
- a[i] = m + i*dim2;
- if (isInt) {
- for (i=0; i < dim1; i++)
- for (j=0; j < dim2; j++)
- a[i][j] = (T)(INTEGER(mat)[i+dim1*j]);
- }
- else {
- for (i=0; i < dim1; i++)
- for (j=0; j < dim2; j++)
- a[i][j] = (T)(REAL(mat)[i+dim1*j]);
- }
-}
-
-template <typename T>
-RcppMatrix<T>::RcppMatrix(int _dim1, int _dim2) {
- dim1 = _dim1;
- dim2 = _dim2;
- int i,j;
- T *m = (T *)R_alloc(dim1*dim2, sizeof(T));
- a = (T **)R_alloc(dim1, sizeof(T *));
- for (i = 0; i < dim1; i++)
- a[i] = m + i*dim2;
- for (i=0; i < dim1; i++)
- for (j=0; j < dim2; j++)
- a[i][j] = 0;
-}
-
-template <typename T> int RcppMatrix<T>::getDim1() const {
- return dim1;
-}
-
-template <typename T> int RcppMatrix<T>::getDim2() const {
- return dim2;
-}
-
-template <typename T> int RcppMatrix<T>::rows() const {
- return dim1;
-}
-
-template <typename T> int RcppMatrix<T>::cols() const {
- return dim2;
-}
-
-template <typename T>
-T& RcppMatrix<T>::operator()(int i, int j) const {
- if (i < 0 || i >= dim1 || j < 0 || j >= dim2) {
- std::ostringstream oss;
- oss << "RcppMatrix: subscripts out of range: " << i << ", " << j;
- throw std::range_error(oss.str());
- }
- return a[i][j];
-}
-
-template <typename T>
-T **RcppMatrix<T>::cMatrix() {
- int i,j;
- T *m = (T *)R_alloc(dim1*dim2, sizeof(T));
- T **tmp = (T **)R_alloc(dim1, sizeof(T *));
- for (i = 0; i < dim1; i++)
- tmp[i] = m + i*dim2;
- for (i=0; i < dim1; i++)
- for (j=0; j < dim2; j++)
- tmp[i][j] = a[i][j];
- return tmp;
-}
-
-template <typename T>
-std::vector<std::vector<T> > RcppMatrix<T>::stlMatrix() {
- int i,j;
- std::vector<std::vector<T> > temp;
- for (i = 0; i < dim1; i++) {
- temp.push_back(std::vector<T>(dim2));
- }
- for (i = 0; i < dim1; i++)
- for (j = 0; j < dim2; j++)
- temp[i][j] = a[i][j];
- return temp;
-}
-
-namespace Rcpp{
-
-template <> SEXP wrap( const RcppMatrix<int>& );
-
-template <> SEXP wrap( const RcppMatrix<double>& );
-
-}
-
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppMatrixView.h
===================================================================
--- pkg/Rcpp/inst/include/RcppMatrixView.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppMatrixView.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,87 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppMatrixView.h: Rcpp R/C++ interface class library -- templated matrix view
-//
-// 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 RcppMatrixView_h
-#define RcppMatrixView_h
-
-#include <RcppCommon.h>
-
-template <typename T>
-class RcppMatrixView {
-public:
- RcppMatrixView(SEXP mat);
- int dim1() const;
- int dim2() const;
- int rows() const;
- int cols() const;
- T operator()(int i, int j) const;
-private:
- int d1, d2;
- T *a;
-};
-
-template <typename T>
-RcppMatrixView<T>::RcppMatrixView(SEXP mat) {
- if (!Rf_isNumeric(mat) || !Rf_isMatrix(mat))
- throw std::range_error("RcppMatrixView: invalid numeric matrix in constructor");
- // Get matrix dimensions
- SEXP dimAttr = Rf_getAttrib(mat, R_DimSymbol);
- d1 = INTEGER(dimAttr)[0];
- d2 = INTEGER(dimAttr)[1];
- if (Rf_isInteger(mat)) {
- a = (T *)(INTEGER(mat));
- } else if (Rf_isReal(mat)) {
- a = (T *)(REAL(mat));
- }
-}
-
-template <typename T>
-inline int RcppMatrixView<T>::dim1() const {
- return d1;
-}
-
-template <typename T>
-inline int RcppMatrixView<T>::dim2() const {
- return d2;
-}
-
-template <typename T>
-inline int RcppMatrixView<T>::rows() const {
- return d1;
-}
-
-template <typename T>
-inline int RcppMatrixView<T>::cols() const {
- return d2;
-}
-
-template <typename T>
-inline T RcppMatrixView<T>::operator()(int i, int j) const {
- if (i < 0 || i >= d1 || j < 0 || j >= d2) {
- std::ostringstream oss;
- oss << "RcppMatrixView: subscripts out of range: " << i << ", " << j;
- throw std::range_error(oss.str());
- }
- return a[i + d1 * j];
-}
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppMatrix__backward.h
===================================================================
--- pkg/Rcpp/inst/include/RcppMatrix__backward.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppMatrix__backward.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,54 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppMatrix_backward.h: Rcpp R/C++ interface class library -- templated matrix support
-//
-// Copyright (C) 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 RcppMatrix__backward_h
-#define RcppMatrix__backward_h
-
-#include <RcppCommon.h>
-
-namespace Rcpp{
-namespace internal{
-
- template <typename T>
- SEXP wrap__old__rcppmatrix( const ::RcppMatrix<T>& x ){
- int nx = x.rows() ;
- int ny = x.cols() ;
- Rcpp::Matrix< Rcpp::traits::r_sexptype_traits<T>::rtype > mat( nx, ny ) ;
- for (int i = 0; i < nx; i++)
- for (int j = 0; j < ny; j++)
- mat[i + nx*j] = x(i,j);
- return mat ;
- }
-}
-
-template <>
-inline SEXP wrap( const RcppMatrix<int>& x){
- return internal::wrap__old__rcppmatrix( x );
-}
-template <>
-inline SEXP wrap( const RcppMatrix<double>& x){
- return internal::wrap__old__rcppmatrix( x );
-}
-
-
-}
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppNumList.h
===================================================================
--- pkg/Rcpp/inst/include/RcppNumList.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppNumList.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,40 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppNumList.h: Rcpp R/C++ interface class library -- numlist type
-//
-// 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 RcppNumList_h
-#define RcppNumList_h
-
-#include <RcppCommon.h>
-
-class RcppNumList {
-public:
- RcppNumList(SEXP theList);
- std::string getName(int i) const;
- double getValue(int i) const;
- int size() const;
-private:
- int len;
- SEXP namedList;
- SEXP names;
-};
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppParams.h
===================================================================
--- pkg/Rcpp/inst/include/RcppParams.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppParams.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,47 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppParams.h: Rcpp R/C++ interface class library -- Parameters from R
-//
-// 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 RcppParams_h
-#define RcppParams_h
-
-#include <RcppCommon.h>
-#include <RcppDate.h>
-#include <RcppDatetime.h>
-
-class RcppParams {
-public:
- RcppParams(SEXP params);
- void checkNames(char *inputNames[], int len);
- bool exists(std::string name);
- double getDoubleValue(std::string name);
- int getIntValue(std::string name);
- std::string getStringValue(std::string name);
- bool getBoolValue(std::string name);
- RcppDate getDateValue(std::string name);
- RcppDatetime getDatetimeValue(std::string name);
-
-private:
- std::map<std::string, int> pmap;
- SEXP _params;
-};
-
-#endif
Deleted: pkg/Rcpp/inst/include/RcppResultSet.h
===================================================================
--- pkg/Rcpp/inst/include/RcppResultSet.h 2010-06-25 14:51:57 UTC (rev 1733)
+++ pkg/Rcpp/inst/include/RcppResultSet.h 2010-06-25 14:56:00 UTC (rev 1734)
@@ -1,94 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RcppResultSet.h: Rcpp R/C++ interface class library -- Results back to R
-//
-// Copyright (C) 2005 - 2006 Dominick Samperi
-// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
-// Copyright (C) 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 RcppResultSet_h
-#define RcppResultSet_h
-
-#include <RcppCommon.h>
-
-#include <RcppDate.h>
-#include <RcppDateVector.h>
-#include <RcppDatetime.h>
-#include <RcppDatetimeVector.h>
-#include <RcppStringVector.h>
-#include <RcppFrame.h>
-#include <RcppList.h>
-#include <RcppMatrix.h>
-#include <RcppNumList.h>
-#include <RcppStringVector.h>
-#include <RcppVector.h>
-
-namespace Rcpp {
- // template specialisation for wrap() on the date and datetime classes
- template <> SEXP wrap<RcppDate>(const RcppDate &date);
- template <> SEXP wrap<RcppDatetime>(const RcppDatetime &date);
- template <> SEXP wrap<RcppDateVector>(const RcppDateVector &datevec);
- template <> SEXP wrap<RcppDatetimeVector>(const RcppDatetimeVector &dtvec);
-}
-
-class RcppResultSet {
-public:
- typedef std::pair<const std::string,SEXP> PAIR ;
- typedef std::list<PAIR> LIST ;
-
- RcppResultSet();
-
- template <typename T>
- void add(const std::string& name, const T& object){
- return add__impl( name, object ) ;
- }
-
- void add(const std::string&, double *, int);
- void add(const std::string&, int *, int);
- void add(const std::string&, double **, int, int);
- void add(const std::string&, int **, int, int);
-
- void add(const std::string& name , const std::vector<std::vector<double> >& object) ;
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 1734
More information about the Rcpp-commits
mailing list