Learn R Programming

RProtoBuf (version 0.4.22)

as.list.Message: Grab the protocol buffer message as an R list

Description

Utility to grab the protocol buffer message as an R list, with one item per field.

Usage

# S3 method for Message
as.list(x, ...)
# S3 method for Descriptor
as.list(x, ...)
# S3 method for EnumDescriptor
as.list(x, ...)
# S3 method for FileDescriptor
as.list(x, ...)
# S3 method for ServiceDescriptor
as.list(x, ...)

Value

For messages, a list of the content of the fields is returned.

For message type descriptors, a list containing nested type descriptors (Descriptor objects), enum type descriptors (EnumDescriptor objects), then field descriptors (FieldDescriptor objects) in that order.

For enum descriptors, a named list of the enumerated values.

For file descriptors, a named list of descriptors defined in the specified file descriptor.

For service descriptors, ...

Arguments

x

A protocol buffer message, instance of Message, or a protocol message descriptor, instance of Descriptor

...

ignored

Author

Romain Francois <francoisromain@free.fr>

Examples

Run this code
Person <- P( "tutorial.Person" )
romain <- new( Person, email = "francoisromain@free.fr", id = 1 )
as.list( romain )
as.list( Person )
as.list( Person$PhoneType)

Run the code above in your browser using DataLab