File: containsOutOfMemoryData.R

package info (click to toggle)
r-bioc-biocgenerics 0.52.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 772 kB
  • sloc: makefile: 2
file content (59 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
### =========================================================================
### The containsOutOfMemoryData() generic
### -------------------------------------------------------------------------

setGeneric("containsOutOfMemoryData",
    function(object) standardGeneric("containsOutOfMemoryData")
)

.S4_object_contains_out_of_memory_data <- function(object)
{
    slot_names <- slotNames(class(object))
    for (name in slot_names) {
        if (containsOutOfMemoryData(slot(object, name)))
            return(TRUE)
    }
    FALSE
}

.list_contains_out_of_memory_data <- function(object)
{
    for (x in object) {
        if (containsOutOfMemoryData(x))
            return(TRUE)
    }
    FALSE
}

.environment_contains_out_of_memory_data <- function(object)
{
    for (name in names(object)) {
        if (containsOutOfMemoryData(object[[name]]))
            return(TRUE)
    }
    FALSE
}

setMethod("containsOutOfMemoryData", "ANY",
    function(object)
    {
        if (isS4(object))
            return(.S4_object_contains_out_of_memory_data(object))
        FALSE
    }
)

setMethod("containsOutOfMemoryData", "list",
    .list_contains_out_of_memory_data
)

setMethod("containsOutOfMemoryData", "environment",
    .environment_contains_out_of_memory_data
)

setClass("OutOfMemoryObject", representation("VIRTUAL"))

setMethod("containsOutOfMemoryData", "OutOfMemoryObject",
    function(object) TRUE
)