R/CsideHub.R

#' @include Hub.R
NULL

#' The hub of the CSIDE program
#' 
CsideHub = setRefClass(
  'CsideHub', 
  contains='Hub', 
  methods = list(
    initialize = function(
      startModule = CsideStartModule$new(), 
      dataManager = CsideDataManager$new(), 
      reportBuilder = CsideReportBuilder$new(), 
      dataModules = list(), # other specific data modules
      home = getwd(), ...) {
      
      # CSIDE hub modules
      callSuper(modules = c(
        list(
          start = startModule ,
          dataManager = dataManager,
          reportBuilder = reportBuilder), 
        dataModules), ...)

      # hub level settings
      setSettings(
        dirs = list (
          home = home, # home is the launch directory
          wd = home, # the active working directory (=home at the beginning)
          projects = "projects", # data directories
          libs = "libraries", # compound libraries
          settings = "settings", # settings
          reports = "reports" # reports directories
        ))
    },
    
    #' Getting and setting home directory and other directories
    getHome = function() getDir('home'),
    getWD = function() getDir('wd'),
    getDir = function(key) getSettings('dirs')[[key]],
    setWD = function(dir) setSettings(dirs = list('wd' = dir)),
  
    #' Launch all the different standard modules of the CSIDE Hub
    launchStart = function() { launchModule('start') },
    launchDataManager = function () launchModule('dataManager'),
    launchReportBuilder = function() launchModule('reportBuilder'),
    launchDataModule = function(name) launchModule(name)
  )
)
sebkopf/cside documentation built on May 29, 2019, 4:58 p.m.