LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i create a VI that accepts all queue references?

Solved!
Go to solution

Anything can be stuffed in variant.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 11 of 16
(695 Views)

The variant is prefered because it can have attributes (private data that also passes on the varient wire) attrubutes are often used for state cashe information or other useful information about the data.  a common example is attribute.IsInit? as a boolean for talking to an instrument control queue.


"Should be" isn't "Is" -Jay
0 Kudos
Message 12 of 16
(686 Views)

Ben, yes, anything can be stuffed into a variant....but anything can be flattened to a string as well.

 

The only reason is that variants have attributes? Seems reasonable. I guess I'll buy that. 

0 Kudos
Message 13 of 16
(679 Views)

@craige wrote:

Ben, yes, anything can be stuffed into a variant....but anything can be flattened to a string as well.

 

The only reason is that variants have attributes? Seems reasonable. I guess I'll buy that. 


Well, that and the cool purple color!!Smiley Very Happy Flattened strings are sometimes miswired / mishandled because of the wire color.  This is not a problem with varients


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 16
(674 Views)

Also, you don't have to explicitly flatten to string everytime you want to add to the queue.  You can wire your data directly into the variant.

 

It's also easier for debugging, since, in many cases, the variant will show what's stored in it.  You'd have to be Neo to look at a flattened string and decipher the thing.

0 Kudos
Message 15 of 16
(670 Views)

And one more -

 

variants (as far as I know) aren't flat, meaning that the data contained in a variant can have pointers in it and be in multiple locations in RAM.

A flattened string is, by definition, flat, which means that if the original data isn't flat it needs to be flattened which can cost you some RAM and CPU cycles. I suppose a variant could (at least theoretically) get by without creating a copy if it can simply point to the original data, but that's just a guess.


___________________
Try to take over the world!
0 Kudos
Message 16 of 16
(661 Views)