/usr/lib/R/site-library/dplyr/include/dplyr/Result/GroupedCallProxy.h is in r-cran-dplyr 0.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #ifndef dplyr_GroupedCallProxy_H
#define dplyr_GroupedCallProxy_H
#include <dplyr/Hybrid.h>
#include <dplyr/Result/CallElementProxy.h>
#include <dplyr/Result/LazyGroupedSubsets.h>
#include <dplyr/Result/ILazySubsets.h>
#include <dplyr/Result/GroupedHybridCall.h>
namespace dplyr {
template <typename Data = GroupedDataFrame, typename Subsets = LazyGroupedSubsets>
class GroupedCallProxy {
public:
GroupedCallProxy(const Rcpp::Call& call_, const Subsets& subsets_, const Environment& env_) :
subsets(subsets_), proxies()
{
set_call(call_);
set_env(env_);
}
GroupedCallProxy(const Rcpp::Call& call_, const Data& data_, const Environment& env_) :
subsets(data_), proxies()
{
set_call(call_);
set_env(env_);
}
GroupedCallProxy(const Data& data_, const Environment& env_) :
subsets(data_), proxies()
{
set_env(env_);
}
GroupedCallProxy(const Data& data_) :
subsets(data_), proxies()
{}
~GroupedCallProxy() {}
public:
SEXP eval() {
return get(NaturalSlicingIndex(subsets.nrows()));
}
SEXP get(const SlicingIndex& indices) {
subsets.clear();
return get_hybrid_eval()->eval(indices);
}
GroupedHybridEval* get_hybrid_eval() {
if (!hybrid_eval) {
hybrid_eval.reset(new GroupedHybridEval(call, subsets, env));
}
return hybrid_eval.get();
}
void set_call(SEXP call_) {
proxies.clear();
hybrid_eval.reset();
call = call_;
}
inline void set_env(SEXP env_) {
env = env_;
hybrid_eval.reset();
}
void input(const SymbolString& name, SEXP x) {
subsets.input(name, x);
hybrid_eval.reset();
}
inline int nsubsets() const {
return subsets.size();
}
inline bool has_variable(const SymbolString& name) const {
return subsets.has_variable(name);
}
inline SEXP get_variable(const SymbolString& name) const {
return subsets.get_variable(name);
}
inline bool is_constant() const {
return TYPEOF(call) != LANGSXP && Rf_length(call) == 1;
}
private:
Rcpp::Call call;
Subsets subsets;
std::vector<CallElementProxy> proxies;
Environment env;
boost::scoped_ptr<GroupedHybridEval> hybrid_eval;
};
}
#endif
|