Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Why Swap the Nested Actors in Stop Core.vi?

Solved!
Go to solution

Hello AF community,

looking at the Stop Core.vi in Actor.lvclass, I wonder why the Swap Values function is used on the array of Nested Actors? Why not directly wire the unbundled wire and the empty array to the For Loop and bundling function, respectively?

Best regards,

Mat

0 Kudos
Message 1 of 6
(5,620 Views)

Mat,

just guessing... I still haven't upgraded

When swapping the array you make sure that the nested Actors are stopped in the opposite order as they have been launched... so last launched is being sent Stop first.

0 Kudos
Message 2 of 6
(4,434 Views)
Solution
Accepted by topic author Matjö

Oli: No. Swap Values does not affect the values inside the array.

Mat: It is my style. To me, it makes it clearer what my intent is. I'm taking the array away from the object that is carrying it and replacing it with an empty array. There are times when Swap Values provides a clear signal to the LabVIEW compiler of the programmer's intent that lets it do better optimization -- I am pretty sure this is NOT one of those cases. This is just me coding in a way that documents the model that is in my head.

0 Kudos
Message 3 of 6
(4,434 Views)

Thank you, that makes sense to me now.

Can the presence of the Swap Values fonction actually degrade the compiler's efficiency?

Best regards,

Mat

0 Kudos
Message 4 of 6
(4,434 Views)

AristosQueue schrieb:

Oli: No. Swap Values does not affect the values inside the array.

Sorry, mixed something up there

0 Kudos
Message 5 of 6
(4,434 Views)

Matjö wrote:

Can the presence of the Swap Values fonction actually degrade the compiler's efficiency?

Only if there's a bug in the compiler, but then, that's true of any bit of code. 🙂 Assuming we have our compiler code right, expressing a swap operation using a Swap Values should always improve the efficiency or leave it unchanged.

0 Kudos
Message 6 of 6
(4,434 Views)