1#ifndef RDS2CPP_ROBJECT_HPP
2#define RDS2CPP_ROBJECT_HPP
12#include "utils_other.hpp"
118 auto idx = symbols.size();
119 symbols.emplace_back(std::move(name), encoding);
244 std::unique_ptr<RObject>
tag;
307template<
typename ElementType, SEXPType stype>
316 static constexpr SEXPType vector_sexp_type = stype;
431 std::vector<std::unique_ptr<RObject> >
data;
465 std::optional<SymbolIndex>
tag;
482 std::vector<PairListElement>
data;
561 std::optional<SymbolIndex>
name;
613 std::vector<std::unique_ptr<RObject> >
data;
Parse an RDS file in C++.
Definition StringEncoding.hpp:12
AtomicVector< unsigned char, SEXPType::RAW > RawVector
Raw vector.
Definition RObject.hpp:352
AtomicVector< double, SEXPType::REAL > DoubleVector
Double-precision vector.
Definition RObject.hpp:347
StringEncoding
Definition StringEncoding.hpp:17
SymbolIndex register_symbol(std::string name, StringEncoding encoding, std::vector< Symbol > &symbols)
Definition RObject.hpp:117
AtomicVector< std::int32_t, SEXPType::INT > IntegerVector
Integer vector.
Definition RObject.hpp:337
AtomicVector< std::int32_t, SEXPType::LGL > LogicalVector
Logical vector.
Definition RObject.hpp:342
SEXPType
Definition SEXPType.hpp:31
AtomicVector< std::complex< double >, SEXPType::CPLX > ComplexVector
Complex vector.
Definition RObject.hpp:357
constexpr Dest_ cast(Value_ x)
Vector of some atomic type.
Definition RObject.hpp:308
SEXPType type() const
Definition RObject.hpp:321
std::vector< ElementType > data
Definition RObject.hpp:326
std::vector< Attribute > attributes
Definition RObject.hpp:331
Attribute name and value.
Definition RObject.hpp:278
SymbolIndex name
Definition RObject.hpp:293
std::unique_ptr< RObject > value
Definition RObject.hpp:298
Attribute(SymbolIndex name, std::unique_ptr< RObject > value)
Definition RObject.hpp:288
Built-in function.
Definition RObject.hpp:526
SEXPType type() const
Definition RObject.hpp:527
std::string name
Definition RObject.hpp:532
Reference to an environment.
Definition RObject.hpp:134
std::size_t index
Definition RObject.hpp:162
SEXPType env_type
Definition RObject.hpp:167
EnvironmentIndex(SEXPType e)
Definition RObject.hpp:143
EnvironmentIndex()=default
SEXPType type() const
Definition RObject.hpp:156
EnvironmentIndex(std::size_t i)
Definition RObject.hpp:150
Variable in an Environment.
Definition RObject.hpp:173
EnvironmentVariable(SymbolIndex name, std::unique_ptr< RObject > value)
Definition RObject.hpp:183
EnvironmentVariable()=default
SymbolIndex name
Definition RObject.hpp:188
std::unique_ptr< RObject > value
Definition RObject.hpp:192
An R environment.
Definition RObject.hpp:198
bool hashed
Definition RObject.hpp:207
bool locked
Definition RObject.hpp:202
std::vector< Attribute > attributes
Definition RObject.hpp:229
std::vector< EnvironmentVariable > variables
Definition RObject.hpp:224
std::size_t parent
Definition RObject.hpp:219
SEXPType parent_type
Definition RObject.hpp:213
Expression vector.
Definition RObject.hpp:596
std::vector< Attribute > attributes
Definition RObject.hpp:618
std::vector< std::unique_ptr< RObject > > data
Definition RObject.hpp:613
SEXPType type() const
Definition RObject.hpp:607
Reference to an external pointer.
Definition RObject.hpp:255
ExternalPointerIndex()=default
SEXPType type() const
Definition RObject.hpp:267
ExternalPointerIndex(std::size_t i)
Definition RObject.hpp:264
std::size_t index
Definition RObject.hpp:272
An R external pointer.
Definition RObject.hpp:235
std::unique_ptr< RObject > tag
Definition RObject.hpp:244
std::unique_ptr< RObject > protection
Definition RObject.hpp:239
std::vector< Attribute > attributes
Definition RObject.hpp:249
Generic vector, i.e., an ordinary R list.
Definition RObject.hpp:415
SEXPType type() const
Definition RObject.hpp:426
std::vector< Attribute > attributes
Definition RObject.hpp:436
std::vector< std::unique_ptr< RObject > > data
Definition RObject.hpp:431
Function argument in a LanguageObject.
Definition RObject.hpp:538
LanguageArgument(SymbolIndex name, std::unique_ptr< RObject > value)
Definition RObject.hpp:549
LanguageArgument(std::unique_ptr< RObject > value)
Definition RObject.hpp:555
LanguageArgument()=default
std::optional< SymbolIndex > name
Definition RObject.hpp:561
std::unique_ptr< RObject > value
Definition RObject.hpp:567
Language object, i.e., a function call.
Definition RObject.hpp:573
std::vector< LanguageArgument > arguments
Definition RObject.hpp:585
std::vector< Attribute > attributes
Definition RObject.hpp:590
SymbolIndex function
Definition RObject.hpp:580
SEXPType type() const
Definition RObject.hpp:575
R's NULL value.
Definition RObject.hpp:52
SEXPType type() const
Definition RObject.hpp:53
Element of a PairList.
Definition RObject.hpp:442
PairListElement(SymbolIndex tag, std::unique_ptr< RObject > value)
Definition RObject.hpp:459
std::optional< SymbolIndex > tag
Definition RObject.hpp:465
PairListElement()=default
PairListElement(std::unique_ptr< RObject > value)
Definition RObject.hpp:452
std::unique_ptr< RObject > value
Definition RObject.hpp:470
Pairlist, i.e., a linked list.
Definition RObject.hpp:476
std::vector< PairListElement > data
Definition RObject.hpp:482
SEXPType type() const
Definition RObject.hpp:477
std::vector< Attribute > attributes
Definition RObject.hpp:487
Virtual class for all unserialized R objects.
Definition RObject.hpp:27
virtual SEXPType type() const =0
S4 object.
Definition RObject.hpp:493
StringEncoding package_encoding
Definition RObject.hpp:514
std::string class_name
Definition RObject.hpp:499
StringEncoding class_encoding
Definition RObject.hpp:504
std::string package_name
Definition RObject.hpp:509
SEXPType type() const
Definition RObject.hpp:494
std::vector< Attribute > attributes
Definition RObject.hpp:520
String vector.
Definition RObject.hpp:390
std::vector< String > data
Definition RObject.hpp:404
std::vector< Attribute > attributes
Definition RObject.hpp:409
SEXPType type() const
Definition RObject.hpp:399
Single string in a StringVector.
Definition RObject.hpp:362
StringEncoding encoding
Definition RObject.hpp:384
std::optional< std::string > value
Definition RObject.hpp:378
String(std::string value, StringEncoding encoding)
Definition RObject.hpp:372
Reference to a language symbol.
Definition RObject.hpp:85
SEXPType type() const
Definition RObject.hpp:97
SymbolIndex(std::size_t i)
Definition RObject.hpp:94
std::size_t index
Definition RObject.hpp:102
An R symbol.
Definition RObject.hpp:59
std::string name
Definition RObject.hpp:74
Symbol(std::string name, StringEncoding encoding)
Definition RObject.hpp:69
StringEncoding encoding
Definition RObject.hpp:79