R/DataClasses.R
bcff5d52
 ##############################################################
 ## Defines supported backend APIs
 ##  - NULL: default
e3f79ff5
 ##  - C++Object: for Rcpp modules for pwiz backends
dfbd825f
 ##  - ncdf4 for netCDF files
 setOldClass("ncdf4")
bcff5d52
 setClassUnion("msAPI",
dfbd825f
               c("C++Object","ncdf4", "NULL"))
bcff5d52
 
 ##############################################################
 ## mzR main virtual class
 ## The individual backends are implemented in the different
 ## sub-classes
 
 setClass("mzR",
          representation(fileName="character",
                         backend="msAPI",
                         "VIRTUAL"),        
          contains=c("Versioned"),
          prototype=prototype(
            fileName = "",
            new("Versioned", versions=c(mzR="0.2.0"))),
          validity=function(object) {
            msg <- validMsg(NULL,NULL)
            if (object@fileName == "")
              msg <- validMsg(msg,"Filename is missing.")
            if (is.null(msg)) TRUE
            else msg
          })
 
84a4b166
 ##############################################################
 ## mzRpwiz - pwiz backend through an Rcpp module 
 setClass("mzRpwiz",
          representation(backend="C++Object"),
          contains=c("mzR"),
          prototype=prototype(
            new("Versioned", versions=c(mzR="0.0.1")))
          )
bcff5d52
 
 
 ##############################################################
 ## mzRnetCDF - netCDF backend 
 setClass("mzRnetCDF",
dfbd825f
          representation(backend="ncdf4"),
bcff5d52
          contains=c("mzR"),
          prototype=prototype(
dfbd825f
              new("Versioned", versions=c(mzR="0.0.2"))),
          validity=function(object) {
              msg <- validMsg(NULL,NULL)
              if (is.null(object@backend))
                  msg <- validMsg(msg,"ncdf4 object not initialised.")
              if (is.null(object@backend$id))
                  msg <- validMsg(msg,"ncdf4 object is closed.")
              if (is.null(msg)) TRUE
              else msg }
bcff5d52
          )
84a4b166
 
 ##############################################################
 ## mzRident - pwiz backend for mzid file
 setClass("mzRident",
          representation(backend="C++Object"),
          contains=c("mzR"),
          prototype=prototype(
            new("Versioned", versions=c(mzR="0.0.1")))
          )