LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a queue as a local variable or reference

Solved!
Go to solution

@granum wrote:

Wiebe: I don't want that wire going from the obtain queue vi into the while loop. I the actual code I am developing (not this simple example), I have 7 queues, 4 clusters, and a bunch of other stuff what I used to wire into my while loop and keep it updated via a shift register. It just became too many wires, so I am replacing them with local variable and FGVs 


If you cluster the queues it's one wire. Or a class would make it one wire.

 

Locals and globals are patches. You'll save time now, but loose a lot of time when things get more complex. Of course some mastered the use of them. I avoid them although I did use them in the past.

 

A class isn't that much extra work. I'd put all the queues in the private data, make an init to obtain all queues, and one VI to get a specific queue. That way, you have an easy way to find where each queue is used (Find All Instances).

 

A fancier solution is to not expose the queues, but wrap the enqueue\dequeue. That will give even more insight in where functionality is used.

 

Haven't used a cluster in years. A class is much more convenient, as everything you want to do with the cluster fits nicely in the class. This almost automatically keeps the code organized.

 

Guess channel wires should be mentioned. Although there have been problems with them on RT.

0 Kudos
Message 11 of 12
(294 Views)

@granum wrote:

In the actual code I am developing (not this simple example), I have 7 queues, 4 clusters, and a bunch of other stuff what I used to wire into my while loop and keep it updated via a shift register. It just became too many wires, so I am replacing them with local variable and FGVs 


Personally, I have each of my Queued Message Handlers in their own library.  In their library, I have a private Action Engine to maintain the queue with actions to "Get Reference", "Send", and "Close".  Again, this AE is private so only the QMH can access it.  I also have public VIs for other processes to send messages to the QMH.  So your main loop only has to worry about launching the QMH (I typically have a Lauch VI in the library to do this) and using the API for sending commands to it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 12
(279 Views)