R/RcppExports.R

Defines functions normEmp isRF isReg getMin getHours copy assignMH assignEmp assignPool

Documented in assignEmp assignMH assignPool copy getHours getMin isReg isRF normEmp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Assign pool to requirement faster
#'
#' This is used in \code{\link{assignPrio}}.
#'
#' @param listT list of theoretical employees created from empReq
#' @param listR list of real employees created fro empPool
#' @param prioStat character vector defining the employee status that are
#'   prioritized in assigning man hours
#' @param prioCode logical value \cr
#'   Is cost center prioritized in assigning?
#' @param debug logical flag for debugging
#' @return a list containing the following:
#'   \enumerate{
#'     \item remaining listT
#'     \item remaining listR
#'     \item man hour database resulting from the assignment
#'
#'       This is also merged and described well in \code{\link{getmhDB}}.
#'   }
#' @export
assignPool <- function(listT, listR, prioStat = NA_character_, prioCode = FALSE, debug = FALSE) {
    .Call('_mansched_assignPool', PACKAGE = 'mansched', listT, listR, prioStat, prioCode, debug)
}

#' Assign an employee
#'
#' Man hours from an \code{\link{Employee-class}} object representing a real
#'   employee is assigned to the man hours from an \code{\link{Employee-class}}
#'   object representing another employee (manpower requirement). During
#'   successful assignment, the man hours of both \code{Employee-class} objects
#'   are reduced.
#'
#' @param empT an \code{\link{Employee-class}} object representing a
#'   theoretical employee
#' @param empR an \code{\link{Employee-class}} object representing a real
#'   employee
#' @param selfAssign boolean
#'
#'   Is the employee being self-assigned? Self assigning means that the two
#'   arguments above points to the same object.
#' @param debug logical flag for debugging
#' @return a \code{\link{data.frame}} containing the man hours database
#'   resulting from the employee assignment. This is consisted of the following
#'   columns:
#'   \describe{
#'     \item{ID}{character string representing the unique identifier of the
#'       real employee}
#'     \item{reqID}{character string representing the unique identifier of the
#'       theoretical/requirement employee}
#'     \item{mh}{integer value representing the man hours assigned}
#'     \item{mhType}{character string representing the man hour type
#'
#'       \code{mhType} can be one of the following:
#'       \describe{
#'         \item{reg}{working hours not more than 8 hours during a regular day}
#'         \item{rd}{working hours not more than 8 hours during a rest day}
#'         \item{sh}{working hours not more than 8 hours during a special
#'           holiday}
#'         \item{lh}{working hours not more than 8 hours during a legal
#'           holiday}
#'         \item{nh}{working hours not more than 8 hours during a negotiated
#'           holiday}
#'         \item{rs}{working hours not more than 8 hours during a rest day on a
#'           special holiday}
#'         \item{rl}{working hours not more than 8 hours during a rest day on a
#'           legal holiday}
#'         \item{rn}{working hours not more than 8 hours during a rest day on a
#'           negotiated holiday}
#'         \item{regOT}{working hours more than 8 hours during a regular day}
#'         \item{rdOT}{working hours more than 8 hours during a rest day}
#'         \item{shOT}{working hours more than 8 hours during a special
#'           holiday}
#'         \item{lhOT}{working hours more than 8 hours during a legal holiday}
#'         \item{nhOT}{working hours more than 8 hours during a negotiated
#'           holiday}
#'         \item{rsOT}{working hours more than 8 hours during a rest day on a
#'           special holiday}
#'         \item{rlOT}{working hours more than 8 hours during a rest day on a
#'           legal holiday}
#'         \item{rnOT}{working hours more than 8 hours during a rest day on a
#'           negotiated holiday}
#'       }
#'     }
#'     \item{month}{integer value representing the month}
#'     \item{np}{integer value representing the man hours with night premium
#'       pay}
#'     \item{costCenter}{character string representing the cost center
#'       wherein the man hours is charged}
#'     \item{equipment}{character string of the equipment type should the
#'       required personnel is an operator}
#'   }
#' @export
assignEmp <- function(empT, empR, selfAssign = FALSE, debug = FALSE) {
    .Call('_mansched_assignEmp', PACKAGE = 'mansched', empT, empR, selfAssign, debug)
}

#' Spend all available man hours
#'
#' Available man hours of a specific man hour type from an
#'   \code{\link{Employee-class}} object representing a real employee is
#'   assigned to the man hours of an \code{Employee-class} object representing
#'   an employee requirement.
#'
#' @param hoursT integer vector of length 12
#'
#'   This represents the man hours from a theoretical employee with a certain
#'   man hour type.
#' @param hoursR integer vector of length 12
#'
#'   This represents the man hours from a real employee with a certain man hour
#'   type.
#' @return an integer vector of length 12 representing the man-hours assigned
#'
#'   The hoursT and hoursR will also be reduced by the value of the returned
#'   integer vector.
#' @export
assignMH <- function(hoursT, hoursR) {
    .Call('_mansched_assignMH', PACKAGE = 'mansched', hoursT, hoursR)
}

#' Deep copy a list
#'
#' @param x a list
#' @return a deep copy of the input list
#'
#' @export
copy <- function(x) {
    .Call('_mansched_copy', PACKAGE = 'mansched', x)
}

#' Get remaining working hours
#'
#' This function returns all remaining man hour types including overtime.
#'
#' @param employee an \code{\link{Employee-class}} object
#' @return a \code{\link{data.frame}} representing the remaining man hours
#'
#'   Each row represents a month while each column represents a man hour type.
#' @export
getHours <- function(employee) {
    .Call('_mansched_getHours', PACKAGE = 'mansched', employee)
}

#' Paired Minimum
#'
#' Get minimum value between two integer vectors
#'
#' @param a integer vector
#' @param b integer vector
#' @return an integer vector with the least value for each element by element
#'   comparison between a and b
#' @export
getMin <- function(a, b) {
    .Call('_mansched_getMin', PACKAGE = 'mansched', a, b)
}

#' isReg
#'
#' Is the employee regular?
#'
#' @param theObject an \code{\link{Employee-class}} object
#' @return logical value
#' @export isReg
isReg <- function(theObject) {
    .Call('_mansched_isReg', PACKAGE = 'mansched', theObject)
}

#' isRF
#'
#' Is the employee rank and file? Also checks whether an RF flag is correctly
#' assigned to the employees.
#'
#' @param theObject an \code{\link{Employee-class}} object
#' @return logical value
#' @export isRF
isRF <- function(theObject) {
    .Call('_mansched_isRF', PACKAGE = 'mansched', theObject)
}

#' Strip all over time hours from an employee
#'
#' This function modifies an \code{\link{Employee-class}} object with overtime
#'   hours removed (see \code{\link{premium}}). The cost center is also changed
#'   into a dummy cost center \code{"0-0"}.
#'
#' @param emp an \code{\link{Employee-class}} object
#' @return a \code{\link{data.frame}} of dropped man-hours. The columns of the
#'   which is similar to what is being returned in \code{\link{getmhDB}}.
#' @export
normEmp <- function(emp) {
    .Call('_mansched_normEmp', PACKAGE = 'mansched', emp)
}
basilrabi/mansched documentation built on May 18, 2023, 1:29 p.m.