metaRangeProcess object
Description
Section titled “Description”Creates an metaRangeProcess object in form of an R6 class that stores and handles all the parts that define a process.
Public fields
Section titled “Public fields”fun
:<function>
The processes function. This will be called when the process is executed.
Methods
Section titled “Methods”Public methods
Section titled “Public methods”metaRangeProcess$new()
metaRangeProcess$get_PID()
metaRangeProcess$get_name()
metaRangeProcess$get_priority()
metaRangeProcess$get_env_label()
metaRangeProcess$print()
Method new()
Section titled “Method new()”Creates a new metaRangeProcess object
metaRangeProcess$new( process_name, id = "", process_fun, execution_priority, env, env_label = NULL)
Arguments
Section titled “Arguments”process_name
:<string>
name of the process.id
:<string>
optional ID of the process.process_fun
:<function>
The function to be called when the process is executed. It will be executed in the specified environment (see argument: env) and has access to all the variables in that environment. This function may not have any arguments, i.e.is.null(formals(process_fun))
must beTRUE
.execution_priority
:<integer>
the priority of the process. The lower the number the earlier the process is executed (1 == highest priority). Note that the priority is only used to sort the processes in the priority queue. The actual execution order is determined by the order of the processes in the queue.env
:<environment>
the environment where the process should be executed.env_label
:<string>
optional name of the execution environment. Just used as a human readable label for debug purposes.
Returns
Section titled “Returns”<metaRangeProcess>
A metaRangeProcess object.
Examples
Section titled “Examples”# Note: Only for illustration purposes. Use the add_process method of the# simulation object to add processes to a simulation.pr <- metaRangeProcess$new( process_name = "ecological_process", process_fun = function() { cat("Execute ecological process!") }, execution_priority = 1L, env = new.env(), env_label = "a_species_name")pr
Method get_PID()
Section titled “Method get_PID()”get the process ID
metaRangeProcess$get_PID()
Returns
Section titled “Returns”<string>
The process ID
Examples
Section titled “Examples”pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_PID()
Method get_name()
Section titled “Method get_name()”get the process name
metaRangeProcess$get_name()
Returns
Section titled “Returns”<string>
The process name
Examples
Section titled “Examples”pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_name()
Method get_priority()
Section titled “Method get_priority()”get the process execution priority
metaRangeProcess$get_priority()
Returns
Section titled “Returns”<integer>
The process execution priority
Examples
Section titled “Examples”pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_priority()
Method get_env_label()
Section titled “Method get_env_label()”get the name of the process execution environment
metaRangeProcess$get_env_label()
Returns
Section titled “Returns”<string>
The name of the process execution environment or NULL
Examples
Section titled “Examples”pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env(), "human_readable_label")pr$get_env_label()
Method print()
Section titled “Method print()”Prints information about the process to the console
metaRangeProcess$print()
Returns
Section titled “Returns”<invisible self>
Examples
Section titled “Examples”pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$print()
Seealso
Section titled “Seealso”<metaRangeProcess>
A metaRangeProcess object.
Examples
Section titled “Examples”## ------------------------------------------------## Method `metaRangeProcess$new`## ------------------------------------------------
# Note: Only for illustration purposes. Use the add_process method of the# simulation object to add processes to a simulation.pr <- metaRangeProcess$new( process_name = "ecological_process", process_fun = function() { cat("Execute ecological process!") }, execution_priority = 1L, env = new.env(), env_label = "a_species_name")pr
## ------------------------------------------------## Method `metaRangeProcess$get_PID`## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_PID()
## ------------------------------------------------## Method `metaRangeProcess$get_name`## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_name()
## ------------------------------------------------## Method `metaRangeProcess$get_priority`## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$get_priority()
## ------------------------------------------------## Method `metaRangeProcess$get_env_label`## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env(), "human_readable_label")pr$get_env_label()
## ------------------------------------------------## Method `metaRangeProcess$print`## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())pr$print()