Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Is Child VI helps when filtering objects by their type

Hejka Guys, I wrote a small VI that helps me a lot with actor architectures. Maybe you can benefit from it. Enjoy!

asd.PNG

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
Message 1 of 15
(3,868 Views)

Before anyone asks where is this useful -> forwarding messages by type. 

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 2 of 15
(3,842 Views)

I had a similar idea years ago, but I never went with it.

0 Kudos
Message 3 of 15
(3,837 Views)

Why not? What prevented you? Is this example useful?

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 4 of 15
(3,833 Views)

Back then was early in the development of “Messenger Library”.   As I used it though, I found I was happy with using string identifiers for messages, rather than Command-Pattern Objects (where this idea would be useful).  In the AF, this seems a good idea.

0 Kudos
Message 5 of 15
(3,831 Views)

You do type testing on messages often enough to want a subVI for it? It's unfortunately part of the Do.vi for Actors, but it's something I eviscerate from my code wherever possible, and it is almost always possible. I think I've got a few scripting VIs where I've got some type testing on control refnums, but that's about it.

 

If you do type testing frequently, I can see the value. I'm just surprised that it crops up that frequently.

0 Kudos
Message 6 of 15
(3,798 Views)

It would be very nice to have type handling structure, an analog of case structure, that would cast to appropriate type and execute the code inside a single case. It would always select the class type that is closest in the inheritance hierarchy to the wired object. This structure could be used to create very robust and sleek dynamic typing without the need to having everything in one inheritance tree with a Handle.vi method for every class.

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 7 of 15
(3,794 Views)

@PrimaryKey wrote:

It would be very nice to have type handling structure, an analog of case structure, that would cast to appropriate type and execute the code inside a single case. It would always select the class type that is closest in the inheritance hierarchy to the wired object. This structure could be used to create very robust and sleek dynamic typing without the need to having everything in one inheritance tree with a Handle.vi method for every class.


It would.  Kudos here.

0 Kudos
Message 8 of 15
(3,790 Views)

If you can find me such a monstrous construct in any other professional programming language, I'm happy to take a look at use cases, but such a structure would be pretty much anathema to any good OO design. I realize LabVIEW is lacking interface types. Clamor for those, not for performance-heavy-hard-to-maintain type testing. You might as well go back to an enum and a variant -- you'll probably have better performance. Yes, I'm serious.

0 Kudos
Message 9 of 15
(3,721 Views)

I will heed your advice -  Give us interfaces! 😄

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 10 of 15
(3,715 Views)