Descriptor-class {RProtoBuf}R Documentation

Class "Descriptor"

Description

full descriptive information about a protocol buffer message type. This is a thin wrapper around the C++ class Descriptor

Objects from the Class

Objects are usually created by calls to the P function.

Slots

pointer:

external pointer holding a Descriptor object

type:

full name of the corresponding message type

Methods

as.character

signature(x = "Descriptor"): returns the debug string of the descriptor. This is retrieved by a call to the DebugString method of the Descriptor object.

toString

signature(x = "Descriptor"): same as as.character

$

signature(x = "Descriptor"): retrieves a descriptor for a member of the message type. This can either be another "Descriptor" instance describing a nested type, or a EnumDescriptor object describing an enum type, or a FieldDescriptor object describing a field of the message

new

signature(Class = "Descriptor"): creates a prototype message (Message) of this descriptor

show

signature(object = "Descriptor"): simple information

containing_type

signature(object = "Descriptor") : returns a descriptor of the message type that contains this message descriptor, or NULL if this is a top-level message type.

field_count

signature(object = "Descriptor") : The number of fields of this message type.

nested_type_count

signature(object = "Descriptor") : The number of nested types of this message type.

enum_type_count

signature(object = "Descriptor") : The number of enum types of this message type.

field

signature(object = "Descriptor") : extract a field descriptor from a descriptor. Exactly one argument of index, number or name has to be used. If index is used, the field descriptor is retrieved by position, using the field method of the google::protobuf::Descriptor C++ class. If number is used, the field descriptor is retrieved using the tag number, with the FindFieldByNumber C++ method. If name is used, the field descriptor is retrieved by name using the FindFieldByName

nested_type

signature(object = "Descriptor") : extracts a message type descriptor that is nested in this descriptor. Exactly one argument of index of name has to be used. If index is used, the nested type will be retrieved using its position with the nested_type method of the google::protobuf::Descriptor C++ class. If name is used, the nested type will be retrieved using its name, with the FindNestedTypeByName C++ method

enum_type

signature(object = "Descriptor") : extracts an enum type descriptor that is contained in this descriptor. Exactly one argument of index of name has to be used. If index is used, the enum type will be retrieved using its position with the enum_type method of the google::protobuf::Descriptor C++ class. If name is used, the enum type will be retrieved using its name, with the FindEnumTypeByName C++ method

[[

signature(x = "Descriptor"): extracts a field identified by its name or declared tag number

names

signature(x = "Descriptor") : extracts names of this descriptor

length

signature(x = "Descriptor") : extracts length of this descriptor

Author(s)

Romain Francois <francoisromain@free.fr>

See Also

the P function creates "Descriptor" messages.

Examples

## Not run: 
# example proto file supplied with this package
proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" )
# reading a proto file and creating the descriptor
Person <- P( "tutorial.Person", file = proto.file )

## End(Not run)


# enum type
Person$PhoneType

# nested type
Person$PhoneNumber

# field
Person$email

# use this descriptor to create a message
new( Person )

[Package RProtoBuf version 0.4.22 Index]