Skip to content

Commit b502253

Browse files
merge Rcppp.h and RcppCommon.h closes #115
1 parent aadd90c commit b502253

2 files changed

Lines changed: 154 additions & 163 deletions

File tree

inst/include/Rcpp.h

Lines changed: 154 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,161 @@
11
#ifndef Rcpp11_h
22
#define Rcpp11_h
33

4-
#if defined(Rcpp_hpp)
5-
# error "Detecting Rcpp. It is probably a bad idea to compile against Rcpp11 and Rcpp together"
6-
#endif
4+
// #define RCPP_DEBUG_LEVEL 1
5+
6+
#include <cmath>
7+
#include <csetjmp>
8+
9+
#include <initializer_list>
10+
#include <unordered_map>
11+
#include <unordered_set>
12+
13+
#include <Rcpp/macros/macros.h>
14+
#include <Rcpp/R.h>
15+
16+
#include <Rcpp/routines.h>
17+
#include <Rcpp/cache.h>
18+
19+
#include <Rcpp/protection/protection.h>
20+
21+
#define RCPP_SET_VECTOR_ELT SET_VECTOR_ELT
22+
// #define RCPP_SET_VECTOR_ELT(v,i,x) { Rprintf("SET_VECTOR_ELT(%p, %d, %p). file = %s, line = %d\n", (SEXP)v, i, (SEXP)x, __FILE__, __LINE__) ; SET_VECTOR_ELT( (SEXP)v,i,(SEXP)x) ; }
23+
24+
#include <cstdint>
25+
#include <array>
26+
#include <type_traits>
27+
#include <iterator>
28+
#include <exception>
29+
#include <iostream>
30+
#include <sstream>
31+
#include <string>
32+
#include <list>
33+
#include <forward_list>
34+
#include <stack>
35+
#include <queue>
36+
#include <cxxabi.h>
37+
38+
#include <map>
39+
#include <set>
40+
#include <stdexcept>
41+
#include <vector>
42+
#include <deque>
43+
#include <functional>
44+
#include <numeric>
45+
#include <algorithm>
46+
#include <complex>
47+
#include <limits>
48+
#include <typeinfo>
49+
#include <tuple>
50+
#include <utility>
51+
#include <future>
52+
#include <Rcpp/complex.h>
53+
54+
#include <Rcpp/exceptions.h>
55+
#include <Rcpp/Demangler.h>
56+
57+
namespace Rcpp{
58+
59+
inline const char* short_file_name(const char* file) {
60+
std::string f(file) ;
61+
return f.substr( f.find_last_of("/") + 1 ).c_str() ;
62+
}
63+
64+
class String ;
65+
template <typename CLASS> class PreserveStorage ;
66+
template <typename CLASS> class NoProtectStorage ;
67+
68+
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage>
69+
class Vector ;
70+
71+
template <int RTYPE> class Matrix ;
72+
using CharacterVector = Vector<STRSXP> ;
73+
using List = Vector<VECSXP> ;
74+
using ExpressionVector = Vector<EXPRSXP> ;
75+
76+
RCPP_API_CLASS_DECL(RObject)
77+
RCPP_API_CLASS_DECL(Language)
78+
RCPP_API_CLASS_DECL(Pairlist) ;
79+
RCPP_API_CLASS_DECL(Environment) ;
80+
RCPP_API_CLASS_DECL(Promise) ;
81+
RCPP_API_CLASS_DECL(WeakReference) ;
82+
RCPP_API_CLASS_DECL(S4) ;
83+
RCPP_API_CLASS_DECL(Formula) ;
84+
RCPP_API_CLASS_DECL(Reference) ;
85+
86+
template < template <class> class StoragePolicy, bool fast > class Function_Impl ;
87+
using Function = Function_Impl<PreserveStorage, false> ;
88+
using FastFunction = Function_Impl<PreserveStorage, true> ;
89+
90+
template < template <class> class StoragePolicy > class Symbol_Impl ;
91+
using Symbol = Symbol_Impl<NoProtectStorage> ;
92+
93+
template < template <class> class StoragePolicy > class DataFrame_Impl ;
94+
using DataFrame = DataFrame_Impl<PreserveStorage> ;
95+
96+
}
97+
namespace Rcpp{
98+
inline SEXP Rcpp_PreserveObject(SEXP x){
99+
if( x != R_NilValue ) {
100+
R_PreserveObject(x);
101+
}
102+
return x ;
103+
}
104+
105+
inline void Rcpp_ReleaseObject(SEXP x){
106+
if (x != R_NilValue) {
107+
R_ReleaseObject(x);
108+
}
109+
}
110+
111+
inline SEXP Rcpp_ReplaceObject(SEXP x, SEXP y){
112+
if( x == R_NilValue ){
113+
Rcpp_PreserveObject( y ) ;
114+
} else if( y == R_NilValue ){
115+
Rcpp_ReleaseObject( x ) ;
116+
} else {
117+
// if we are setting to the same SEXP as we already have, do nothing
118+
if (x != y) {
119+
120+
// the previous SEXP was not NULL, so release it
121+
Rcpp_ReleaseObject(x);
122+
123+
// the new SEXP is not NULL, so preserve it
124+
Rcpp_PreserveObject(y);
125+
}
126+
}
127+
return y ;
128+
}
129+
}
130+
131+
#include <Rcpp/internal/na.h>
132+
#include <Rcpp/traits/traits.h>
133+
#include <Rcpp/Named.h>
134+
135+
#include <Rcpp/internal/caster.h>
136+
#include <Rcpp/internal/r_vector.h>
137+
#include <Rcpp/r_cast.h>
138+
139+
#include <Rcpp/internal/export.h>
140+
#include <Rcpp/internal/r_coerce.h>
141+
#include <Rcpp/as.h>
142+
#include <Rcpp/InputParameter.h>
143+
#include <Rcpp/is.h>
144+
145+
#include <Rcpp/vector/VectorBase.h>
146+
#include <Rcpp/vector/MatrixBase.h>
147+
148+
#include <Rcpp/wrap/wrap.h>
149+
150+
#include <Rcpp/internal/Proxy_Iterator.h>
151+
#include <Rcpp/internal/const_Proxy_Iterator.h>
152+
#include <Rcpp/internal/converter.h>
153+
154+
#include <Rcpp/sugar/sugar_forward.h>
155+
156+
#include <Rcpp/longlong.h>
157+
#include <Rcpp/transient_vector.h>
7158

8-
#include <RcppCommon.h>
9159
#include <Rcpp/registration/registration.h>
10160

11161
#include <Rcpp/exceptions.h>

inst/include/RcppCommon.h

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)