rds2cpp
C++ library for parsing RDS files
Loading...
Searching...
No Matches
Environment.hpp
Go to the documentation of this file.
1#ifndef RDS2CPP_ENVIRONMENT_HPP
2#define RDS2CPP_ENVIRONMENT_HPP
3
4#include <vector>
5#include <string>
6#include "StringEncoding.hpp"
7#include "SEXPType.hpp"
8
15namespace rds2cpp {
16
24 bool locked = false;
25
29 bool hashed = false;
30
35 SEXPType parent_type = SEXPType::GLOBALENV_;
36
41 size_t parent = -1;
42
46 std::vector<std::string> variable_names;
47
51 std::vector<StringEncoding> variable_encodings;
52
56 std::vector<std::unique_ptr<RObject> > variable_values;
57
66 void add(std::string n, RObject* v, StringEncoding enc = StringEncoding::UTF8) {
67 variable_names.push_back(std::move(n));
68 variable_values.emplace_back(v);
69 variable_encodings.push_back(enc);
70 }
71
79 void add(std::string n, std::unique_ptr<RObject> v, StringEncoding enc = StringEncoding::UTF8) {
80 variable_names.push_back(std::move(n));
81 variable_values.push_back(std::move(v));
82 variable_encodings.push_back(enc);
83 }
84
89};
90
91}
92
93#endif
94
R data types.
String encodings.
Parse an RDS file in C++.
Definition StringEncoding.hpp:10
StringEncoding
Definition StringEncoding.hpp:15
SEXPType
Definition SEXPType.hpp:31
Attribute names and values.
Definition RObject.hpp:127
An R environment.
Definition Environment.hpp:20
Attributes attributes
Definition Environment.hpp:88
bool hashed
Definition Environment.hpp:29
std::vector< std::string > variable_names
Definition Environment.hpp:46
bool locked
Definition Environment.hpp:24
void add(std::string n, RObject *v, StringEncoding enc=StringEncoding::UTF8)
Definition Environment.hpp:66
void add(std::string n, std::unique_ptr< RObject > v, StringEncoding enc=StringEncoding::UTF8)
Definition Environment.hpp:79
std::vector< StringEncoding > variable_encodings
Definition Environment.hpp:51
size_t parent
Definition Environment.hpp:41
SEXPType parent_type
Definition Environment.hpp:35
std::vector< std::unique_ptr< RObject > > variable_values
Definition Environment.hpp:56
Virtual class for all unserialized R objects.
Definition RObject.hpp:22