-
Notifications
You must be signed in to change notification settings - Fork 11
/
get-net-task.R
28 lines (27 loc) · 929 Bytes
/
get-net-task.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#' @title .getNetTask
#' @description Get an instance of the specified `.NET` Task
#'
#' @param taskName The name of the task to retrieve (**without** `Get` prefix).
#'
#' @return returns a new instance of of the specified `.NET` task.
#'
#' @keywords internal
.getNetTask <- function(taskName) {
rClr::clrCallStatic("OSPSuite.R.Api", paste0("Get", taskName))
}
#' @title .getNetTaskFromCache
#' @description Get an instance of the specified `.NET` Task that is retrieved
#' from cache if already initiated. Otherwise a new task will be initiated and
#' cached in the `tasksEnv`.
#'
#' @param taskName The name of the task to retrieve (**without** `Get` prefix).
#'
#' @return returns an instance of of the specified `.NET` task.
#'
#' @keywords internal
.getNetTaskFromCache <- function(taskName) {
if (is.null(tasksEnv[[taskName]])) {
tasksEnv[[taskName]] <- .getNetTask(taskName)
}
return(tasksEnv[[taskName]])
}