Rcpp Version 1.0.9
CppFunction.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // CppFunction.h: Rcpp R/C++ interface class library -- C++ exposed function
4 //
5 // Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
6 //
7 // This file is part of Rcpp.
8 //
9 // Rcpp is free software: you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // Rcpp is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef Rcpp_Module_CppFunction_h
23 #define Rcpp_Module_CppFunction_h
24 
25 namespace Rcpp {
26 
32  public:
34  virtual ~CppFunctionBase(){} ;
35 
40  virtual SEXP operator()(SEXP*) {
41  return R_NilValue ;
42  }
43 
44  };
45 
52  class CppFunction : public CppFunctionBase {
53  public:
54  CppFunction(const char* doc = 0) : docstring( doc == 0 ? "" : doc) {}
55  virtual ~CppFunction(){} ;
56 
60  virtual int nargs(){ return 0 ; }
61 
65  virtual bool is_void(){ return false ; }
66 
70  virtual void signature(std::string&, const char* ){}
71 
75  virtual SEXP get_formals(){ return R_NilValue; }
76 
81  virtual DL_FUNC get_function_ptr() = 0 ;
82 
86  std::string docstring ;
87  };
88 
89 }
90 #endif
virtual ~CppFunctionBase()
Definition: CppFunction.h:34
virtual SEXP operator()(SEXP *)
Definition: CppFunction.h:40
virtual int nargs()
Definition: CppFunction.h:60
virtual DL_FUNC get_function_ptr()=0
virtual SEXP get_formals()
Definition: CppFunction.h:75
std::string docstring
Definition: CppFunction.h:86
CppFunction(const char *doc=0)
Definition: CppFunction.h:54
virtual ~CppFunction()
Definition: CppFunction.h:55
virtual void signature(std::string &, const char *)
Definition: CppFunction.h:70
virtual bool is_void()
Definition: CppFunction.h:65
Rcpp API.
Definition: algo.h:28