Skip to content

Commit

Permalink
method for getElementType for list and logical
Browse files Browse the repository at this point in the history
  • Loading branch information
duncantl committed Jun 27, 2017
1 parent cf90147 commit 8441a92
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,39 @@ setMethod("getElementTypes", "StructType",
.Call("R_StructType_getElementTypes", x, PACKAGE = "Rllvm"))

setGeneric("getElementType",
function(type, direct = TRUE)
standardGeneric("getElementType"))
function(type, direct = TRUE) {
if(direct)
.Call("R_Type_getPointerElementType", type)
standardGeneric("getElementType")
})

setMethod("getElementType", "ANY",
function(type, direct = TRUE)
.Call("R_Type_getPointerElementType", type) )

setMethod("getElementType", "REALSXPType",
function(type, direct = TRUE) {
if(direct)
.Call("R_Type_getPointerElementType", type)
else
DoubleType
DoubleType
})


setMethod("getElementType", "VECSXPType",
function(type, direct = TRUE) {
SEXPType
})


setMethod("getElementType", "INTSXPType",
function(type, direct = TRUE) {
if(direct)
.Call("R_Type_getPointerElementType", type)
else
Int32Type
Int32Type
})

setMethod("getElementType", "LGLSXPType",
function(type, direct = TRUE) {
Int32Type
})



arrayType =
function(elType, num)
Expand Down

0 comments on commit 8441a92

Please sign in to comment.