| enum {struct} | R Documentation |
A base class in the struct package. Not normally called directly.
enum( name, description = character(0), type = "character", value = character(0), max_length = 1, allowed ) ## S4 replacement method for signature 'enum' value(obj) <- value
name |
the name of the object |
description |
a description of the object |
type |
the type of the struct object |
value |
value of the enum |
max_length |
Maximum length of value vector (default 1) |
allowed |
A list of allowed values |
obj |
an enum object |
An enum object is a special type of entity object that ensures the value must be one from a list of allowed values.
Enum objects are usually defined in the prototype of another object, but
can be extracted using param_obj and output_obj.
an enum object
# Create a new enum object
E = enum(
name = 'example',
description = 'this is an example',
type = 'character',
value = 'hello',
allowed = c('hello','world')
)
# Get/set the value of the entity object
value(E)
value(E) = 'world'