
Last chance! 50% off unlimited learning
Sale ends in
full descriptive information about a protocol buffer
message type. This is a thin wrapper around the
C++ class Descriptor
Objects are usually created by calls to the P
function.
pointer
:external pointer holding a Descriptor
object
type
:full name of the corresponding message type
signature(x = "Descriptor")
:
returns the debug string of the descriptor.
This is retrieved by a call to the DebugString
method of the Descriptor object.
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
signature(Class = "Descriptor")
: creates
a prototype message (Message) of this
descriptor
signature(object = "Descriptor")
:
simple information
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.
signature(object = "Descriptor")
: The number of fields of this message type.
signature(object = "Descriptor")
: The number of nested types of this message type.
signature(object = "Descriptor")
: The number of enum types of this message type.
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
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
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
signature(x = "Descriptor")
: extracts names of this descriptor
signature(x = "Descriptor")
: extracts length of this descriptor
Romain Francois <francoisromain@free.fr>
the P
function creates "Descriptor" messages.
if (FALSE) {
# 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 )
}
Person <- P( "tutorial.Person" )
# enum type
Person$PhoneType
# nested type
Person$PhoneNumber
# field
Person$email
# use this descriptor to create a message
new( Person )
Run the code above in your browser using DataLab