LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bubbling a message upwards in Actor Framework

Hi all!

 

I'm new to Labview and I have a bit of a principal design question not related to any specific problem. I hope it's okay to ask such questions here. I am trying to dig into the Actor Framework and the Actor based approach to design a larger application (although it is currently only for educational purposes).

 

I have generated a set of Actors nested five levels deep. The front panel of the root Actor has some SubPanel to include some GUI elements of the nested actors. The actors comprising these GUI elements are the deepest in the Actor tree. Thus, when an actor of the deepest level has been created, I send a message containing the VI reference to the Calling Actor up to the root Actor, using an Abstract Message and so on. Due to the depth, this is quite annoying and I have to duplicate the same code (for receiving a Message and sending it to the Caller) various times.

 

In the text based languages I am used to, I would create a class based on Actor which provides something like a 'bubbleToCaller' methods. I would derive every nested Actor from this class, and instead of writing a special Method that gets executed for every Actor (which just bubbles the Message upwards), I would use the Method of the parent Class.

 

I thought about the following procedure: Every Nested Actor still has its own Abstract Message, but in the `Actor Core.vi`, I use the `Write <Message Name>.vi` to either use the `bubbleToCaller` method or any other method, if the Actor can process the Message.

 

Is this a conceivable way to go? I know that answering such questions without a specific example is hard, but before I start to try to implement this, I'd like to know if this strategy can be successful. Furthermore, for me it sounds like a quite common problem, it might have been already solved.

 

It is also very likely that my approach with the quite deeply nested Actors sending messages up the whole tree is a bad design. I also tried to make the root Actor contain all the GUI items, but in that case I had to pass a lot of references to the GUI elements to some of the nested Actors to enable them to interact with the GUI elements.

 

Do you have any hints, tips, suggestions or links to documents that might help me? As I said, in (most of the) text-based languages I know, this attempt would be quite straight-forward to be implemented. However, I currently use Labview's Actor framework Scripting Capabilities and I am not sure if I could implement my idea.

0 Kudos
Message 1 of 3
(2,536 Views)

If I've understood your problem correctly (not guaranteed) then you might find something useful looking at overriding "Receive Message.vi".

 

Each of your nested actors (and you could inherit from a class that provides this, if placing each of your actors within an inheritance hierarchy is feasible) could override this VI and test if the received message is your "bubbleUp" message. If so, just send it again to the receiving actor's caller enqueuer.

 

Does that sound like what you need?

 

For examples of Receive Message overrides, you can look at the Network Endpoint Actors. Although these do something a bit different to what you want, they do provide an example that might be helpful.


GCentral
Message 2 of 3
(2,442 Views)

 


@cbutcher wrote:

If I've understood your problem correctly (not guaranteed) then you might find something useful looking at overriding "Receive Message.vi".

 

This seems to be place where I can step in, yes. I will dig into this.

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