
Originally Posted by
sincnarf
what are the examples of the plugin functions? I need to teach the students how to create their own plugins too so I need to document it. I sort of need to create my own API for it.
Here is an example of the ChainLink "rand" plugin function which returns a random multi-dimensional array of numbers.
//[function] rand
//input: integer [N1], integer [N2], integer [N3], integer [N4], integer [N5], integer [N6]
//output: mda ret
//description: define a multidimensional array of random numbers
bool rand(mda &ret, integer N1=-1, integer N2=-1, integer N3=-1, integer N4=-1, integer N5=-1,integer N6=-1);
//[function] rand
//input: integer [N1], integer [N2], integer [N3], integer [N4], integer [N5], integer [N6]
//output: mda ret
//description: define a multidimensional array of random numbers
bool rand(mda &ret, integer N1=-1, integer N2=-1, integer N3=-1, integer N4=-1, integer N5=-1,integer N6=-1);
To copy to clipboard, switch view to plain text mode
... and the implementation ...
bool rand(mda &ret, integer N1, integer N2, integer N3, integer N4, integer N5,integer N6) {
ret.allocate(MDA_TYPE_REAL,N1,N2,N3,N4,N5,N6);
int32 j;
for (j=0; j<ret.size(); j++)
ret.set((real)rand()/RAND_MAX,j);
return true;
}
bool rand(mda &ret, integer N1, integer N2, integer N3, integer N4, integer N5,integer N6) {
ret.allocate(MDA_TYPE_REAL,N1,N2,N3,N4,N5,N6);
int32 j;
for (j=0; j<ret.size(); j++)
ret.set((real)rand()/RAND_MAX,j);
return true;
}
To copy to clipboard, switch view to plain text mode
This is the kind of thing that the students would need to write to create custom functions. Here mda is a fundamental datatype in chaninlink (multi-dimensional array).
From the console it would just be
> X=rand(100,100);
> viewmda(X);

Originally Posted by
sincnarf
I really would like to get everything going with the QGraphicsView Framework, even the application of the image processing function. But if there's no other way to use the functions, the second step, "> Y = my_processing_function(X)" is alright
The QGraphicsView framework would certainly be possible even from within chainlink.
JM
Bookmarks