GDS(Goop Development Suite)

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice to implement GOOP4 "Named Object" and to destroy the Single Element Queue (SEQ) associated with it

Hi all, 

Here, I design a class named "Signal" by GOOP4, and it is the base class of all kinds of "Signals". Each "Signal" object instantiated from the "Signal" class has a Unique name. I want to implement a static method " GetSignalRefByName(<name>) " to check whether a signal object has been created and to get the reference of a signal object by name string globally. 

I find that assigning the unique name to the input control " Object name " of " Signal_New.vi " seems to work. In this way, all the signal objects become "Named" objects and the static method " GetSignalRefByName(<name>) " can be achieved by wrapping the method " Signal_New.vi " method properly. 

 

But, my questions are:
1.

How to destroy the SEQ associated with a signal object inside the method " Destroy.vi " elegantly. The naming rule of named SEQ to store the DVR reference of the signal object is quite cumbersome, especially when the object has deep inheritance. 

 

My idea is adding an immutable field named "sEQNameStrg" to "Cluster of class private data", assigning the SEQ name to the field inside " ClassName_New.vi ". In this way, the SEQ names can be used in " Destroy.vi " to destroy the SEQs all the way from a child class to its parent class. 

 

But, in this way, I have to modify the " ClassName_New.vi " for all classes in the inheritance tree from the "Signal" class. Is there better way to achieve? 

 

2. 

In my project, there are hundreds of signals. So I am afraid that memory and performance overheads will slow down my program. Any comment about my concern? 

 

Thanks for your kind help

 

Godel Sung

0 Kudos
Message 1 of 2
(495 Views)

I would use a Class Attribute, and that would be a MAP with Single Name as the key and the Object Ref as data for the MAP.
You can add Class Attribute using the Design pattern function or just use a private Global variable with the MAP content and lock the access to this global variable when you write to it.

0 Kudos
Message 2 of 2
(481 Views)