LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get LV Class Parent Name


@drjdpowell wrote:

What's wrong with just making a standard subVI that just calls the DD method?  No need to add this subVI to the parent class; it is naturally belongs to the calling code, not the classes being called.


Sure, that is possible.

 

You'd still need to call that VI dynamically.

0 Kudos
Message 11 of 33
(948 Views)

Ok, then that just loops me back to not understanding what you guys are talking about, as it is clearly way to complex to be an alternative to writing a simple subVI.  

0 Kudos
Message 12 of 33
(934 Views)

@drjdpowell wrote:

Ok, then that just loops me back to not understanding what you guys are talking about, as it is clearly way to complex to be an alternative to writing a simple subVI.  


It's not just writing a VI. You still need to start it dynamically.

 

The hole point is to dynamically start a dynamic dispatch class method. If you write a VI, that takes case of the dynamic dispatching, but you still don't get a clone. That is the goal: to start a method dynamically, to get a clone of the child method that was wired.

 

I think that depends on how often you want to do this. Then of course that raises the question if it's a good idea to do this too often.

 

If you have more then one method, and you want to dynamically call them by their name for instance, or you want to do this for more then one class hierarchy, it might pay of to make a VI that does this.

 

This VI will be more complex than calling a normal VI dynamically, but once you have it, you won't have to do that anymore... Once you have the VI, it's pretty simple to use.

0 Kudos
Message 13 of 33
(928 Views)

wiebe@CARYA wrote:
That is the goal: to start a method dynamically, to get a clone of the child method that was wired.

Ah, is that the goal?  Can't tell that from any of the previous posts.  Is that the OP's goal too?  And what do you want to do with this VI reference?  

 

Edit: I assume by "get a clone" you mean "get a VI reference to a running clone".

0 Kudos
Message 14 of 33
(922 Views)

@drjdpowell wrote:

wiebe@CARYA wrote:
That is the goal: to start a method dynamically, to get a clone of the child method that was wired.

Ah, is that the goal?  Can't tell that from any of the previous posts.  Is that the OP's goal too?  And what do you want to do with this VI reference?  


I'm not 100% sure actually 😁, but that is what I got from this:

 

@LucianM wrote:

 It's not my job when I'm calling that method in LabVIEW but in this case, I'm calling that method from a LabVIEW executable and I am not the developer of the class being loaded so I cannot and don't want to modify it in any way. I just want to be able to call its methods. If the method requested does not exist in the class that is actually loaded, it's my job to find out what parent class has that method implemented and call it.


And this:

 


@LucianM wrote:

 I need it to work in run-time because we have a test sequencer developed in LabVIEW which is able to execute class method VIs but when dynamic dispatch VI is called and the current class does not have an implementation for that method, I needed the parent to check if it has that method implemented and call it.


 

If there's no need for dynamically calling the method, there would be absolutely no point to do this...

 

If there's no dynamic calling, there would be no problem. Since there is a problem, I assumed there is a need for dynamic calling.

 

There is a possibility there is no problem to begin with...

0 Kudos
Message 15 of 33
(911 Views)

@drjdpowell wrote:

wiebe@CARYA wrote:
That is the goal: to start a method dynamically, to get a clone of the child method that was wired.

Ah, is that the goal?  Can't tell that from any of the previous posts.  Is that the OP's goal too?  And what do you want to do with this VI reference?  

 

Edit: I assume by "get a clone" you mean "get a VI reference to a running clone".


Get a clone and run it...

Get a reference, clone it, then run it...

Get a running clone reference...

 

It doesn't really matter.

 

For the problem it doesn't need to be a reentrant VI, but they usually are otherwise the dynamic calling makes less sense.

0 Kudos
Message 16 of 33
(908 Views)

But other than just run it, what are you going to do with the reference?  Otherwise, this just appears to be an overly complicated way to dynamically call a DD method.  The simple, straightforward way of using a subVI seems much better, except for it not providing you with a reference.

0 Kudos
Message 17 of 33
(903 Views)

@drjdpowell wrote:

But other than just run it, what are you going to do with the reference?  Otherwise, this just appears to be an overly complicated way to dynamically call a DD method.  The simple, straightforward way of using a subVI seems much better, except for it not providing you with a reference.


The dynamic VI Server call allows you to start the VIs and continue without waiting for them to finish..

 

A normal DD call would block execution.

 

It is better if you can get away with DD. You often can, but sometimes you just want to start something dynamically.

 

If you have for instance an array of objects, you could use simply start them all dynamically. They could communicate over user events, queues, etc. You can use a for loop set to parallelism, but you'll have to wait for all objects to finish, and make sure ParallelLoop.MaxNumLoopInstances is large enough.

0 Kudos
Message 18 of 33
(895 Views)

wiebe@CARYA wrote:

@drjdpowell wrote:

I, at least, was not able to tell what issue this entire conversation is talking about, so perhaps they indeed just don't know what "proper dynamic calling" is.


The main problem is there are two 'dynamic callings' here, causing confusion. 

 

Sometimes you want to dynamically start (VI Server, Run) a dynamic dispatch VI.

 

A way to do that is to get a reference to the exact VI and invoke the run method. So you need to check if the child implements the method, or call the parent's implementation, recursively.

 

Another solution would be to make a VI in the parent to do make the dynamic dispatch call, and call that VI with VI Server, Run method...


I feel like I'm missing something obvious here.

 

Why wouldn't we just choose to check the box requiring child classes to implement the method?  In that case, we'd KNOW the child class has a method and skip the entire need to determine if there's an implementation and recursively seek out the parent?  In the case there's nothing special, just have the child's method call the parent's method?

0 Kudos
Message 19 of 33
(891 Views)

wiebe@CARYA wrote:

@drjdpowell wrote:

But other than just run it, what are you going to do with the reference?  Otherwise, this just appears to be an overly complicated way to dynamically call a DD method.  The simple, straightforward way of using a subVI seems much better, except for it not providing you with a reference.


The dynamic VI Server call allows you to start the VIs and continue without waiting for them to finish..

 


I didn't ask that.  A dynamic VI Server call on a DD method is easily done with a simple subVI.  Dynamically call the subVI and the subVI calls the DD method.  That is simple.  Why are you doing apparently much more complicated VI Server gymnastics to do the same thing?

0 Kudos
Message 20 of 33
(884 Views)