/usr/lib/R/site-library/dplyr/include/dplyr/NamedListAccumulator.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 | #ifndef dplyr_NamedListAccumulator_H
#define dplyr_NamedListAccumulator_H
#include <tools/SymbolMap.h>
#include <dplyr/checks.h>
namespace dplyr {
template <typename Data>
class NamedListAccumulator {
private:
SymbolMap symbol_map;
std::vector<RObject> data; // owns the results
public:
NamedListAccumulator() {}
inline void set(const SymbolString& name, RObject x) {
if (! Rcpp::traits::same_type<Data, RowwiseDataFrame>::value)
check_supported_type(x, name);
SymbolMapIndex index = symbol_map.insert(name);
if (index.origin == NEW) {
data.push_back(x);
} else {
data[ index.pos ] = x;
}
}
inline void rm(const SymbolString& name) {
SymbolMapIndex index = symbol_map.rm(name);
if (index.origin != NEW) {
data.erase(data.begin() + index.pos);
}
}
inline operator List() const {
List out = wrap(data);
out.names() = symbol_map.get_names();
return out;
}
inline size_t size() const {
return data.size();
}
inline const SymbolVector names() const {
return symbol_map.get_names();
}
};
}
#endif
|