LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to destroy the dynamically creating objects ?

Hi all,

 

I am developing an application which will create objects at run time.

Based on one input data, it will create object, with that reference it create queue,

Same way, multiple queues will be creating based on the object reference.

 

What’s my problem is maintaining / destroying objects reference.

 

How to achieve these:

 

1. Once the queue is empty, object reference for that queue needs to destroy.

2. And finally, all created objects needs to destroy once I closed my application.

 

I am facing difficulty in maintain all the object references

 

Any of you can come forward and guide me on how to solve this problem.

 

Thanks

 

Ram

Using: Labview 8.5, GOOP 3.0

"Error is Good"

0 Kudos
Message 1 of 3
(3,168 Views)

Hi ramnathrn,

with creating a new reference you can store it in an "action engine" (global functional varaibel). At the end you read your stored references and run, for instance if you have an array of vi references, through a for loop to destroy them.

Mike

0 Kudos
Message 2 of 3
(3,157 Views)

Hi,

Thats a good question which irises soon after you figured out how to create a bunch of objects...:-).

One solution is to use the LV2 style global. Another option is to continue your object oriented thinking.

You have three needs: you need to create all those objects, then you need to store them somewhere, and finally you need some code to execute destroy to clean up. All those responsibilities are naturally handled by adding a class. Let that class store references to the objects, and add methods in this new class to create and destroy objects as needed.

 

Jan

www.endevo.se

0 Kudos
Message 3 of 3
(3,115 Views)