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
objecttype
: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 theDebugString
method of the Descriptor object.- toString
signature(x = "Descriptor")
: same asas.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, orNULL
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 ofindex
,number
orname
has to be used. Ifindex
is used, the field descriptor is retrieved by position, using thefield
method of thegoogle::protobuf::Descriptor
C++ class. Ifnumber
is used, the field descriptor is retrieved using the tag number, with theFindFieldByNumber
C++ method. Ifname
is used, the field descriptor is retrieved by name using theFindFieldByName
- nested_type
signature(object = "Descriptor")
: extracts a message type descriptor that is nested in this descriptor. Exactly one argument ofindex
ofname
has to be used. Ifindex
is used, the nested type will be retrieved using its position with thenested_type
method of thegoogle::protobuf::Descriptor
C++ class. Ifname
is used, the nested type will be retrieved using its name, with theFindNestedTypeByName
C++ method- enum_type
signature(object = "Descriptor")
: extracts an enum type descriptor that is contained in this descriptor. Exactly one argument ofindex
ofname
has to be used. Ifindex
is used, the enum type will be retrieved using its position with theenum_type
method of thegoogle::protobuf::Descriptor
C++ class. Ifname
is used, the enum type will be retrieved using its name, with theFindEnumTypeByName
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 )