BiodbObserver-class {biodb}R Documentation

The mother abstract class of all observer classes.

Description

This abstract class defines all the methods that can be used to send messages to the observers. You can define new observer classes by inherting from this class.

Methods

notifyProgress(what, index, total)

:

Notify about the progress of an action.

what: A short description of the action.

index: A positive integer number indicating the progress.

total: The maximum for "index". When reached, the action is completed.

Returned value: None.

terminate()

:

Terminates the instance. This method will be called automatically by the BiodbMain instance when you call BiodbMain::terminate().

Returned value: None.

Examples

# Define a new observer class
MyObsClass <- methods::setRefClass("MyObsClass", contains='BiodbObserver',
  methods=list(notifyProgress=function(what, index, total) {
      sprintf("Progress for %s is %d / %d.", what, index, total)
  }
))

# Create an instance and register an instance of the new observer class:
mybiodb <- biodb::newInst()
mybiodb$addObservers(MyObsClass$new())

# Terminate instance.
mybiodb$terminate()


[Package biodb version 1.0.4 Index]