This example shows one way to use abstract messages to implement low coupling communication between actors. The code is written in LV 2013.
Anybody has it in old version ??? LabVIEW 2012
Thank You.
Hi, You can download it from from here. Good luck!
Hi,
Is there some documentation available? I don't understand how process 1 knows to call the Do of the child of Get Current Time Msg and not of the parent.
Thanks for uploading!
Thank you 😉
dsavir wrote:
Is there some documentation available? I don't understand how process 1 knows to call the Do of the child of Get Current Time Msg and not of the parent.
Thanks for uploading!
Works the same as any other dynamic dispatch call -- LabVIEW invokes the method for whatever object is on the wire at run time. If the object on the wire is Get Current Time Msg then that's the method that will be invoked. If the object on the wire is the parent class then the parent class' version will be invoked. Nothing magical here.
But the process that sends the message sends the abstract parent message, doesn't it? it's the process that accepts the message that knows about the child at all. Otherwise, how is this abstract? I think I missed a step somewhere
dsavir wrote:
But the process that sends the message sends the abstract parent message, doesn't it? it's the process that accepts the message that knows about the child at all. Otherwise, how is this abstract? I think I missed a step somewhere
No. The process that sends the message sends the concrete message, even though all it knows about is the abstract parent. Here's the details:
You have Sender and Receiver.
Receiver has to tell Sender "send me this concrete message". If Receiver is also Caller, then it may put its concrete into Sender when launching Sender. Otherwise, Receiver may send a message to Sender telling Sender, "Here is the messsage I want you to send." Receiver stores the message in its private data IN A FIELD OF TYPE ABSTRACT PARENT. Then when Sender is ready to send the message, it uses the version in its private data. So the only TYPE that the Sender is ever working with is abstract parent, but the OBJECT on the wire at run time is the concrete child.
OK, now I got it Thanks AQ!