R/zzz_zzz.R

Defines functions .onLoad phn_model non_normal_model ar1_model heter_model poly_model quartic_model simple_cubic_model cubic_model vi_model

Documented in ar1_model cubic_model heter_model non_normal_model phn_model poly_model quartic_model simple_cubic_model vi_model

# Create portals for class constructor

#' @name portal
#' @title Portals to class instantiate methods
#' @description These functions are the same as `class$instantiate`.
#' @param ... Arguments passed to `init` method.
#' @param env Environment. The instance environment.
#' @param init_call Call. Contents of the `..init_call..`. It is recommended to
#' leave it as default. Default is `init_call = sys.call()`.
NULL


#' @describeIn portal [VI_MODEL]
#' @export
vi_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  VI_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [CUBIC_MODEL]
#' @export
cubic_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  CUBIC_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [SIMPLE_CUBIC_MODEL]
#' @export
simple_cubic_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  SIMPLE_CUBIC_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [QUARTIC_MODEL]
#' @export
quartic_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  QUARTIC_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [POLY_MODEL]
#' @export
poly_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  POLY_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [HETER_MODEL]
#' @export
heter_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  HETER_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [AR1_MODEL]
#' @export
ar1_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  AR1_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [NON_NORMAL_MODEL]
#' @export
non_normal_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  NON_NORMAL_MODEL$instantiate(..., env = env, init_call = init_call)
}

#' @describeIn portal [PHN_MODEL]
#' @export
phn_model <- function(..., env = new.env(parent = parent.frame()), init_call = sys.call()) {
  PHN_MODEL$instantiate(..., env = env, init_call = init_call)
}

.onLoad <- function(libname, pkgname) {

  # Classes are empty environments defined by new.env()
  # Build them at load-time to ensure dependencies (e.g. bandicoot::BASE) are latest

  class_RAND_VAR(RAND_VAR)
  class_RAND_UNIFORM(RAND_UNIFORM)
  class_RAND_UNIFORM_D(RAND_UNIFORM_D)
  class_RAND_NORMAL(RAND_NORMAL)
  class_RAND_LOGNORMAL(RAND_LOGNORMAL)
  class_RAND_T(RAND_T)

  class_CLOSED_FORM(CLOSED_FORM)

  class_VI_MODEL(VI_MODEL)
  class_CUBIC_MODEL(CUBIC_MODEL)
  class_SIMPLE_CUBIC_MODEL(SIMPLE_CUBIC_MODEL)
  class_QUARTIC_MODEL(QUARTIC_MODEL)
  class_POLY_MODEL(POLY_MODEL)
  class_HETER_MODEL(HETER_MODEL)
  class_AR1_MODEL(AR1_MODEL)
  class_NON_NORMAL_MODEL(NON_NORMAL_MODEL)
  class_PHN_MODEL(PHN_MODEL)
}
TengMCing/visage documentation built on Aug. 28, 2024, 3:27 p.m.