############################################################
# Import required packages
############################################################

import(methods)     # for methods used in defining S4 classes
import(stringr)

############################################################
# Load dynamic libraries (shared object files)
############################################################
  
useDynLib(IRISSeismic)

############################################################
# Export S4 classes 
############################################################
  
# NOTE:  If we weren't exporting classes and methods explicitly
# NOTE:  we would use an exportPattern like this:
#
# exportPattern("^[a-zA-Z]") # all objects that begin with a letter

exportClasses(
    "IrisClient",
    "Stream",
    "Trace",
    "TraceHeader"
)

############################################################
# Export class methods 
############################################################

exportMethods(
    "as.headerLine",
    "as.vector",
    "butterworth",
    "DDT",
    "envelope",
    "eventWindow",
    "getAvailability",
    "getChannel",
    "getDataselect",
    "getDistaz",
    "getEvalresp",
    "getEvent",
    "getGaps",
    "getNetwork",
    "getRotation",
    "getStation",
    "getSNCL",
    "getDataAvailability",
    "getTimeseries",
    "getTraveltime",
    "getUnavailability",
    "getUpDownTimes",
    "hilbert",
    "initialize",
    "isDC",
    "length",
    "max",
    "mean",
    "median",
    "mergeTraces",
    "mergeUpDownTimes",
    "min",
    "multiplyBy",
    "parallelLength",
    "parallelMax",
    "parallelMean",
    "parallelMedian",
    "parallelMin",
    "parallelRmsVariance",
    "parallelSd",
    "plot",
    "plotUpDownTimes",
    "rms",
    "rmsVariance",
    "slice",
    "sd",
    "show",
    "STALTA",
    "triggerOnset",
    "uniqueIds"
)


############################################################
# Register generic S3 methods with new S4 classes
############################################################

S3method("as.vector", Trace)


############################################################
# Export functions that are not class methods
############################################################

# from Utils.R
export("miniseed2Stream",
       "readMiniseedFile",
       "rotate2D",
       "surfaceDistance")

# from spectralUtils.R
export("crossSpectrum",
       "hilbertFFT",
       "McNamaraBins",
       "McNamaraPSD",
       "noiseMatrix2PdfMatrix",
       "noiseModels",
       "psdDF2NoiseMatrix",
       "psdList",
       "psdList2NoiseMatrix",
       "psdPlot",
       "psdStatistics",
       "transferFunctionSpectra",
       "unHistogram"
)


############################################################
# Export wrapper functions associated with C code
############################################################

# mseed functions
###export("parseMiniSEED")
