[vistrails-users] Custom Types for Ports
remi.rampin at nyu.edu
Fri Aug 8 09:45:48 EDT 2014
2014-08-07 16:20 EDT, Michael Noseworthy:
> I am in the process of writing my own modules and was wondering if its
> possible to package multiple ports into one (for example have one port that
> contains both a String and Float value). So when an input port/output port
> are connected like this, both pieces of data get passed through a single
> port instead of two separate ones.
While this is doable with some amount of trickery, it is not currently
supported. Ports can have "tuple" types like you describe, e.g. "(String,
Float)", but these are not automatically constructed by passing separate
connections on a port. When packing or unpacking is required, you are
supposed to use the Tuple and Untuple modules, like so:
In this example, YourModule is defined as follow:
class YourModule(Module): _input_ports = [('input', '(basic:String,
basic:Float)')] _output_ports = [('output', '(basic:String, basic:Float)')]
Also, is it possible to define my own types for ports so I am not limited
> to the basic String, Float, Integer, etc.?
You can use any Module class as type for a port.
Thank you for using VisTrails,
Polytechnic School of Engineering, New York University
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vistrails-users