| EnumDescriptor-class {RProtoBuf} | R Documentation |
Class "EnumDescriptor"
Description
R representation of an enum descriptor. This
is a thin wrapper around the EnumDescriptor c++ class.
Objects from the Class
Objects of this class are typically retrieved as members of Descriptor objects
Slots
pointer:external pointer to the
EnumDescriptorinstancename:simple name of the enum
full_name:fully qualified name
type:fully qualified name of the type that contains this enumeration
Methods
- show
signature(object = "EnumDescriptor"): small information- as.character
signature(x = "EnumDescriptor"): returns the debug string of the enum descriptor. This is retrieved by a call to theDebugStringmethod of the EnumDescriptor object.- toString
signature(x = "EnumDescriptor"): same asas.character- $
signature(x = "EnumDescriptor"): get the number associated with the name- has
signature(object = "EnumDescriptor"): indicate if the given name is a constant present in this enum.- containing_type
signature(object = "EnumDescriptor"): returns a Descriptor of the message type that contains this enum descriptor, or NULL if this is a top level enum descriptor.- length
signature(x = "EnumDescriptor"): number of constants in this enum.- value_count
signature(object = "EnumDescriptor"): number of constants in this enum.- value
signature(object = "EnumDescriptor"): extracts an EnumValueDescriptor. Exactly one argument ofindex,numberornamehas to be used. Ifindexis used, the enum value descriptor is retrieved by position, using thevaluemethod of the C++ class. Ifnumberis used, the enum value descriptor is retrieved using the value of the constant, using theFindValueByNumberC++ method. Ifnameis used, the enum value descriptor is retrieved using the name of the constant, using theFindValueByNameC++ method.- [[
signature(x = "EnumDescriptor"): extracts field identified by its name or declared tag number- names
signature(x = "EnumDescriptor"): extracts names of this enum
Author(s)
Romain Francois <francoisromain@free.fr>
References
The EnumDescriptor C++ class
See Also
The Descriptor class
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
has(Person$PhoneType, "MOBILE")
has(Person$PhoneType, "HOME")
has(Person$PhoneType, "WORK")
has(Person$PhoneType, "FOOBAR")
length(Person$PhoneType)