Learn R Programming

RProtoBuf (version 0.3.2)

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 class 'Message':
as.list(x, ...)
## S3 method for class 'Descriptor':
as.list(x, ...)
## S3 method for class 'EnumDescriptor':
as.list(x, ...)
## S3 method for class 'FileDescriptor':
as.list(x, ...)
## S3 method for class 'ServiceDescriptor':
as.list(x, ...)

Arguments

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

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), or field descriptors (FieldDescriptor objects)

    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, ...

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