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 <cstddef>
7
8#include "StringEncoding.hpp"
9#include "SEXPType.hpp"
10
17namespace rds2cpp {
18
26 bool locked = false;
27
31 bool hashed = false;
32
37 SEXPType parent_type = SEXPType::GLOBALENV_;
38
43 std::size_t parent = -1;
44
48 std::vector<std::string> variable_names;
49
53 std::vector<StringEncoding> variable_encodings;
54
58 std::vector<std::unique_ptr<RObject> > variable_values;
59
68 void add(std::string n, RObject* v, StringEncoding enc = StringEncoding::UTF8) {
69 variable_names.push_back(std::move(n));
70 variable_values.emplace_back(v);
71 variable_encodings.push_back(enc);
72 }
73
81 void add(std::string n, std::unique_ptr<RObject> v, StringEncoding enc = StringEncoding::UTF8) {
82 variable_names.push_back(std::move(n));
83 variable_values.push_back(std::move(v));
84 variable_encodings.push_back(enc);
85 }
86
91};
92
93}
94
95#endif
96
R data types.
String encodings.
Parse an RDS file in C++.
Definition StringEncoding.hpp:12
StringEncoding
Definition StringEncoding.hpp:17
SEXPType
Definition SEXPType.hpp:31
Attribute names and values.
Definition RObject.hpp:131
An R environment.
Definition Environment.hpp:22
Attributes attributes
Definition Environment.hpp:90
bool hashed
Definition Environment.hpp:31
std::vector< std::string > variable_names
Definition Environment.hpp:48
bool locked
Definition Environment.hpp:26
void add(std::string n, RObject *v, StringEncoding enc=StringEncoding::UTF8)
Definition Environment.hpp:68
void add(std::string n, std::unique_ptr< RObject > v, StringEncoding enc=StringEncoding::UTF8)
Definition Environment.hpp:81
std::size_t parent
Definition Environment.hpp:43
std::vector< StringEncoding > variable_encodings
Definition Environment.hpp:53
SEXPType parent_type
Definition Environment.hpp:37
std::vector< std::unique_ptr< RObject > > variable_values
Definition Environment.hpp:58
Virtual class for all unserialized R objects.
Definition RObject.hpp:26