GridFlow 0.7.7 - C++/Ruby Internals

       

notes

Objects for Scripting

Objects for Internals



notes

In Ruby, GridFlow defines a namespace (module) called GridFlow. Most of the constants it defines are part of that namespace.

Ruby does not have the same concept of object as PD or jMax does. In GridFlow, object classes may inherit features from other object classes, and also there is no concept of inlet nor outlet, which are instead provided by GridFlow::FObject, which also has the purpose of exporting functionality to PD or jMax, whichever is present.

In this document (and in many others) the phrase "a Potato" will be a shorthand for "an object of the class called Potato", which is often used in modern software design and is a nice convention borrowed from biology.

A FObject is normally in two or three parts: a (Ruby) GridFlow::FObject that is the central part; a (C++) FObject; a (C++/jMax) BFObject. The GridFlow::FObject is created as a RData kind of box (T_DATA) using Ruby-C's Data_Make_Struct on a GridObject. This is how most Ruby-C programs inherit from Ruby classes. Note that Ruby's boxed objects have a maximum of five fields, and they're usually taken, so additional fields have to be outside of it. This is why RData exists.

So basically you have a C++ FObject that is "part of" a GridFlow::FObject and they point to each other using "peer pointers". Now, if jMax is enabled, then the GridObject will have an additional pointer to a fts_object_t derivative called BFObject (B for Bridge); that pointer is called foreign_peer. The BFObject links back to the RData box through another pointer called peer.

 

Objects for Scripting

  class ruby class FObject extending Data







Provides inlets and outlets to Ruby Objects.
method init ()

method send_in (int inlet, message...)

method send_out (int outlet, message...)

  class ruby class GridObject extending FObject







Provides grid support to FObjects.
method inlet_dim (Integer inlet) gives an array of Integers (dimension list)

method inlet_nt (Integer inlet) gives a Symbol (number type)

method inlet_set_factor (Integer inlet, Integer factor) ensures received packets have a size that is a whole multiple of this size. must be called from rgrid_begin.

method send_out_grid_begin (Integer outlet, Array of Integer dimensions, number type nt) establishes grid streams between an outlet and all inlets connected to it.

method send_out_grid_flow (Integer outlet, String data) for sending a grid data packet through that outlet.

method send_out_grid_end (Integer outlet) (isn't this one obsolete?)

inlet 0 method rgrid_begin ()

inlet 0 method rgrid_flow (String data)

inlet 0 method rgrid_end ()

  class ruby class BitPacking







A BitPacking is a simple two-way converter between different numeric layouts.
  class ruby FPatcher extending FObject







This class is much like jMax's templates and subpatchers and PureData's abstractions.

This is a container for objects. Its proper objects are numbered starting with zero. The wire list is given in terms of those numbers: (sourceobject,sourceinlet,destobject,destinlet). There is a pseudo-object numbered #-1 which map to the container's own inlets and outlets.


  class ruby GridFlow::USB







wrapper for struct usb_dev_handle


attr .busses (.busses)
  class ruby GridFlow::USB::Device







wrapper for struct usb_device and struct usb_device_descriptor


  class ruby GridFlow::USB::Config







wrapper for struct usb_config_descriptor, struct usb_interface


  class ruby GridFlow::USB::Interface







wrapper for struct usb_interface_descriptor


  class ruby GridFlow::USB::Endpoint







wrapper for struct usb_endpoint_descriptor


 

Objects for Internals

  class C++ class GridInlet







GridInlets represent inlets that accept grids.
  class C++ class GridOutlet







GridOutlets represent outlets that send grids.
  class C++ class Dim







Dim represents a list of dimensions.
  class C++ class Grid







Grid represents a grid that is fully stored in memory.
  class C++ class Numop1







This represents a one-input operator. Such an object contains a map() function that applies the operator over a memory segment.
  class C++ class Numop2







This represents a two-input operator. Such an object contains four functions for each T, where T is one of the types uint8, int16, int32, float32.
method map (integer n, Pt as, T b) for i in 0...n, as[i] := f(as[i],b); This is like [@] with a scalar righthand

method zip (integer n, Pt as, Pt bs) for i in 0...n, as[i] := f(as[i],bs[i]); bs is not modified. (This is like [@] with a nonscalar righthand)

method fold (integer an, integer n, Pt as, Pt bs)

for i in 0...n, for j in 0...an, as[j] := f(as[j],bs[i*an+j]);

(this is like @fold)

method scan (integer an, integer n, Pt as, Pt bs)

for j in 0...an: bs[j] := f(as[j],bs[j]);

for i in 1...n: for j in 0...an: bs[j] := f(bs[(i-1)*an+j],bs[i*an+j]);

(this is like @scan)

  class C++ class GridClass







This represents a class of GridObjects.
  class C++ class GFBridge







This holds linkage information about jMax and PureData and such.
 

GridFlow 0.7.7 Documentation
Copyright © 2001,2002,2003,2004 by Mathieu Bouchard matju@artengine.ca