SymbolicConstant-class: Class "SymbolicConstant"

SymbolicConstant-classR Documentation

Class "SymbolicConstant"

Description

This class and its derived classes are used for representing symbolic constants, and specifically collections of related symbolic constants. The most common are enumeration values which in C are integers that are identified by more meaningful symbolic names, e.g. RED, GREEN, BLUE; HTTP, HTTPS, FTP; SQUARE, CIRCLE, ... The idea is that possible values come from a finite set, much like the levels of a factor. The enumeration type specifies that set and gives symbolic names to the possible values.

An additional type of symbolic constant is one where the elements identify a possible setting but that these settings are not mutually exclusive. Different combinations of settings can be specified by combining the different possible values. These are bitwise-enumerations.

The idea behind the SymbolicConstant class, the EnumerationValue class and the BitwiseValue class is to represent single values for these different types. A SymbolicConstant is an integer. An EnumerationValue is derived from this and is associated with a set of possible values for that enumeration. A BitwiseValue is also derived from SymbolicConstant and is associated with a set of possible settings. These can be combined and the package provides operators to do this.

Objects from the Class

We typically use EnumDef, EnumValue and define methods for coercing numbers and strings to the corresponding EnumerationValue or BitwiseValue objects. In this regard, code is typically machine generated from the simple description of name = value pairs that define the enumeration or bitwise-enumeration.

Slots

.Data:

Object of class "integer"

Extends

Class "integer", from data part. Class "numeric", by class "integer", distance 2. Class "vector", by class "integer", distance 2. Class "data.frameRowLabels", by class "integer", distance 2. Class "EnumerationValue", by class "numeric", distance 3.

Methods

show

signature(object = "SymbolicConstant"): this displays the integer value along with the symbolic name and also the

Author(s)

Duncan Temple Lang

References

C programming books, e.g. Kernighan & Ritchie

Examples

showClass("SymbolicConstant")

omegahat/RAutoGenRunTime documentation built on Jan. 12, 2023, 9:19 p.m.