Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • dev
2 results

sbmlPtrClass.R

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    sbmlPtrClass.R 5.47 KiB
    #------------------------------------------------------------------------------#
    #                          Link to libSBML for sybil                           #
    #------------------------------------------------------------------------------#
    
    #  sbmlPtrClass.R
    #  Link to libSBML for sybil.
    #
    #  Copyright (C) 2010-2013 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics,
    #  Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany.
    #  All right reserved.
    #  Email: geliudie@uni-duesseldorf.de
    #
    #  This file is part of sybilSBML.
    #
    #  SybilSBML is free software: you can redistribute it and/or modify
    #  it under the terms of the GNU General Public License as published by
    #  the Free Software Foundation, either version 3 of the License, or
    #  (at your option) any later version.
    #
    #  SybilSBML is distributed in the hope that it will be useful,
    #  but WITHOUT ANY WARRANTY; without even the implied warranty of
    #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #  GNU General Public License for more details.
    #
    #  You should have received a copy of the GNU General Public License
    #  along with SybilSBML.  If not, see <http://www.gnu.org/licenses/>.
    
    
    #------------------------------------------------------------------------------#
    #                          definition of class sbmlPtr                         #
    #------------------------------------------------------------------------------#
    
    
    # representation of class sbmlPtr
    setClass(Class = "sbmlPtr",
             representation(
                  sbmlPtrType  = "character",
                  sbmlPointer  = "externalptr",
                  sbmlDocKey   = "character",
                  sbmlFileName = "character"
             )
    )
    
    
    #------------------------------------------------------------------------------#
    
    # contructor for class sbmlPtr
    setMethod(f = "initialize",
              signature = "sbmlPtr",
              definition = function(.Object, p, w, key, fname) {
    
                  .Object@sbmlPointer  <- attr(p, which = w, exact = TRUE)
                  .Object@sbmlPtrType  <- as.character(p)
                  .Object@sbmlDocKey   <- as.character(key)
                  .Object@sbmlFileName <- as.character(fname)
    
                  return(.Object)
              
              }
    )
    
    
    # constructor for pointers to sbml documents
    sbmlDocPointer <- function(pointer) {
    
        if (is(pointer, "sbml_doc_ptr")) {
            pObj <- new("sbmlPtr",
                        p = pointer,
                        w = as.character("sbml_doc_ptr"),
                        key = as.character(sybil:::.generateModKey()),