LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LVOOP coercion dots

Hello,

 

is a coercion dot, when working with different classes with same parent an issue? Is there any way how to remove it ?

 

Snippy.png

0 Kudos
Message 1 of 5
(3,269 Views)

What the coercion dot is telling you is that the data type of the queue is class A and the data type of the the LogElement out control is class B, which inherits from A. You could remove it by upcasting the wire to class A, but there's no real point to it, as you will only be doing the same work that LV is doing and this makes the structure of the code clearer.

 

The code will work. It will pass whichever element you put through it and it will require all of those elements to be either B or another class which inherits from B.

 

On the dequeue side, any element you dequeue will have a wire of type A. The actual class on the wire might be of type B, but that's not a problem unless you want to statically call VIs from class B, in which case you will need to cast the wire to type B.


___________________
Try to take over the world!
Message 2 of 5
(3,256 Views)

Thank you,

 

I was concerned over the execution speed. I will try some benchmarking...

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

I wouldn't bother benchmarking that. There should be no effect on the execution speed, as there's no actual conversion taking place and no creation of a new object. It's simply changing the type of the wire, but the object is still the exact same object.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(3,246 Views)

Hi Bublina,

there is no problem with coercion dot when you connect miscellaneous classes with same parent. In this case, the interface will be the same (it comes with the parent and inheritance) and coercion dot means only that there is different class connected. You cannot remove the coercion dot, but no speed issue will be there.

The code you provided is OK, there is nothing to worry about.

Martin

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