properties: Properties signaling fileds

Description Usage Arguments Details Value Author(s) Examples

View source: R/PropertySet-class.R

Description

Convenience function for defining a set of reference class fields that signals when set.

Usage

1

Arguments

fields

list of names of the field and associated fields class

prototype

A list of values declaring a default value for a field.

Details

When constructing signaling fields in this way, each field has the ability to register its own signal and at the same time, there is one top level signal which could be emitted no matter which field changes. Please see the example to learn to register global signal and individual signal.

Value

A list that is easily concatenated into the field list

Author(s)

Michael Lawrence, Tengfei Yin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## we could pass prototype as in S4
GPars.gen <- setRefClass("GraphicProperties",
                fields = properties(fields = list(size = "numeric",
                                                  color = "character"),
                                    prototype = list(size =1,
                                                     color = "red")))

obj <- GPars.gen$new()
## since it's not PropertySet, no global signal
## let's register individual signal
obj$sizeChanged$connect(function(){
  print("size changed")
})
## emit signal
obj$size <- 3
## no signal
obj$color <- "black"

objectProperties documentation built on July 22, 2021, 9:08 a.m.