00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 00002 // 00003 // RcppFunction.h: Rcpp R/C++ interface class library -- function support 00004 // 00005 // Copyright (C) 2005 - 2006 Dominick Samperi 00006 // Copyright (C) 2008 - 2009 Dirk Eddelbuettel 00007 // 00008 // This file is part of Rcpp. 00009 // 00010 // Rcpp is free software: you can redistribute it and/or modify it 00011 // under the terms of the GNU General Public License as published by 00012 // the Free Software Foundation, either version 2 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // Rcpp is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 00022 00023 #ifndef RcppFunction_h 00024 #define RcppFunction_h 00025 00026 #include <RcppCommon.h> 00027 #include <RcppDate.h> 00028 #include <RcppDatetime.h> 00029 00030 class RcppFunction { 00031 public: 00032 RcppFunction(SEXP fn); 00033 ~RcppFunction(); 00034 SEXP listCall(); 00035 SEXP vectorCall(); 00036 void setRVector(std::vector<double>& v); 00037 void setRListSize(int size); 00038 void appendToRList(std::string name, double value); 00039 void appendToRList(std::string name, int value); 00040 void appendToRList(std::string name, std::string value); 00041 void appendToRList(std::string name, RcppDate& date); 00042 void appendToRList(std::string name, RcppDatetime& datetime); 00043 void clearProtectionStack(); 00044 00045 private: 00046 SEXP fn, listArg, vectorArg; 00047 int listSize, currListPosn, numProtected; 00048 std::vector<std::string> names; 00049 }; 00050 00051 #endif