useDynLib(XVector)

import(methods)
importFrom(utils, relist, download.file)
importFrom(stats, setNames)
importFrom(tools, file_path_as_absolute)

import(BiocGenerics)
import(S4Vectors)
import(IRanges)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 classes
###

exportClasses(
    SharedVector, SharedVector_Pool,
    SharedRaw, SharedRaw_Pool,
    SharedInteger, SharedDouble,
    XVector, XRaw, XInteger, XDouble,
    GroupedIRanges, XVectorList, XRawList,
    XIntegerViews,
    RdaCollection,
    RdsCollection
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S3 methods
###

S3method(duplicated, XRawList)

### We also export them thru the export() directive so that (a) they can be
### called directly, (b) tab-completion on the name of the generic shows them,
### and (c) methods() doesn't asterisk them.
export(
    duplicated.XRawList
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 methods for generics not defined in XVector
###

exportMethods(
    ## Methods for generics defined in the base package:
    length, 
    names, "names<-",
    "[", "[<-", "[[", "[[<-",
    rev,
    as.vector, as.integer, as.numeric, as.raw, as.data.frame,
    toString,
    c,
    "==", "!=", "<=",
    duplicated, match,
    order, rank, is.unsorted,

    ## Methods for generics defined in the methods package:
    show, coerce,

    ## Methods for generics defined in the utils package:
    relist,

    ## Methods for generics defined in the BiocGenerics package:
    updateObject,
    width,
    path,

    ## Methods for generics defined in the S4Vectors package:
    showAsCell,
    bindROWS,
    extractROWS, getListElement,
    parallel_slot_names,
    pcompare,
    elementNROWS,
    relistToClass,

    ## Methods for generics defined in the IRanges package:
    Views,
    viewApply,
    viewMins, viewMaxs, viewSums, viewMeans,
    viewWhichMins, viewWhichMaxs,
    extractList,
    windows,
    reverse,
    slice
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export non-generic functions
###

export(
    open_input_files,
    SharedVector.compare,
    SharedVector.copy,
    SharedRaw,
    SharedRaw.readInts, SharedRaw.writeInts,
    SharedRaw.read, SharedRaw.write,
    SharedRaw.readComplexes,
    #SharedInteger, SharedInteger.read, SharedInteger.write,
    #SharedDouble, SharedDouble.read, SharedDouble.write,
    XRaw, XInteger, XDouble, XNumeric,
    XVectorList,
    unsplit_list_of_XVectorList,
    RdaCollection,
    RdsCollection
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 generics defined in XVector + export corresponding methods
###

export(
    ## XVector-class.R:
    subseq, "subseq<-",

    ## RdaCollection-class.R:
    rdaPath,

    ## compact-methods.R:
    xvcopy, compact,

    ## reverse-methods.R:
    reverse
)

### Exactly the same list as above.
exportMethods(
    subseq, "subseq<-",
    rdaPath,
    xvcopy, compact,
    reverse
)

