Learn R Programming

RProtoBuf (version 0.4.22)

EnumValueDescriptor-class: Class "EnumValueDescriptor"

Description

R representation of an enum value descriptor. This is a thin wrapper around the EnumValueDescriptor c++ class.

Arguments

Objects from the Class

Objects of this class are typically retrieved with the value method of the EnumDescriptor class

Slots

pointer:

external pointer to the EnumValueDescriptor instance

name:

simple name of the enum

full_name:

fully qualified name

Methods

show

signature(object = "EnumValueDescriptor"): small information

as.character

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

toString

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

$

signature(x = "EnumValueDescriptor"): invoke pseudo methods

name

signature(object = "EnumValueDescriptor", full = "logical"): return the name of this enum constant.

number

signature(object = "EnumValueDescriptor"): return the numeric value of this enum constant.

enum_type

signature(object = "EnumDescriptor") : retrieves the EnumDescriptor related to this value descriptor.

Author

Romain Francois <francoisromain@free.fr>

Examples

Run this code
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

# enum value type
value(Person$PhoneType, 1)

name(value(Person$PhoneType, 1))
name(value(Person$PhoneType, 1), TRUE)

number(value(Person$PhoneType, number=1))

enum_type(value(Person$PhoneType, number=1))

Run the code above in your browser using DataLab