Learn R Programming

RProtoBuf (version 0.1-0)

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

    For file descriptors, ...

    For service descriptors, ...

Examples

Run this code
proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" ) 
Person <- P( "tutorial.Person", file = proto.file )
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