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

#include <Rcpp.h>

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// detect_all_events
RObject detect_all_events(DataFrame df, SEXP reading_minutes, bool sort_time, double inter_gap, bool return_interpolated);
RcppExport SEXP _cgmguru_detect_all_events(SEXP dfSEXP, SEXP reading_minutesSEXP, SEXP sort_timeSEXP, SEXP inter_gapSEXP, SEXP return_interpolatedSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< SEXP >::type reading_minutes(reading_minutesSEXP);
    Rcpp::traits::input_parameter< bool >::type sort_time(sort_timeSEXP);
    Rcpp::traits::input_parameter< double >::type inter_gap(inter_gapSEXP);
    Rcpp::traits::input_parameter< bool >::type return_interpolated(return_interpolatedSEXP);
    rcpp_result_gen = Rcpp::wrap(detect_all_events(df, reading_minutes, sort_time, inter_gap, return_interpolated));
    return rcpp_result_gen;
END_RCPP
}
// detect_between_maxima
List detect_between_maxima(DataFrame df, DataFrame transform_df);
RcppExport SEXP _cgmguru_detect_between_maxima(SEXP dfSEXP, SEXP transform_dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type transform_df(transform_dfSEXP);
    rcpp_result_gen = Rcpp::wrap(detect_between_maxima(df, transform_df));
    return rcpp_result_gen;
END_RCPP
}
// detect_hyperglycemic_events
List detect_hyperglycemic_events(DataFrame df, SEXP reading_minutes, double dur_length, double end_length, double start_gl, double end_gl, bool sort_time, double inter_gap, bool return_interpolated, bool lv1_excl);
RcppExport SEXP _cgmguru_detect_hyperglycemic_events(SEXP dfSEXP, SEXP reading_minutesSEXP, SEXP dur_lengthSEXP, SEXP end_lengthSEXP, SEXP start_glSEXP, SEXP end_glSEXP, SEXP sort_timeSEXP, SEXP inter_gapSEXP, SEXP return_interpolatedSEXP, SEXP lv1_exclSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< SEXP >::type reading_minutes(reading_minutesSEXP);
    Rcpp::traits::input_parameter< double >::type dur_length(dur_lengthSEXP);
    Rcpp::traits::input_parameter< double >::type end_length(end_lengthSEXP);
    Rcpp::traits::input_parameter< double >::type start_gl(start_glSEXP);
    Rcpp::traits::input_parameter< double >::type end_gl(end_glSEXP);
    Rcpp::traits::input_parameter< bool >::type sort_time(sort_timeSEXP);
    Rcpp::traits::input_parameter< double >::type inter_gap(inter_gapSEXP);
    Rcpp::traits::input_parameter< bool >::type return_interpolated(return_interpolatedSEXP);
    Rcpp::traits::input_parameter< bool >::type lv1_excl(lv1_exclSEXP);
    rcpp_result_gen = Rcpp::wrap(detect_hyperglycemic_events(df, reading_minutes, dur_length, end_length, start_gl, end_gl, sort_time, inter_gap, return_interpolated, lv1_excl));
    return rcpp_result_gen;
END_RCPP
}
// detect_hypoglycemic_events
List detect_hypoglycemic_events(DataFrame df, SEXP reading_minutes, double dur_length, double end_length, double start_gl, bool sort_time, double inter_gap, bool return_interpolated, bool lv1_excl);
RcppExport SEXP _cgmguru_detect_hypoglycemic_events(SEXP dfSEXP, SEXP reading_minutesSEXP, SEXP dur_lengthSEXP, SEXP end_lengthSEXP, SEXP start_glSEXP, SEXP sort_timeSEXP, SEXP inter_gapSEXP, SEXP return_interpolatedSEXP, SEXP lv1_exclSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< SEXP >::type reading_minutes(reading_minutesSEXP);
    Rcpp::traits::input_parameter< double >::type dur_length(dur_lengthSEXP);
    Rcpp::traits::input_parameter< double >::type end_length(end_lengthSEXP);
    Rcpp::traits::input_parameter< double >::type start_gl(start_glSEXP);
    Rcpp::traits::input_parameter< bool >::type sort_time(sort_timeSEXP);
    Rcpp::traits::input_parameter< double >::type inter_gap(inter_gapSEXP);
    Rcpp::traits::input_parameter< bool >::type return_interpolated(return_interpolatedSEXP);
    Rcpp::traits::input_parameter< bool >::type lv1_excl(lv1_exclSEXP);
    rcpp_result_gen = Rcpp::wrap(detect_hypoglycemic_events(df, reading_minutes, dur_length, end_length, start_gl, sort_time, inter_gap, return_interpolated, lv1_excl));
    return rcpp_result_gen;
END_RCPP
}
// excursion
List excursion(DataFrame df, double gap);
RcppExport SEXP _cgmguru_excursion(SEXP dfSEXP, SEXP gapSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< double >::type gap(gapSEXP);
    rcpp_result_gen = Rcpp::wrap(excursion(df, gap));
    return rcpp_result_gen;
END_RCPP
}
// find_local_maxima
List find_local_maxima(DataFrame df);
RcppExport SEXP _cgmguru_find_local_maxima(SEXP dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    rcpp_result_gen = Rcpp::wrap(find_local_maxima(df));
    return rcpp_result_gen;
END_RCPP
}
// find_max_after_hours
List find_max_after_hours(DataFrame df, DataFrame start_point_df, double hours);
RcppExport SEXP _cgmguru_find_max_after_hours(SEXP dfSEXP, SEXP start_point_dfSEXP, SEXP hoursSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type start_point_df(start_point_dfSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    rcpp_result_gen = Rcpp::wrap(find_max_after_hours(df, start_point_df, hours));
    return rcpp_result_gen;
END_RCPP
}
// find_max_before_hours
List find_max_before_hours(DataFrame df, DataFrame start_point_df, double hours);
RcppExport SEXP _cgmguru_find_max_before_hours(SEXP dfSEXP, SEXP start_point_dfSEXP, SEXP hoursSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type start_point_df(start_point_dfSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    rcpp_result_gen = Rcpp::wrap(find_max_before_hours(df, start_point_df, hours));
    return rcpp_result_gen;
END_RCPP
}
// find_min_after_hours
List find_min_after_hours(DataFrame df, DataFrame start_point_df, double hours);
RcppExport SEXP _cgmguru_find_min_after_hours(SEXP dfSEXP, SEXP start_point_dfSEXP, SEXP hoursSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type start_point_df(start_point_dfSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    rcpp_result_gen = Rcpp::wrap(find_min_after_hours(df, start_point_df, hours));
    return rcpp_result_gen;
END_RCPP
}
// find_min_before_hours
List find_min_before_hours(DataFrame df, DataFrame start_point_df, double hours);
RcppExport SEXP _cgmguru_find_min_before_hours(SEXP dfSEXP, SEXP start_point_dfSEXP, SEXP hoursSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type start_point_df(start_point_dfSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    rcpp_result_gen = Rcpp::wrap(find_min_before_hours(df, start_point_df, hours));
    return rcpp_result_gen;
END_RCPP
}
// find_new_maxima
DataFrame find_new_maxima(DataFrame df, DataFrame mod_grid_max_point_df, DataFrame local_maxima_df);
RcppExport SEXP _cgmguru_find_new_maxima(SEXP dfSEXP, SEXP mod_grid_max_point_dfSEXP, SEXP local_maxima_dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type mod_grid_max_point_df(mod_grid_max_point_dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type local_maxima_df(local_maxima_dfSEXP);
    rcpp_result_gen = Rcpp::wrap(find_new_maxima(df, mod_grid_max_point_df, local_maxima_df));
    return rcpp_result_gen;
END_RCPP
}
// grid
List grid(DataFrame df, double gap, double threshold);
RcppExport SEXP _cgmguru_grid(SEXP dfSEXP, SEXP gapSEXP, SEXP thresholdSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< double >::type gap(gapSEXP);
    Rcpp::traits::input_parameter< double >::type threshold(thresholdSEXP);
    rcpp_result_gen = Rcpp::wrap(grid(df, gap, threshold));
    return rcpp_result_gen;
END_RCPP
}
// interpolate_cgm_cpp
DataFrame interpolate_cgm_cpp(DataFrame df, SEXP reading_minutes, bool sort_time, double inter_gap);
RcppExport SEXP _cgmguru_interpolate_cgm_cpp(SEXP dfSEXP, SEXP reading_minutesSEXP, SEXP sort_timeSEXP, SEXP inter_gapSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< SEXP >::type reading_minutes(reading_minutesSEXP);
    Rcpp::traits::input_parameter< bool >::type sort_time(sort_timeSEXP);
    Rcpp::traits::input_parameter< double >::type inter_gap(inter_gapSEXP);
    rcpp_result_gen = Rcpp::wrap(interpolate_cgm_cpp(df, reading_minutes, sort_time, inter_gap));
    return rcpp_result_gen;
END_RCPP
}
// maxima_grid
List maxima_grid(DataFrame df, double threshold, double gap, double hours);
RcppExport SEXP _cgmguru_maxima_grid(SEXP dfSEXP, SEXP thresholdSEXP, SEXP gapSEXP, SEXP hoursSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< double >::type threshold(thresholdSEXP);
    Rcpp::traits::input_parameter< double >::type gap(gapSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    rcpp_result_gen = Rcpp::wrap(maxima_grid(df, threshold, gap, hours));
    return rcpp_result_gen;
END_RCPP
}
// mod_grid
List mod_grid(DataFrame df, DataFrame grid_point_df, double hours, double gap);
RcppExport SEXP _cgmguru_mod_grid(SEXP dfSEXP, SEXP grid_point_dfSEXP, SEXP hoursSEXP, SEXP gapSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type grid_point_df(grid_point_dfSEXP);
    Rcpp::traits::input_parameter< double >::type hours(hoursSEXP);
    Rcpp::traits::input_parameter< double >::type gap(gapSEXP);
    rcpp_result_gen = Rcpp::wrap(mod_grid(df, grid_point_df, hours, gap));
    return rcpp_result_gen;
END_RCPP
}
// orderfast_cpp
DataFrame orderfast_cpp(DataFrame df);
RcppExport SEXP _cgmguru_orderfast_cpp(SEXP dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    rcpp_result_gen = Rcpp::wrap(orderfast_cpp(df));
    return rcpp_result_gen;
END_RCPP
}
// sensor_wear_cpp
DataFrame sensor_wear_cpp(DataFrame df, SEXP reading_minutes, Nullable<NumericVector> end_date, double ndays);
RcppExport SEXP _cgmguru_sensor_wear_cpp(SEXP dfSEXP, SEXP reading_minutesSEXP, SEXP end_dateSEXP, SEXP ndaysSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< SEXP >::type reading_minutes(reading_minutesSEXP);
    Rcpp::traits::input_parameter< Nullable<NumericVector> >::type end_date(end_dateSEXP);
    Rcpp::traits::input_parameter< double >::type ndays(ndaysSEXP);
    rcpp_result_gen = Rcpp::wrap(sensor_wear_cpp(df, reading_minutes, end_date, ndays));
    return rcpp_result_gen;
END_RCPP
}
// start_finder
DataFrame start_finder(DataFrame df);
RcppExport SEXP _cgmguru_start_finder(SEXP dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    rcpp_result_gen = Rcpp::wrap(start_finder(df));
    return rcpp_result_gen;
END_RCPP
}
// transform_df
DataFrame transform_df(DataFrame grid_df, DataFrame maxima_df);
RcppExport SEXP _cgmguru_transform_df(SEXP grid_dfSEXP, SEXP maxima_dfSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type grid_df(grid_dfSEXP);
    Rcpp::traits::input_parameter< DataFrame >::type maxima_df(maxima_dfSEXP);
    rcpp_result_gen = Rcpp::wrap(transform_df(grid_df, maxima_df));
    return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_cgmguru_detect_all_events", (DL_FUNC) &_cgmguru_detect_all_events, 5},
    {"_cgmguru_detect_between_maxima", (DL_FUNC) &_cgmguru_detect_between_maxima, 2},
    {"_cgmguru_detect_hyperglycemic_events", (DL_FUNC) &_cgmguru_detect_hyperglycemic_events, 10},
    {"_cgmguru_detect_hypoglycemic_events", (DL_FUNC) &_cgmguru_detect_hypoglycemic_events, 9},
    {"_cgmguru_excursion", (DL_FUNC) &_cgmguru_excursion, 2},
    {"_cgmguru_find_local_maxima", (DL_FUNC) &_cgmguru_find_local_maxima, 1},
    {"_cgmguru_find_max_after_hours", (DL_FUNC) &_cgmguru_find_max_after_hours, 3},
    {"_cgmguru_find_max_before_hours", (DL_FUNC) &_cgmguru_find_max_before_hours, 3},
    {"_cgmguru_find_min_after_hours", (DL_FUNC) &_cgmguru_find_min_after_hours, 3},
    {"_cgmguru_find_min_before_hours", (DL_FUNC) &_cgmguru_find_min_before_hours, 3},
    {"_cgmguru_find_new_maxima", (DL_FUNC) &_cgmguru_find_new_maxima, 3},
    {"_cgmguru_grid", (DL_FUNC) &_cgmguru_grid, 3},
    {"_cgmguru_interpolate_cgm_cpp", (DL_FUNC) &_cgmguru_interpolate_cgm_cpp, 4},
    {"_cgmguru_maxima_grid", (DL_FUNC) &_cgmguru_maxima_grid, 4},
    {"_cgmguru_mod_grid", (DL_FUNC) &_cgmguru_mod_grid, 4},
    {"_cgmguru_orderfast_cpp", (DL_FUNC) &_cgmguru_orderfast_cpp, 1},
    {"_cgmguru_sensor_wear_cpp", (DL_FUNC) &_cgmguru_sensor_wear_cpp, 4},
    {"_cgmguru_start_finder", (DL_FUNC) &_cgmguru_start_finder, 1},
    {"_cgmguru_transform_df", (DL_FUNC) &_cgmguru_transform_df, 2},
    {NULL, NULL, 0}
};

RcppExport void R_init_cgmguru(DllInfo *dll) {
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}
