Setting input of Process to Float, but it should be also possible to connect another data type

So here is what I would like to do, in an abstract description.

I have a FooProcess, that has an input (set to a float) and one output (set to a FooClass type that is also specified in the document). I can expose the input pin and set it to a value, or rightclick on the pin without an IOBox to set the value.

grafik

This is the FooProcess with both types set on the input and output, nothing fancy.

grafik

But I want to be able to also also send in the FooClass output of another FooProcess instead of the float, like this (without the red link, which of course says here that FooClass is no Float32):

grafik

I could set the FooProcess to generic and remove the type annotation for the process, which allows me to connect the output.

grafik

But now I again have to expose the input and set it to a float manually. So what would be nice to implement something that the input type is by default a Float, but could also be a FooClass and does two separate things for each connection. Am I approaching the topic of interfaces again? If so (also if not so), could anybody help me out here with an explanation please?

Here is also the patch from the screenshots:
FooProcess.vl (7.7 KB)

TypeSwitch

(but it sounds weird to switch between basic Float32 and a potential more complex FooClass)

FooProcess.vl (12.1 KB)

1 Like

You need to pass and consume this, if you want to make it that kind of generic, you have to use some type casting and switch on input pin, like

if (Type of input == Type of this) 

but i would not really recommend doing so.

This is kind of structural inaccuracy FooProcess that accept FooProcess, process should accept args and maybe context

2 Likes

Hm… after your answers I might switch to a system in which FooProcess always takes and returns FooClass and I just have a process that can convert from a Float to a FooClass. Thanks for the hints!