Rcpp Version 1.0.0
RcppCommon.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 // RcppCommon.h: Rcpp R/C++ interface class library -- common include and defines statements
4 //
5 // Copyright (C) 2008 - 2009 Dirk Eddelbuettel
6 // Copyright (C) 2009 - 2017 Dirk Eddelbuettel and Romain Francois
7 //
8 // This file is part of Rcpp.
9 //
10 // Rcpp is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // Rcpp is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef RcppCommon_h
24 #define RcppCommon_h
25 
26 // #define RCPP_DEBUG_LEVEL 1
27 // #define RCPP_DEBUG_MODULE_LEVEL 1
28 
29 #include <Rcpp/r/headers.h>
30 
34 namespace Rcpp {
35 
39  namespace traits {
40  } // traits
41 
45  namespace internal {
46  } // internal
47 } // Rcpp
48 
49 #include <iterator>
50 #include <exception>
51 #include <iostream>
52 #include <iomanip>
53 #include <sstream>
54 #include <string>
55 #include <list>
56 #include <map>
57 #include <set>
58 #include <stdexcept>
59 #include <vector>
60 #include <deque>
61 #include <functional>
62 #include <numeric>
63 #include <algorithm>
64 #include <complex>
65 #include <limits>
66 #include <typeinfo>
67 #include <Rcpp/sprintf.h>
68 #include <R_ext/Callbacks.h>
69 #include <R_ext/Visibility.h>
70 #include <Rcpp/utils/tinyformat.h>
71 
72 #include <Rmath.h>
73 #include <Rcpp/sugar/undoRmath.h>
74 
75 namespace Rcpp {
76 
77  SEXP Rcpp_fast_eval(SEXP expr_, SEXP env);
78  SEXP Rcpp_eval(SEXP expr_, SEXP env = R_GlobalEnv);
79 
80  namespace internal {
81  SEXP Rcpp_eval_impl(SEXP expr, SEXP env);
82  }
83 
84  class Module;
85 
86  namespace traits {
87  template <typename T> class named_object;
88  }
89 
90  inline SEXP Rcpp_PreserveObject(SEXP x) {
91  if (x != R_NilValue) {
92  R_PreserveObject(x);
93  }
94  return x;
95  }
96 
97  inline void Rcpp_ReleaseObject(SEXP x) {
98  if (x != R_NilValue) {
99  R_ReleaseObject(x);
100  }
101  }
102 
103  inline SEXP Rcpp_ReplaceObject(SEXP x, SEXP y) {
104  if (Rf_isNull(x)) {
106  } else if (Rf_isNull(y)) {
107  Rcpp_ReleaseObject(x); // #nocov
108  } else {
109  // if we are setting to the same SEXP as we already have, do nothing
110  if (x != y) {
111 
112  // the previous SEXP was not NULL, so release it
114 
115  // the new SEXP is not NULL, so preserve it
117 
118  }
119  }
120  return y;
121  }
122 
123 }
124 
125 #include <Rcpp/storage/storage.h>
127 #include <Rcpp/routines.h>
128 #include <Rcpp/exceptions.h>
129 #include <Rcpp/proxy/proxy.h>
130 
131 #ifdef RCPP_USING_UNWIND_PROTECT
132  #include <Rcpp/unwindProtect.h>
133 #endif
134 
135 #include <Rcpp/lang.h>
136 #include <Rcpp/complex.h>
137 #include <Rcpp/barrier.h>
138 
139 #define RcppExport extern "C" attribute_visible
140 
141 #include <Rcpp/Interrupt.h>
142 
143 namespace Rcpp {
144  template <typename T> class object;
145  class String;
146  namespace internal {
147  template <typename Class> SEXP make_new_object(Class* ptr);
148  }
149 }
150 
151 #include <Rcpp/longlong.h>
152 
153 #include <Rcpp/internal/na.h>
154 #include <Rcpp/internal/NAComparator.h>
155 #include <Rcpp/internal/NAEquals.h>
156 
157 #include <Rcpp/traits/traits.h>
158 #include <Rcpp/Named.h>
159 
160 #include <Rcpp/internal/caster.h>
161 #include <Rcpp/internal/r_vector.h>
162 #include <Rcpp/r_cast.h>
163 
164 #include <Rcpp/api/bones/bones.h>
165 
166 #include <Rcpp/internal/export.h>
167 #include <Rcpp/internal/r_coerce.h>
168 #include <Rcpp/as.h>
169 #include <Rcpp/InputParameter.h>
170 #include <Rcpp/is.h>
171 
172 #include <Rcpp/vector/VectorBase.h>
173 #include <Rcpp/vector/MatrixBase.h>
174 
175 #include <Rcpp/internal/ListInitialization.h>
176 #include <Rcpp/internal/Proxy_Iterator.h>
177 #include <Rcpp/internal/SEXP_Iterator.h>
178 #include <Rcpp/internal/converter.h>
179 
180 #include <Rcpp/print.h>
181 #include <Rcpp/algo.h>
182 
184 
186 
187 #include <Rcpp/internal/wrap.h>
188 
189 #endif
SEXP Rcpp_fast_eval(SEXP expr, SEXP env)
Definition: Rcpp_eval.h:68
SEXP Rcpp_ReplaceObject(SEXP x, SEXP y)
Definition: RcppCommon.h:103
SEXP Rcpp_eval_impl(SEXP expr, SEXP env)
Definition: Rcpp_eval.h:48
SEXP make_new_object(Class *ptr)
Definition: Module.h:77
SEXP Rcpp_eval(SEXP expr, SEXP env)
Definition: Rcpp_eval.h:75
Rcpp API.
Definition: algo.h:28
void Rcpp_ReleaseObject(SEXP x)
Definition: RcppCommon.h:97
SEXP Rcpp_PreserveObject(SEXP x)
Definition: RcppCommon.h:90