useDynLib(datatable, .registration=TRUE)

## For S4-ization
import(methods)
exportClasses(data.table, IDate, ITime)
##

export(data.table, tables, setkey, setkeyv, key, "key<-", haskey, CJ, SJ, copy)
export(set2key, set2keyv, key2, setindex, setindexv, indices)
export(as.data.table,is.data.table,test.data.table,last,first,like,"%like%",between,"%between%",inrange,"%inrange%")
export(timetaken)
export(truelength, alloc.col, ":=")
export(setattr, setnames, setcolorder, set, setDT, setDF)
export(setorder, setorderv)
export(setNumericRounding, getNumericRounding)
export(chmatch, "%chin%", chorder, chgroup)
export(rbindlist)
export(fread)
export(fwrite)
export(foverlaps)
export(shift)
export(transpose)
export(tstrsplit)
export(frank)
export(frankv)
export(address)
export(.SD,.N,.I,.GRP,.BY,.EACHI)
export(rleid)
export(rleidv)
export(rowid)
export(rowidv)
export(uniqueN)
export(setDTthreads, getDTthreads)
# set operators
export(fintersect)
export(fsetdiff)
export(funion)
export(fsetequal)
S3method(all.equal, data.table)
export(shouldPrint)
export(fsort)  # experimental parallel sort for vector type double only, currently
# grouping sets
export(groupingsets)
export(cube)
export(rollup)
S3method(groupingsets, data.table)
S3method(cube, data.table)
S3method(rollup, data.table)

S3method("[", data.table)
S3method("[<-", data.table)
# S3method("[[", data.table)
# S3method("[[<-", data.table)
S3method("$<-", data.table)
S3method(print, data.table)
S3method(as.data.table, data.table)
S3method(as.data.table, data.frame)
S3method(as.data.table, array)
S3method(as.data.table, matrix)
S3method(as.data.table, list)
S3method(as.data.table, integer)
S3method(as.data.table, numeric)
S3method(as.data.table, character)
S3method(as.data.table, logical)
S3method(as.data.table, factor)
S3method(as.data.table, ordered)
S3method(as.data.table, Date)
S3method(as.data.table, ITime)
S3method(as.data.table, table)
S3method(as.data.table, default)
S3method(as.data.frame, data.table)
S3method(as.list, data.table)
S3method(as.matrix, data.table)
#S3method(cbind, data.table)
#S3method(rbind, data.table)
export(.rbind.data.table)
S3method(dim, data.table)
S3method(dimnames, data.table)
S3method("dimnames<-", data.table)
S3method("names<-", data.table)
S3method(duplicated, data.table)
S3method(unique, data.table)
S3method(merge, data.table)
S3method(subset, data.table)
S3method(transform, data.table)
S3method(within, data.table)
S3method(is.na, data.table)
S3method(format, data.table)
S3method(Ops, data.table)
S3method(anyDuplicated, data.table)
S3method(split, data.table)

export(dcast)
S3method(dcast, data.table)
export(dcast.data.table)
# exported too because if reshape2 is higher on search path, dcast(DT) will not dispatch since reshape2::dcast is not generic. So users
# and many packges on CRAN call the exported function dcast.data.table() directly. See #3082.

export(melt)
S3method(melt, data.table)
export(melt.data.table)
# method exported too for consistency with dcast.data.table. Can never remember which one is generic in reshape2 and which one
# isn't. By now too much user code relies on melt.data.table being exported.


import(utils)
S3method(update, dev.pkg)
export(update.dev.pkg)
S3method(tail, data.table)
S3method(head, data.table)
import(stats)
S3method(na.omit, data.table)

S3method(as.data.table, xts)
if(getRversion() >= "3.6.0") {
  export(as.xts.data.table)          # fails in R-devel if not exported too, but I don't understand why
  S3method(xts::as.xts, data.table)  # delayed registration (new in R-devel)  -- shouldn't this also export as.xts.data.table for us?
} else {
  export(as.xts.data.table)
}

# IDateTime support:
export(as.IDate,as.ITime,IDateTime)
export(second,minute,hour,yday,wday,mday,week,isoweek,month,quarter,year)

S3method("[", ITime)
S3method("+", IDate)
S3method("-", IDate)
S3method(as.character, ITime)
S3method(as.data.frame, ITime)
S3method(as.Date, IDate)   # note that zoo::as.Date masks base::as.Date. Both generic.
export(as.Date.IDate)      # workaround for zoo bug, see #1500. Removing this export causes CI pipeline to fail on others.Rraw test 6, but I can't reproduce locally.
S3method(as.IDate, Date)
S3method(as.IDate, POSIXct)
S3method(as.IDate, default)
S3method(as.IDate, numeric)
S3method(as.ITime, character)
S3method(as.ITime, default)
S3method(as.ITime, POSIXct)
S3method(as.ITime, numeric)
S3method(as.ITime, POSIXlt)
S3method(as.ITime, times)
S3method(as.list, IDate)
S3method(as.POSIXct, IDate)
S3method(as.POSIXct, ITime)
S3method(as.POSIXlt, ITime)
S3method(c, IDate)
S3method(cut, IDate)
S3method(format, ITime)
S3method(IDateTime, default)
S3method(mean, IDate)
S3method(print, ITime)
S3method(rep, IDate)
S3method(rep, ITime)
S3method(round, IDate)
S3method(seq, IDate)
S3method(split, IDate)
S3method(unique, IDate)
S3method(unique, ITime)



# [.factor
# c.factor
# duplist
# getdots
# NCOL
# NROW
# take
# trim
# which.first
# which.last

