From janko.thyson.rstuff at googlemail.com  Mon Jun  6 18:48:49 2011
From: janko.thyson.rstuff at googlemail.com (Janko Thyson)
Date: Mon, 06 Jun 2011 18:48:49 +0200
Subject: [Rd] Reference Classes: shortcut like 'isS4' for Ref Classes?
Message-ID: <4DED04F1.9040200@googlemail.com>

Dear list,

is there a shortcut-function to check whether a class is a Reference 
Class or not? There's something like this for S4 classes 
('isS4(object)'), but I couldn't find anything regarding Ref Classes.

Currently, I'm doing it this way, which is a bit clumsy:

A <- setRefClass("A", fields=list(X="numeric"))
a <- A$new()

isRefClass <- function(object, ...){
     return(getClass(class(object))@class == "refClassRepresentation")
#    getRefClass(class(object))@class == "refObjectGenerator"
}

isRefClass(a)
[1] TRUE

Regards,
Janko



[Rd] Reference Classes: shortcut like 'isS4' for Ref Classes?
Janko Thyson