# Generated by savvy: do not edit by hand
#
# Note:
#   This wrapper file is named as `000-wrappers.R` so that this file is loaded
#   first, which allows users to override the functions defined here (e.g., a
#   print() method for an enum).

#' @useDynLib rsamplr, .registration = TRUE
#' @keywords internal
NULL

# Check class and extract the external pointer embedded in the environment
.savvy_extract_ptr <- function(e, class) {
  if(is.null(e)) {
    return(NULL)
  }

  if(inherits(e, class)) {
    e$.ptr
  } else {
    msg <- paste0("Expected ", class, ", got ", class(e)[1])
    stop(msg, call. = FALSE)
  }
}

# Prohibit modifying environments

#' @export
`$<-.savvy_rsamplr__sealed` <- function(x, name, value) {
  class <- gsub("__bundle$", "", class(x)[1])
  stop(class, " cannot be modified", call. = FALSE)
}

#' @export
`[[<-.savvy_rsamplr__sealed` <- function(x, i, value) {
  class <- gsub("__bundle$", "", class(x)[1])
  stop(class, " cannot be modified", call. = FALSE)
}


`rust_balance_deviation` <- function(`r_sample`, `r_prob`, `r_data`) {
  .Call(savvy_rust_balance_deviation__impl, `r_sample`, `r_prob`, `r_data`)
}


`rust_balanced` <- function(`r_prob`, `r_bal_data`, `r_eps`, `r_method`) {
  .Call(savvy_rust_balanced__impl, `r_prob`, `r_bal_data`, `r_eps`, `r_method`)
}


`rust_balanced_stratified` <- function(`r_prob`, `r_bal_data`, `r_strata`, `r_eps`, `r_method`) {
  .Call(savvy_rust_balanced_stratified__impl, `r_prob`, `r_bal_data`, `r_strata`, `r_eps`, `r_method`)
}


`rust_distributionally_balanced_design` <- function(`r_sample_size`, `r_data`, `r_temp`, `r_cooling`, `r_iter`, `r_spatial_init`, `r_method`) {
  .Call(savvy_rust_distributionally_balanced_design__impl, `r_sample_size`, `r_data`, `r_temp`, `r_cooling`, `r_iter`, `r_spatial_init`, `r_method`)
}


`rust_distributionally_balanced_design_iter` <- function(`r_sample_size`, `r_data`, `r_temp`, `r_cooling`, `r_spatial_init`, `r_iter_to`, `r_iter_by`, `r_method`) {
  .Call(savvy_rust_distributionally_balanced_design_iter__impl, `r_sample_size`, `r_data`, `r_temp`, `r_cooling`, `r_spatial_init`, `r_iter_to`, `r_iter_by`, `r_method`)
}


`rust_doubly_balanced` <- function(`r_prob`, `r_data`, `r_bal_data`, `r_eps`, `r_bucket_size`, `r_method`) {
  .Call(savvy_rust_doubly_balanced__impl, `r_prob`, `r_data`, `r_bal_data`, `r_eps`, `r_bucket_size`, `r_method`)
}


`rust_doubly_balanced_stratified` <- function(`r_prob`, `r_data`, `r_bal_data`, `r_strata`, `r_eps`, `r_bucket_size`, `r_method`) {
  .Call(savvy_rust_doubly_balanced_stratified__impl, `r_prob`, `r_data`, `r_bal_data`, `r_strata`, `r_eps`, `r_bucket_size`, `r_method`)
}


`rust_local_mean_variance` <- function(`r_values`, `r_prob`, `r_data`, `r_neighbours`) {
  .Call(savvy_rust_local_mean_variance__impl, `r_values`, `r_prob`, `r_data`, `r_neighbours`)
}


`rust_pips_from_values` <- function(`r_values`, `r_sample_size`) {
  .Call(savvy_rust_pips_from_values__impl, `r_values`, `r_sample_size`)
}


`rust_spatial_balance_measure` <- function(`r_sample`, `r_prob`, `r_data`, `r_method`) {
  .Call(savvy_rust_spatial_balance_measure__impl, `r_sample`, `r_prob`, `r_data`, `r_method`)
}


`rust_spatial_balance_measure_all` <- function(`r_sample`, `r_prob`, `r_data`) {
  .Call(savvy_rust_spatial_balance_measure_all__impl, `r_sample`, `r_prob`, `r_data`)
}


`rust_spatial_balance_measure_all_equal` <- function(`r_sample`, `r_sample_size`, `r_data`) {
  .Call(savvy_rust_spatial_balance_measure_all_equal__impl, `r_sample`, `r_sample_size`, `r_data`)
}


`rust_spatial_balance_measure_equal` <- function(`r_sample`, `r_sample_size`, `r_data`, `r_method`) {
  .Call(savvy_rust_spatial_balance_measure_equal__impl, `r_sample`, `r_sample_size`, `r_data`, `r_method`)
}


`rust_spatially_balanced` <- function(`r_prob`, `r_data`, `r_eps`, `r_bucket_size`, `r_method`) {
  .Call(savvy_rust_spatially_balanced__impl, `r_prob`, `r_data`, `r_eps`, `r_bucket_size`, `r_method`)
}


`rust_spatially_balanced_hierarchical` <- function(`r_prob`, `r_data`, `r_sizes`, `r_eps`, `r_bucket_size`, `r_method`) {
  .Call(savvy_rust_spatially_balanced_hierarchical__impl, `r_prob`, `r_data`, `r_sizes`, `r_eps`, `r_bucket_size`, `r_method`)
}


`rust_unequal` <- function(`r_prob`, `r_eps`, `r_method`, `r_max_iter`, `r_sample_size`) {
  .Call(savvy_rust_unequal__impl, `r_prob`, `r_eps`, `r_method`, `r_max_iter`, `r_sample_size`)
}


