03-20-2016 03:34 PM - edited 03-20-2016 03:35 PM
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?
Solved! Go to Solution.
03-20-2016 04:21 PM
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.
03-20-2016 04:22 PM
I figured there was a nicer way to handle this. Thanks, I'll look into it.