LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I track down where a specific enum is used in a case statement selector?

Solved!
Go to solution

Hi all,

 

I've got a fairly complex state machine simulation application that I'm adding a "mode" functionality to. At certain states in the application, instead of the default blocks of code being run, a VI belonging to a class of VI's for each mode will be run instead (eg for modes A and B, the initialization state now has Initialization_modeA and Inilitalization_modeB). This results in lots of case structures everywhere, and I'm having trouble figuring out how to make sure that when adding a new mode, I add that mode's case to every case selector. Is it as simple as having a default case with a popup box? Or is there some OOP way I can handle this?

0 Kudos
Message 1 of 3
(2,851 Views)
Solution
Accepted by topic author ijustlovemath

Just going on what you have told us, you could potentially have each mode inherit from a common ancestor which defines a set of common states (or methods in this case). Each time you want to add a new mode you can create a new class and just override each method with what that specific class needs to do. Instead of having an init state for each mode you would then only need one common init state which would then call the correct init code based on what class you are using.

Matt J | National Instruments | CLA
Message 2 of 3
(2,820 Views)

I figured there was a nicer way to handle this. Thanks, I'll look into it.

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