LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Poly input

Is there a way to create a SubVI with a real poly input? I mean an input wire that takes anything, like the one in Flatten to String, without losing information what "anything" is - it may be a custom cluster that sub knows nothing about. What I would want is to serialize this cluster for data transmission in little-endian order using Flatten to string, but I want to flatten the raw data, it cannot be encapsulated into a variant (I suppose that "Variant" carries some additional meta-data - I still have to check this).

I hope I have correctly describe what I want to do - I have a feeling this sort of thing is very hard in LabVIEW.

Thanks in advance, Mike

0 Kudos
Message 1 of 4
(3,161 Views)

Yes, you can make polymorphic VIs.

 

Normally you would do this as outlined here.  Basically you create a polymorphic VI and then implement a "subVI" (its not really a subVI rather a cub-component of the polymorphic VI) which handles each specific data type.  This will give you the functionality that you have described.

 

Another way to do this is to impliment the polymorphism into labview objects (Classes) which will switch functionality based on data type.  This is a very powerful concept but is also overkill for many of the polymorphic VIs you would like to impliment. 

 

Do you have a specific example you are looking to impliment?

0 Kudos
Message 2 of 4
(3,132 Views)

Cross post on LAVA and another place.

 

http://lavag.org/topic/13407-poly-input/

 

Miha please keep posting only at one location. 

 

Thank you,

 

Jiri Keprt

NI EE Czech Republic

CLA, CTA

0 Kudos
Message 3 of 4
(3,120 Views)

@Faraclas wrote:

Yes, you can make polymorphic VIs.

...
Do you have a specific example you are looking to impliment?

Thank you. I am aware of the polymorphic VIs, but their limitation is, that the input type has to be known up front. I am looking for a way to get something similar to the real "poly input" that is only limited to LabView native VIs. I want to implement a function that can serialize any input in "little-endian" form an then send it over the wire. My goal is to have serialization "hidden" from the user. One idea is to have the Variant input, but the data sent would have to be "raw" (without the encapsulating variant). But the challange is, how to "unvariant" without knowing what is inside.

On Lavag someone suggested the VariantType library (I've somewhat forgotten about that), but it suggested that it is slow. I think it might work for me, but another challange after that is, how to put the "raw" data I receive into a variant without knowing what is inside. The data will be serialized in little-endian format, so "Variant to Data" would not strip it in the correct byte order.

 

I have an idea, but I would have to test it first...

 

Br, Mike

 

 

0 Kudos
Message 4 of 4
(3,114 Views)