R/eiR.R

Defines functions RSWIG_createNewRef enumToInteger enumFromInteger coerceIfNotSubclass assert R_SWIG_getCallbackFunctionStack R_SWIG_addCallbackFunctionStack `binaryCoord` `getSolver` `eucsearch2file`

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

##   Generated via the command line invocation:
##	 /usr/bin/swig -c++ -c++ -module eiR -o eiR/src/r_wrap.cpp -r swig.i


#                         srun.swg                            #
#
# This is the basic code that is needed at run time within R to
# provide and define the relevant classes.  It is included
# automatically in the generated code by copying the contents of
# srun.swg into the newly created binding code.


# This could be provided as a separate run-time library but this
# approach allows the code to to be included directly into the
# generated bindings and so removes the need to have and install an
# additional library.  We may however end up with multiple copies of
# this and some confusion at run-time as to which class to use. This
# is an issue when we use NAMESPACES as we may need to export certain
# classes.

######################################################################

if(length(getClassDef("RSWIGStruct")) == 0) 
  setClass("RSWIGStruct", representation("VIRTUAL"))



##if(length(getClassDef("ExternalReference")) == 0) 
# Should be virtual but this means it loses its slots currently
#representation("VIRTUAL")
##  setClass("ExternalReference", representation( ref = "externalptr"))



#if(length(getClassDef("NativeRoutinePointer")) == 0) 
#  setClass("NativeRoutinePointer", 
#              representation(parameterTypes = "character",
#                             returnType = "character",
#                             "VIRTUAL"), 
#              contains = "ExternalReference")
#
#if(length(getClassDef("CRoutinePointer")) == 0) 
#  setClass("CRoutinePointer", contains = "NativeRoutinePointer")


#if(length(getClassDef("EnumerationValue")) == 0) 
#  setClass("EnumerationValue", contains = "integer")


if(!isGeneric("copyToR")) 
 setGeneric("copyToR",
            function(value, obj = new(gsub("Ref$", "", class(value)))) 
               standardGeneric("copyToR"
           ))

setGeneric("delete", function(obj) standardGeneric("delete"))


RSWIG_createNewRef = 
function(className, ..., append = TRUE)
{
  f = get(paste("new", className, sep = "_"), mode = "function")

  f(...)
}

if(!isGeneric("copyToC")) 
 setGeneric("copyToC", 
             function(value, obj = RSWIG_createNewRef(class(value)))
              standardGeneric("copyToC"
            ))


# 
#defineEnumeration =
#function(name, .values, where = topenv(parent.frame()), suffix = "Value")
#{
#   # Mirror the class definitions via the E analogous to .__C__
#  defName = paste(".__E__", name, sep = "")
#  assign(defName,  .values,  envir = where)
#
#  if(nchar(suffix))
#    name = paste(name, suffix, sep = "")
#
#  setClass(name, contains = "EnumerationValue", where = where)
#}

enumToInteger <- function(name,type)
{
   if (is.character(name)) {
   ans <- as.integer(get(paste(".__E__", type, sep = ""))[name])
   if (is.na(ans)) {warning("enum not found ", name, " ", type)}
   ans
   } 
}

enumFromInteger =
function(i,type)
{
  itemlist <- get(paste(".__E__", type, sep=""))
  names(itemlist)[match(i, itemlist)]
}

coerceIfNotSubclass =
function(obj, type) 
{
    if(!is(obj, type)) {as(obj, type)} else obj
}


#setClass("SWIGArray", representation(dims = "integer"), contains = "ExternalReference")

#setMethod("length", "SWIGArray", function(x) x@dims[1])


#defineEnumeration("SCopyReferences",
                   #.values = c( "FALSE" = 0, "TRUE" = 1, "DEEP" = 2))

assert = 
function(condition, message = "")
{
  if(!condition)
    stop(message)

  TRUE
}


if(FALSE) {
print.SWIGFunction =
function(x, ...)
 {
 }
}


#######################################################################

R_SWIG_getCallbackFunctionStack =
function()
{
    # No PACKAGE argument as we don't know what the DLL is.
  .Call("R_SWIG_debug_getCallbackFunctionData")
}

R_SWIG_addCallbackFunctionStack =
function(fun, userData = NULL)
{
    # No PACKAGE argument as we don't know what the DLL is.
  .Call("R_SWIG_R_pushCallbackFunctionData", fun, userData)
}


#######################################################################


#setClass('C++Reference', contains = 'ExternalReference')



#setMethod('[', "ExternalReference",
#function(x,i,j, ..., drop=TRUE) 
#if (!is.null(x$"__getitem__")) 
#sapply(i, function(n) x$"__getitem__"(i=as.integer(n-1))))
#
#setMethod('[<-' , "ExternalReference",
#function(x,i,j, ..., value) 
#if (!is.null(x$"__setitem__")) {
#sapply(1:length(i), function(n) 
#x$"__setitem__"(i=as.integer(i[n]-1), x=value[n]))
#x
#})

#setAs('ExternalReference', 'character',
#function(from) {if (!is.null(from$"__str__")) from$"__str__"()})

#setMethod('print', 'ExternalReference',
#function(x) {print(as(x, "character"))})

# Start of binaryCoord

`binaryCoord` = function(inFile, outFile, dim, .copy = FALSE)
{
  inFile = as(inFile, "character"); 
  outFile = as(outFile, "character"); 
  dim = as.integer(dim); 
  
  if(length(dim) > 1) {
    warning("using only the first element of dim");
  };
  
  ;.Call('R_swig_binaryCoord', inFile, outFile, dim, as.logical(.copy), PACKAGE='eiR');
  
}

attr(`binaryCoord`, 'returnType') = 'integer'
attr(`binaryCoord`, "inputTypes") = c('character', 'character', 'integer')
class(`binaryCoord`) = c("SWIGFunction", class('binaryCoord'))

# Start of getSolver

`getSolver` = function(r, d, refCoords)
{
  r = as.integer(r); 
  
  if(length(r) > 1) {
    warning("using only the first element of r");
  };
  
  d = as.integer(d); 
  
  if(length(d) > 1) {
    warning("using only the first element of d");
  };
  
  
  ;ans = .Call('R_swig_getSolver', r, d, refCoords, PACKAGE='eiR');
  class(ans) <- "_p_Solver";
  
  ans
  
}

attr(`getSolver`, 'returnType') = '_p_Solver'
attr(`getSolver`, "inputTypes") = c('integer', 'integer', 'numeric')
class(`getSolver`) = c("SWIGFunction", class('getSolver'))

# Start of eucsearch2file

`eucsearch2file` = function(matrix, queryMatrix, n_results, outfile, .copy = FALSE)
{
  matrix = as(matrix, "character"); 
  queryMatrix = as(queryMatrix, "character"); 
  n_results = as.integer(n_results); 
  
  if(length(n_results) > 1) {
    warning("using only the first element of n_results");
  };
  
  outfile = as(outfile, "character"); 
  ;.Call('R_swig_eucsearch2file', matrix, queryMatrix, n_results, outfile, as.logical(.copy), PACKAGE='eiR');
  
}

attr(`eucsearch2file`, 'returnType') = 'integer'
attr(`eucsearch2file`, "inputTypes") = c('character', 'character', 'integer', 'character')
class(`eucsearch2file`) = c("SWIGFunction", class('eucsearch2file'))
girke-lab/eiR-release documentation built on May 17, 2019, 5:27 a.m.