LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue in object oriented programming

Solved!
Go to solution

Hi,

 

i am trying to build several classes for different data aquisition devices. What they have all in common is that they use a 3D-Array of Integer as data buffer. I want to be able to switch between the devices, so I decided to create a VI called "Record.vi" and use dynamic dispatching to decide which device to call at runtime.

But I don't want a separate data aquisition buffer for every device, so I am trying to figure out how to create a more "global" space to save my data. I now decided to use a queue for this (as I don't want labview to make copies of my 3D-array all the time). My question is now how queues are really handled in object oriented programming, because in non-object oriented programming, if i create a Queue and name it, let's say, "data" and create the same queue somewhere else (again with "data" as name), i get access to the first created queue, and don't get a new one. If I now create, for my problem, a parent class where all data devices inherit from and make a member variable "queue to 3d-Array", what will happen? All data devices that inherit from this class will call the same queue? Or is it duplicated? Whats the best way to use a common storage place in all data devices? A global variable in the parent class (i. e. a static variable)? Or should i create a "normal", by all Vis accessible global variable?

 

Thanks for the help!

 

Christian 


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 1 of 4
(3,379 Views)
Solution
Accepted by topic author cschneider

If you don't want the child to use the parents buffer then create an over-ride for the child that creates its own buffer.

 

For named queues the over-ride VI could use it's name as part of the queue name.

 

For non-named queues, just pass the reference.

 

Notes:

DVR (Data Value reference) is also another way to share a buffer.

 

3-d arrays:

Unless all thre dimensions have meaning I generally avoid them because they at the rate of N cubed where "N" is the largest of the smallest dimensions (or something like that) so just one slice of the buffer becoming large (due to processing backlogs) the whole thing explodes (Voice of experience speaking).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 4
(3,368 Views)

Hi Ben

 

thanks for your reply. I want the childs to share parents buffer...i am a bit confused, because normally, in object oriented programming, i have to instantiate a class - this is something labview does by its own. So all member variables are created, as well as the queue. This means I will share this queue along all child classes? In "normal" c++, if I create a member variable which is a pointer (which is I think similiar to a queue), this pointer isn't shared if i create the object of this class...

 

I still have to look up DVR, because I don't know it so far...

 

Christian 


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 3 of 4
(3,356 Views)

DVRs are not available in LV 8.5.

 

See this thread, see the examples posted by Rogerl (both zips ! )

 

He uses queues to share data.

 

Also chase down those links posted by Arostos Queue since they try to address the questions you are now asking.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(3,352 Views)