LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can an input be used to determine output of a polymorphic VI?

Solved!
Go to solution

Hi All,

 

I am communicating between a producer/consumer loop using a queue. The queue'd element is a cluster made up of a type-def enum and a variant. Data-type in the variant will depend on the state of the enum.

 

I would like to use a subVI to convert the variant back to the original data-type. The first option that occurs is a simple subVI with an output for each data-type and wire only the relevent output. The second option that occurs would be a polymorphic VI where the user selects the relevant state.

 

What I would like to do is wire the inside terminal of my case-structure to my SubVI and have it dynamically change (before run-time) to the appropriate output-type. This would be similar to the existing 'auto' function on polymorphic VIs. Can anyone tell me if this is possible?

 

Regards and thanks,

Delta

0 Kudos
Message 1 of 5
(3,625 Views)
Solution
Accepted by topic author DeltaJ

Yes it's possible with LVOOP, the first thing I thought when looking at one of the first examples of LVOOP was 'Runtime Polymoprhism'.

 

What you do is create a class 'DataTypes' , with a method 'Read'

Then a class 'DataType1'  which inherits from 'DataTypes'.

 

You create a queue of type 'DataTypes', and you sent in an object of type 'DataType1', in your dequeu system you use the 'DataTypes.Read' method, LabVIEW will select the proper handler of a child class to deal with the data.

 

There should be an example (can't check right now) that shows that for 'bacteria'  testing or something like that.

 

Ton

 

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 5
(3,612 Views)

Hi Ton,

 

Looks like exactly what I need - many thanks. Its also going to be a good excuse to start working with OOPSmiley Wink

 

If you get a chance could you post a link to the example or maybe a copy of the code.....I've searched but I can't find the bacteria example you mention anywhere.

 

Thanks,

Delta

0 Kudos
Message 3 of 5
(3,581 Views)

I can't find it neither, but the LabVIEW examples have 'dynamic dispatch' example that shows the idea.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 5
(3,570 Views)

Thanks Ton - it looks likes something I can definately use!

 

Regards and thanks,

 

Delta

0 Kudos
Message 5 of 5
(3,542 Views)