// 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

// NewPgen
SEXP NewPgen(String filename, Nullable<List> pvar, Nullable<int> raw_sample_ct, Nullable<IntegerVector> sample_subset);
RcppExport SEXP _pgenlibr_NewPgen(SEXP filenameSEXP, SEXP pvarSEXP, SEXP raw_sample_ctSEXP, SEXP sample_subsetSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< String >::type filename(filenameSEXP);
    Rcpp::traits::input_parameter< Nullable<List> >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< Nullable<int> >::type raw_sample_ct(raw_sample_ctSEXP);
    Rcpp::traits::input_parameter< Nullable<IntegerVector> >::type sample_subset(sample_subsetSEXP);
    rcpp_result_gen = Rcpp::wrap(NewPgen(filename, pvar, raw_sample_ct, sample_subset));
    return rcpp_result_gen;
END_RCPP
}
// GetRawSampleCt
int GetRawSampleCt(List pgen);
RcppExport SEXP _pgenlibr_GetRawSampleCt(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(GetRawSampleCt(pgen));
    return rcpp_result_gen;
END_RCPP
}
// GetVariantCt
int GetVariantCt(List pvar_or_pgen);
RcppExport SEXP _pgenlibr_GetVariantCt(SEXP pvar_or_pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar_or_pgen(pvar_or_pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(GetVariantCt(pvar_or_pgen));
    return rcpp_result_gen;
END_RCPP
}
// GetAlleleCt
int GetAlleleCt(List pvar_or_pgen, int variant_num);
RcppExport SEXP _pgenlibr_GetAlleleCt(SEXP pvar_or_pgenSEXP, SEXP variant_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar_or_pgen(pvar_or_pgenSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    rcpp_result_gen = Rcpp::wrap(GetAlleleCt(pvar_or_pgen, variant_num));
    return rcpp_result_gen;
END_RCPP
}
// GetMaxAlleleCt
int GetMaxAlleleCt(List pvar_or_pgen);
RcppExport SEXP _pgenlibr_GetMaxAlleleCt(SEXP pvar_or_pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar_or_pgen(pvar_or_pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(GetMaxAlleleCt(pvar_or_pgen));
    return rcpp_result_gen;
END_RCPP
}
// HardcallPhasePresent
bool HardcallPhasePresent(List pgen);
RcppExport SEXP _pgenlibr_HardcallPhasePresent(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(HardcallPhasePresent(pgen));
    return rcpp_result_gen;
END_RCPP
}
// Buf
NumericVector Buf(List pgen);
RcppExport SEXP _pgenlibr_Buf(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(Buf(pgen));
    return rcpp_result_gen;
END_RCPP
}
// AlleleCodeBuf
NumericVector AlleleCodeBuf(List pgen);
RcppExport SEXP _pgenlibr_AlleleCodeBuf(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(AlleleCodeBuf(pgen));
    return rcpp_result_gen;
END_RCPP
}
// IntBuf
IntegerVector IntBuf(List pgen);
RcppExport SEXP _pgenlibr_IntBuf(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(IntBuf(pgen));
    return rcpp_result_gen;
END_RCPP
}
// IntAlleleCodeBuf
IntegerVector IntAlleleCodeBuf(List pgen);
RcppExport SEXP _pgenlibr_IntAlleleCodeBuf(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(IntAlleleCodeBuf(pgen));
    return rcpp_result_gen;
END_RCPP
}
// BoolBuf
LogicalVector BoolBuf(List pgen);
RcppExport SEXP _pgenlibr_BoolBuf(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    rcpp_result_gen = Rcpp::wrap(BoolBuf(pgen));
    return rcpp_result_gen;
END_RCPP
}
// ReadHardcalls
void ReadHardcalls(List pgen, SEXP buf, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_ReadHardcalls(SEXP pgenSEXP, SEXP bufSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< SEXP >::type buf(bufSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    ReadHardcalls(pgen, buf, variant_num, allele_num);
    return R_NilValue;
END_RCPP
}
// HasSparseHardcalls
bool HasSparseHardcalls(List pgen, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_HasSparseHardcalls(SEXP pgenSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    rcpp_result_gen = Rcpp::wrap(HasSparseHardcalls(pgen, variant_num, allele_num));
    return rcpp_result_gen;
END_RCPP
}
// ReadSparseHardcalls
List ReadSparseHardcalls(List pgen, int variant_num, int allele_num, bool return_ints);
RcppExport SEXP _pgenlibr_ReadSparseHardcalls(SEXP pgenSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP, SEXP return_intsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    Rcpp::traits::input_parameter< bool >::type return_ints(return_intsSEXP);
    rcpp_result_gen = Rcpp::wrap(ReadSparseHardcalls(pgen, variant_num, allele_num, return_ints));
    return rcpp_result_gen;
END_RCPP
}
// Read
void Read(List pgen, NumericVector buf, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_Read(SEXP pgenSEXP, SEXP bufSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type buf(bufSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    Read(pgen, buf, variant_num, allele_num);
    return R_NilValue;
END_RCPP
}
// HasSparse
bool HasSparse(List pgen, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_HasSparse(SEXP pgenSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    rcpp_result_gen = Rcpp::wrap(HasSparse(pgen, variant_num, allele_num));
    return rcpp_result_gen;
END_RCPP
}
// ReadSparse
List ReadSparse(List pgen, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_ReadSparse(SEXP pgenSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    rcpp_result_gen = Rcpp::wrap(ReadSparse(pgen, variant_num, allele_num));
    return rcpp_result_gen;
END_RCPP
}
// ReadAlleles
void ReadAlleles(List pgen, SEXP acbuf, int variant_num, Nullable<LogicalVector> phasepresent_buf);
RcppExport SEXP _pgenlibr_ReadAlleles(SEXP pgenSEXP, SEXP acbufSEXP, SEXP variant_numSEXP, SEXP phasepresent_bufSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< SEXP >::type acbuf(acbufSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< Nullable<LogicalVector> >::type phasepresent_buf(phasepresent_bufSEXP);
    ReadAlleles(pgen, acbuf, variant_num, phasepresent_buf);
    return R_NilValue;
END_RCPP
}
// ReadIntList
IntegerMatrix ReadIntList(List pgen, IntegerVector variant_subset);
RcppExport SEXP _pgenlibr_ReadIntList(SEXP pgenSEXP, SEXP variant_subsetSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type variant_subset(variant_subsetSEXP);
    rcpp_result_gen = Rcpp::wrap(ReadIntList(pgen, variant_subset));
    return rcpp_result_gen;
END_RCPP
}
// ReadList
NumericMatrix ReadList(List pgen, IntegerVector variant_subset, bool meanimpute);
RcppExport SEXP _pgenlibr_ReadList(SEXP pgenSEXP, SEXP variant_subsetSEXP, SEXP meanimputeSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< IntegerVector >::type variant_subset(variant_subsetSEXP);
    Rcpp::traits::input_parameter< bool >::type meanimpute(meanimputeSEXP);
    rcpp_result_gen = Rcpp::wrap(ReadList(pgen, variant_subset, meanimpute));
    return rcpp_result_gen;
END_RCPP
}
// VariantScores
NumericVector VariantScores(List pgen, NumericVector weights, Nullable<IntegerVector> variant_subset);
RcppExport SEXP _pgenlibr_VariantScores(SEXP pgenSEXP, SEXP weightsSEXP, SEXP variant_subsetSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    Rcpp::traits::input_parameter< NumericVector >::type weights(weightsSEXP);
    Rcpp::traits::input_parameter< Nullable<IntegerVector> >::type variant_subset(variant_subsetSEXP);
    rcpp_result_gen = Rcpp::wrap(VariantScores(pgen, weights, variant_subset));
    return rcpp_result_gen;
END_RCPP
}
// ClosePgen
void ClosePgen(List pgen);
RcppExport SEXP _pgenlibr_ClosePgen(SEXP pgenSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pgen(pgenSEXP);
    ClosePgen(pgen);
    return R_NilValue;
END_RCPP
}
// NewPvar
SEXP NewPvar(String filename, bool omit_chrom, bool omit_pos);
RcppExport SEXP _pgenlibr_NewPvar(SEXP filenameSEXP, SEXP omit_chromSEXP, SEXP omit_posSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< String >::type filename(filenameSEXP);
    Rcpp::traits::input_parameter< bool >::type omit_chrom(omit_chromSEXP);
    Rcpp::traits::input_parameter< bool >::type omit_pos(omit_posSEXP);
    rcpp_result_gen = Rcpp::wrap(NewPvar(filename, omit_chrom, omit_pos));
    return rcpp_result_gen;
END_RCPP
}
// GetVariantChrom
String GetVariantChrom(List pvar, int variant_num);
RcppExport SEXP _pgenlibr_GetVariantChrom(SEXP pvarSEXP, SEXP variant_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    rcpp_result_gen = Rcpp::wrap(GetVariantChrom(pvar, variant_num));
    return rcpp_result_gen;
END_RCPP
}
// GetVariantPos
int GetVariantPos(List pvar, int variant_num);
RcppExport SEXP _pgenlibr_GetVariantPos(SEXP pvarSEXP, SEXP variant_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    rcpp_result_gen = Rcpp::wrap(GetVariantPos(pvar, variant_num));
    return rcpp_result_gen;
END_RCPP
}
// GetVariantId
String GetVariantId(List pvar, int variant_num);
RcppExport SEXP _pgenlibr_GetVariantId(SEXP pvarSEXP, SEXP variant_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    rcpp_result_gen = Rcpp::wrap(GetVariantId(pvar, variant_num));
    return rcpp_result_gen;
END_RCPP
}
// GetVariantsById
IntegerVector GetVariantsById(List pvar, String id);
RcppExport SEXP _pgenlibr_GetVariantsById(SEXP pvarSEXP, SEXP idSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< String >::type id(idSEXP);
    rcpp_result_gen = Rcpp::wrap(GetVariantsById(pvar, id));
    return rcpp_result_gen;
END_RCPP
}
// GetAlleleCode
String GetAlleleCode(List pvar, int variant_num, int allele_num);
RcppExport SEXP _pgenlibr_GetAlleleCode(SEXP pvarSEXP, SEXP variant_numSEXP, SEXP allele_numSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    Rcpp::traits::input_parameter< int >::type variant_num(variant_numSEXP);
    Rcpp::traits::input_parameter< int >::type allele_num(allele_numSEXP);
    rcpp_result_gen = Rcpp::wrap(GetAlleleCode(pvar, variant_num, allele_num));
    return rcpp_result_gen;
END_RCPP
}
// ClosePvar
void ClosePvar(List pvar);
RcppExport SEXP _pgenlibr_ClosePvar(SEXP pvarSEXP) {
BEGIN_RCPP
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< List >::type pvar(pvarSEXP);
    ClosePvar(pvar);
    return R_NilValue;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
    {"_pgenlibr_NewPgen", (DL_FUNC) &_pgenlibr_NewPgen, 4},
    {"_pgenlibr_GetRawSampleCt", (DL_FUNC) &_pgenlibr_GetRawSampleCt, 1},
    {"_pgenlibr_GetVariantCt", (DL_FUNC) &_pgenlibr_GetVariantCt, 1},
    {"_pgenlibr_GetAlleleCt", (DL_FUNC) &_pgenlibr_GetAlleleCt, 2},
    {"_pgenlibr_GetMaxAlleleCt", (DL_FUNC) &_pgenlibr_GetMaxAlleleCt, 1},
    {"_pgenlibr_HardcallPhasePresent", (DL_FUNC) &_pgenlibr_HardcallPhasePresent, 1},
    {"_pgenlibr_Buf", (DL_FUNC) &_pgenlibr_Buf, 1},
    {"_pgenlibr_AlleleCodeBuf", (DL_FUNC) &_pgenlibr_AlleleCodeBuf, 1},
    {"_pgenlibr_IntBuf", (DL_FUNC) &_pgenlibr_IntBuf, 1},
    {"_pgenlibr_IntAlleleCodeBuf", (DL_FUNC) &_pgenlibr_IntAlleleCodeBuf, 1},
    {"_pgenlibr_BoolBuf", (DL_FUNC) &_pgenlibr_BoolBuf, 1},
    {"_pgenlibr_ReadHardcalls", (DL_FUNC) &_pgenlibr_ReadHardcalls, 4},
    {"_pgenlibr_HasSparseHardcalls", (DL_FUNC) &_pgenlibr_HasSparseHardcalls, 3},
    {"_pgenlibr_ReadSparseHardcalls", (DL_FUNC) &_pgenlibr_ReadSparseHardcalls, 4},
    {"_pgenlibr_Read", (DL_FUNC) &_pgenlibr_Read, 4},
    {"_pgenlibr_HasSparse", (DL_FUNC) &_pgenlibr_HasSparse, 3},
    {"_pgenlibr_ReadSparse", (DL_FUNC) &_pgenlibr_ReadSparse, 3},
    {"_pgenlibr_ReadAlleles", (DL_FUNC) &_pgenlibr_ReadAlleles, 4},
    {"_pgenlibr_ReadIntList", (DL_FUNC) &_pgenlibr_ReadIntList, 2},
    {"_pgenlibr_ReadList", (DL_FUNC) &_pgenlibr_ReadList, 3},
    {"_pgenlibr_VariantScores", (DL_FUNC) &_pgenlibr_VariantScores, 3},
    {"_pgenlibr_ClosePgen", (DL_FUNC) &_pgenlibr_ClosePgen, 1},
    {"_pgenlibr_NewPvar", (DL_FUNC) &_pgenlibr_NewPvar, 3},
    {"_pgenlibr_GetVariantChrom", (DL_FUNC) &_pgenlibr_GetVariantChrom, 2},
    {"_pgenlibr_GetVariantPos", (DL_FUNC) &_pgenlibr_GetVariantPos, 2},
    {"_pgenlibr_GetVariantId", (DL_FUNC) &_pgenlibr_GetVariantId, 2},
    {"_pgenlibr_GetVariantsById", (DL_FUNC) &_pgenlibr_GetVariantsById, 2},
    {"_pgenlibr_GetAlleleCode", (DL_FUNC) &_pgenlibr_GetAlleleCode, 3},
    {"_pgenlibr_ClosePvar", (DL_FUNC) &_pgenlibr_ClosePvar, 1},
    {NULL, NULL, 0}
};

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