rds2cpp
C++ library for parsing RDS files
|
Parse an RDS file in C++. More...
Classes | |
struct | AtomicVector |
Vector of some atomic type. More... | |
struct | Attributes |
Attribute names and values. More... | |
struct | BuiltInFunction |
Built-in function. More... | |
struct | Environment |
An R environment. More... | |
struct | EnvironmentIndex |
Reference to an environment. More... | |
struct | ExpressionVector |
Expression vector. More... | |
struct | ExternalPointerIndex |
Reference to an external pointer. More... | |
struct | GenericVector |
Generic vector, i.e., an ordinary R list. More... | |
struct | LanguageObject |
Language object, i.e., a function call. More... | |
struct | Null |
R's NULL value. More... | |
struct | PairList |
Pairlist, i.e., a linked list. More... | |
struct | ParseRdsOptions |
Options for parse_rds() . More... | |
struct | RdsFile |
Contents of the parsed RDS file. More... | |
struct | RObject |
Virtual class for all unserialized R objects. More... | |
struct | S4Object |
S4 object. More... | |
struct | StringVector |
String vector. More... | |
struct | Symbol |
An R symbol. More... | |
struct | SymbolIndex |
Reference to a language symbol. More... | |
Typedefs | |
typedef AtomicVector< int32_t, SEXPType::INT > | IntegerVector |
Integer vector. | |
typedef AtomicVector< int32_t, SEXPType::LGL > | LogicalVector |
Logical vector. | |
typedef AtomicVector< double, SEXPType::REAL > | DoubleVector |
Double-precision vector. | |
typedef AtomicVector< unsigned char, SEXPType::RAW > | RawVector |
Raw vector. | |
typedef AtomicVector< std::complex< double >, SEXPType::CPLX > | ComplexVector |
Complex vector. | |
typedef RdsFile | Parsed |
Enumerations | |
enum class | StringEncoding : unsigned char { NONE , LATIN1 , UTF8 , ASCII } |
enum class | SEXPType : unsigned char { NIL = 0 , SYM = 1 , LIST = 2 , CLO = 3 , ENV = 4 , PROM = 5 , LANG = 6 , SPECIAL = 7 , BUILTIN = 8 , CHAR = 9 , LGL = 10 , INT = 13 , REAL = 14 , CPLX = 15 , STR = 16 , DOT = 17 , ANY = 18 , VEC = 19 , EXPR = 20 , BCODE = 21 , EXTPTR = 22 , WEAKREF = 23 , RAW = 24 , S4 = 25 , REF = 255 , NILVALUE_ = 254 , GLOBALENV_ = 253 , UNBOUNDVALUE_ = 252 , MISSINGARG_ = 251 , BASENAMESPACE_ = 250 , NAMESPACE = 249 , PACKAGE = 248 , PERSIST = 247 , CLASSREF = 246 , GENERICREF = 245 , BCREPDEF = 244 , BCREPREF = 243 , EMPTYENV_ = 242 , BASEENV_ = 241 , ATTRLANG = 240 , ATTRLIST = 239 , ALTREP_ = 238 } |
Functions | |
template<class Reader_ > | |
RdsFile | parse_rds (Reader_ &reader, const ParseRdsOptions &options) |
RdsFile | parse_rds (std::string file, const ParseRdsOptions &options) |
template<class Writer > | |
void | write_rds (const RdsFile &info, Writer &writer) |
void | write_rds (const RdsFile &info, const char *path) |
void | write_rds (const RdsFile &info, std::string path) |
Parse an RDS file in C++.
typedef RdsFile rds2cpp::Parsed |
Typedef for back-compatibility.
|
strong |
Data types within R.
Values from 0 to 25 were taken from the R internals documentation. Of particular interest are the following:
NIL
is R's NULL
.ENV
is an R environment.LGL
is a logical vector.INT
is an integer vector.REAL
is a double vector.CPLX
is a complex vector.STR
is a string vector (also known as a character vector in R). Do not confuse this with CHAR
, which refers to an internal representation of a single string.VEC
is an ordinary R list. Do not confuse this with LIST
, which refers to a pairlist.Values from 238 to 255 were determined by inspecting the R source code.
|
strong |
Encoding options for R strings.
RdsFile rds2cpp::parse_rds | ( | Reader_ & | reader, |
const ParseRdsOptions & | options ) |
Parse the contents of an RDS file.
Reader_ | A byteme::Reader class, or any class with a compatible interface. |
reader | Instance of a Reader class, containing the contents of the RDS file. |
options | Further options for parsing. |
RdsFile
object containing the contents of the RDS file.
|
inline |
Parse the contents of an RDS file.
file | Path to an RDS file. |
options | Further options for parsing. |
RdsFile
object containing the contents of file
.
|
inline |
Write an R object to a Gzip-compressed RDS file.
info | Information about the RDS file to be written, including a pointer to a valid RObject . |
path | Path to the output file. |
|
inline |
Write an R object to a Gzip-compressed RDS file.
info | Information about the RDS file to be written, including a pointer to a valid RObject . |
path | Path to the output file. |
void rds2cpp::write_rds | ( | const RdsFile & | info, |
Writer & | writer ) |
Convert an R object into the RDS format and write it to a specified output.
Writer | A byteme::Writer class, or any class with a compatible interface. |
info | Information about the RDS file to be written, including a pointer to a valid RObject . |
writer | Instance of a Writer class, where the RDS file is to be written. |