Jump to content

Dynamic dispatch for refnum of class


Recommended Posts

Still not getting you, sorry. You want to wire a queue of classes into a class terminal? Can you post your demo project? Just because the classes might have a hierachy surely that does not imply anything about a queue that may contain these?

You cannot set dynamic dispatch on a queue ref, can you???? (it is not a class itself)

Edited by Neil Pate
Link to comment

Don't think you can do that, I think a queue ref cannot be dynamic dispatch, even if it contains a class.

I am not sure I really follow what you are trying to do, but could you flip the logic around a bit, and have the queue ref as like the second input terminal, and have a StartRun input as the dynamic dispatch input? So you Enqueu Serial Number class which you have shown would have the StartRun object as the primary DD input?

 

Edited by Neil Pate
Link to comment

I'm not clear how adding another dynamic dispatch input solves my problem. The queue ref is still statically dispatched and will only take a queue of the parent class.

In terms of intent, I'm looking to improve reuse. Rather than writing an enqueue function in each child class, I just want one VI to handle that.

added input.PNG

Link to comment
3 minutes ago, infinitenothing said:

In terms of intent, I'm looking to improve reuse. Rather than writing an enqueue function in each child class, I just want one VI to handle that.

 

So then can the queue contain objects of the base class? Without seeing much more than this tiny bit of the solution it is a bit tricky to visualise a way forward.

Link to comment

There should not be, adapting to type is all you want and thats what vims do. As pointed out, queues are not a runtime-dispatchable type in the same way you cannot dynamic dispatch off a boolean or an array. The contents are irrelevant. 

Its worth noting that vims support dispatching based on method name rather than class hierarchy. There are examples of using vims to make lvclasses act kind of like interfaces (ie if you have two separate hierarchies with a method "Get queue" which returns a thing at connector pane position 3, you can put that in a vim and it will adapt, including if that outputted thing has a different type).

As a side note, you can and should wrap the queue status and index primitives inside of a disable structure.

Edited by smithd
  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.