entity: get the max value vector length for an entity

Description Usage Arguments Details Value Examples

View source: R/entity_class.R

Description

A base class in the struct package. Not normally called directly. An entity object is used to store information about a parameter or output_ The standard 'name','description' and 'type' slots are included, along with 'value' for storing the value of the parameter and 'max_length' for restricting the length of 'value' if needed.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
max_length(obj)

entity(
  name,
  description = character(0),
  type = "character",
  value = NULL,
  max_length = Inf
)

## S4 method for signature 'entity'
value(obj)

## S4 replacement method for signature 'entity'
value(obj) <- value

## S4 method for signature 'entity'
max_length(obj)

## S4 replacement method for signature 'entity'
max_length(obj) <- value

Arguments

obj

An entity object

name

the name of the object

description

a description of the object

type

the type of the struct object

value

The value of the parameter/outputs

max_length

Maximum length of value vector (default 1)

Details

Entity objects are usually defined in the prototype of another object, but can be extracted using param_obj and output_obj.

Value

max value vector length for an entity

An entity object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create a new entity object
E = entity(
    name = 'example',
    description = 'this is an example',
    type = 'numeric',
    value = 1
)

# Get/set the value of the entity object
value(E)
value(E) = 10

struct documentation built on Nov. 8, 2020, 8:14 p.m.