search for: classa

Displaying 20 results from an estimated 38 matches for "classa".

Did you mean: class
2011 Aug 26
1
R.oo data members / inheritance
If someone is able, can you tell me if there is a better way to do this? More specifically, do I have to rewrite all of the data members stuff and extend stuff of parent class in the child class? See below. Thanks in advance! Example 1: setConstructorS3("ClassA", function(A,x) { if(missing(A))A=15; if(missing(x))x=NA; extend(Object(), "ClassA", .size = A, .x=x ) }) setMethodS3("getSize", "ClassA", function(this,...) { this$.size; }) setMethodS3("getX", "ClassA", function(this,...) {...
2011 Oct 24
0
R.oo package: do setMethodS3 work upon construction
...if xOne (in this case) is a very complex method (that you always want to be called every time you create a new object). If I have something wrong please let me know! (I'm about to implement this in a large'ish program.) Great package for OOP programming! Example 1: setConstructorS3("ClassA", function() { this = extend(Object(), "ClassA", .x=NULL ) this$xOne() # this is useful!!!!!!!!!!!!! this }) setMethodS3("xOne", "ClassA", function(this,...) { this$.x = 1 }) setMethodS3("getX", "ClassA", function(this,...) {...
2008 Nov 05
1
Methods dispatch and inheritance R.oo
Hi to all members, i have a question about class inheritance and methods using R.oo package: I have the following code and it doesn't work, guess i'm doing smth wrong and there is nothing in the help. library(R.oo) setConstructorS3("ClassA", function(A=15) { extend(Object(), "ClassA", .size = A ); }) setMethodS3("print", "ClassA", function(this,...) { print(paste('Class A:',this$.size)); }) objA<-ClassA(); objA [1] "Class A: 15" setConstructorS3("ClassB&quo...
2009 Oct 20
1
Suggestion for exception handling: More informative error message for "no applicable method..." (S3)
I'd like to suggest that whenever there is no S3 method implementation available for a particular class, that the error message would also report the class structure of the object dispatched on. Example: foo <- function(...) UseMethod("foo") foo.ClassA <- function(object, ...) { cat("foo() for ClassA called.\n") } > foo(structure(1, class="ClassA")) foo() for ClassA called. Now: > foo(NULL) Error in UseMethod("foo") : no applicable method for "foo" > foo(Sys.time()) Error in UseMethod("...
2009 Jul 07
2
[LLVMdev] How to add an include file
Hi Eli, Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp to product a library libClassA.a. ClassA.h contains the single declaration. class A {...}; I want to transform it to: #include "ClassB.h" class A : public class B {...}; ClassB.h is the header file for a library libClassB.a built from ClassB.cpp a...
2009 Jul 07
0
[LLVMdev] How to add an include file
On Tue, Jul 7, 2009 at 1:42 AM, David Minor<dahvid.minor at gmail.com> wrote: > Hi Eli, > Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp > to product a library libClassA.a. > ClassA.h contains the single declaration. > > class A {...}; > > I want to transform it to: > > #include "ClassB.h" > > class A : public class B {...}; > > ClassB.h is the header...
2011 Aug 18
0
Call super methods from inherited classes R.oo
...va development seems to be in place with this library. But...there is something that I'm really missing... *the super method call* Just a little example that shall demonstrate what I mean: Image we have the following class hierachie that I graped from another post - thx to YuriWerewolf ;-). *ClassA* setConstructorS3("ClassA", function(A) { extend(Object(), "ClassA", .size = A ); }) setMethodS3("print", "ClassA", function(this,...) { print(paste('Class A:',this$.size)); }) *ClassB (inherits ClassA)* setConstructorS3("ClassB"...
2009 Mar 18
1
Why S4 methods of S3 'base' generics are not used in 'base' functions ?
Dear list, It seems that S4 methods defined for an S3 'base' generic are not used in 'base' functions. This can be problematic when 'base' functions start with something like 'as.matrix'. ### START R code setClass("classA", contains = "matrix", representation(realData = "numeric")) setMethod("as.matrix", "classA", function(x) callGeneric(x at realData)) x <- new("classA", diag(1:4), realData = 1:4) as.matrix(x) ## # as intended ## [,1] ## [1...
2003 Oct 02
1
"[[<-","[[" default?
Hi! I have implemented class specific behaviour of "[[<-.myclass"<-function(). How it is posible to call the "[[.default" on an object of myclass? Eryk Dipl. bio-chem. Eryk Witold Wolski @ MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: wolski@molgen.mpg.de ---W-W----
2006 Apr 08
7
text_field and arrays
Hi, I''m trying to do a bulk update on an array with the helper text_field. I''m trying to create an inputfield for every object in the array, but I''m not getting it right... example: class ClassA @arrayB[] end HTML (code with error): <% 0.upto(9) do |index| %> <%= text_field ''ClassA'', ''arrayB[index]'' %> non working alternative: <%= text_field ''ClassA[arrayB][]'', ''index'' %> Thanks in advance, B...
2010 Jan 05
5
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
...s=1] %2 = frem double %1, 1.000000e+01 ; <double> [#uses=1] %3 = fcmp ogt double %2, 3.000000e+00 ; <i1> [#uses=1] ret i1 %3 } Now, I would like to change the type of the argument from double * to a pointer to an object ( C++ class ) like ClassA * %record, and inside the function body, I would like to call the virtual functions of the ClassA %record object to get the value for the evaluation. As far as I understand, we can get the members of a struct from getElementPtr function, but is it possible to call a virtual function of an object to...
2009 Jul 05
0
[LLVMdev] How to add an include file
On Sun, Jul 5, 2009 at 1:16 PM, David Minor<dahvid.minor at gmail.com> wrote: > I'm writing a code transformation that involves adding an include to > existing code, adding a base class > to and existing class and then linking with a previously compiled library. > The main problem for me > seems to be how can I add the include?  Can I compile the include alone to > byte
2009 Jul 08
1
[LLVMdev] How to add an include file
...you correctly adding an inheritee wouldn't be possible. David On Tue, Jul 7, 2009 at 12:43 PM, Eli Friedman <eli.friedman at gmail.com>wrote: > On Tue, Jul 7, 2009 at 1:42 AM, David Minor<dahvid.minor at gmail.com> wrote: > > Hi Eli, > > Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp > > to product a library libClassA.a. > > ClassA.h contains the single declaration. > > > > class A {...}; > > > > I want to transform it to: > > > > #include "ClassB.h" > > > > class A : publ...
2010 Jan 06
0
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
...on when running. If you are building a standalone application then this is no problem. If you are running the IR using the JIT then it is also possible, hopefully someone else will explain how. > I am asking this question because I want to fix this example to get a > class member variable (ClassA * %record) and call the member function > of it from inside LLVM IR. You are allowed to call a pointer, i.e. a function declaration is not required. So you can just load the pointer out of %record, bitcast it to the right function type, and call it. Ciao, Duncan. PS: Please reply to the lis...
2009 Jul 05
2
[LLVMdev] How to add an include file
I'm writing a code transformation that involves adding an include to existing code, adding a base class to and existing class and then linking with a previously compiled library. The main problem for me seems to be how can I add the include? Can I compile the include alone to byte code and pre-pend it? Should I compile the library, which includes the include and parse out the include and
2015 Jan 24
3
Proper way to define cbind, rbind for s4 classes in package
...written a package using S4 classes and would like to use the functions rbind, cbind with these defined classes. Since it does not seem to be possible to define rbind and cbind directly as S4 methods (see ?cBind) I defined rbind2 and cbind2 instead: setMethod("rbind2", signature(x="ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) setMethod("cbind2", signature(x="ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) >From ?cbind2 I learned that these functions need to be activated using methods:::bind_acti...
2009 Aug 17
2
S4 Generics and NAMESPACE : justified warning ?
...ctions ('plot') in its namespace to avoid the warning "replacing previous import: plot". Suppose we use the simple 'import' directive in the name space of pkgB. pkgA and pkgB files would be pkgA/NAMESPACE: import(graphics) import(methods) exportClasses("classA") exportMethods("plot") pkgA/R/pkgA.R: setClass("classA", contains = "matrix") setMethod("plot", "classA", function(x, y, ...) NULL) pkgB/NAMESPACE: import(methods) import(garphics) import(pkgA) Loading pkgB would the...
2002 May 21
4
setClass() and packages
Where should the setClass() ('methods' package) calls be placed in a package? I try to follow a one-class-one-file principe, but since setClass("ClassA", "ClassB") has to come a after setClass("ClassB", [snip]) it is not possible to fully follow this rule. So the best I can do now is to put all setClass() calls in a file named "000.R" (I know this file is *not* guaranteed to be included first, but it works with c...
2008 Dec 22
2
... (dotMethods) and cbind/rbind: how to give the signature?
Dear List, I'm struggling with the signature writing cbind/rbind functions for a S4 class. First of all, I'm very happy that it is now possible to dispatch on ... I follow the example for "paste" in ?dotMethods, which works as far as this: ### start example setClass ("cbtest", representation = representation (data = "data.frame"),
2011 Oct 04
1
package.skeleton generates ".env = <environment>"
Hello, i trying to create a package using package.skeleton. I use R.oo package to create oriented-object classes. When i use package.skeleton, this creates the following file: classA <- structure(function() { extend(Object(),"Class A", .var1= NULL) } , .env = <environment>, class = c("Class", "Object"), formals = c("public", "c...