Consumer: A Class for reading and executing tasks from a source

ConsumerR Documentation

A Class for reading and executing tasks from a source

Description

A Class for reading and executing tasks from a source

A Class for reading and executing tasks from a source

Public fields

handlers

A list of handlers

stopped

Is currently stopped.

laterHandle

A callback handle.

Methods

Public methods


Method new()

Creates the object.

Usage
Consumer$new(source)
Arguments
source

A source, e.g. TextFileSource.


Method setSource()

Sets the source.

Usage
Consumer$setSource(source)
Arguments
source

A source, e.g. TextFileSource.


Method getSource()

Gets the source.

Usage
Consumer$getSource()

Method consume()

Executes all (unprocessed) signals fired to source from a Producer. if throwErrors is TRUE, the first error encountered is thrown after executing all signals. Signals are executed in the env environment. If env is NULL, the environment set at initialization is used.

Usage
Consumer$consume(throwErrors = TRUE, env = parent.frame())
Arguments
throwErrors

Should errors be thrown or caught.

env

The execution environment.


Method start()

Starts executing consume every millis milliseconds. throwErrors and env are passed down to consume

Usage
Consumer$start(millis = 250, env = parent.frame())
Arguments
millis

milliseconds.

env

The execution environment.


Method stop()

Stops the periodic execution of consume.

Usage
Consumer$stop()

Method addHandler()

Adds a handler for 'signal'. func

Usage
Consumer$addHandler(func, signal)
Arguments
func

The function which takes three parameters: 1. the signal, 2. the message object, and 3. the evaluation environment.

signal

A string to bind the function to.


Method clearHandlers()

Removes all handler.s

Usage
Consumer$clearHandlers()

Method removeHandler()

Removes a single handler.

Usage
Consumer$removeHandler(signal, index)
Arguments
signal

The signal of the handler.

index

The index of the handler to remove from the signal.


Method initHandlers()

Adds default handlers.

Usage
Consumer$initHandlers()

Method finalize()

cleans up object.

Usage
Consumer$finalize()

Method clone()

The objects of this class are cloneable with this method.

Usage
Consumer$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


fellstat/ipc documentation built on Feb. 13, 2023, 7:45 p.m.