07-02-2012 02:36 PM
I have a case structure with multiple string cases. Would it be possible to use the info from the case structure to make an enum? Is there a script out there that can do that? When I am making a state machine, I like to develop my states first and my my enum later. It is hard for me to make an enum with all the cases first. What's your preference?
07-02-2012 02:51 PM
Did you try a search?
Dr. Damien's Development - Creating an Enum from a Text Case Structure
I don't understand your statement: "It is hard for me to make an enum with all the cases first". You may not know all the states ahead of time, but I don't understand where the difficulty is. Is it because you are not making the enum a typedef? By making it a typedef you can add/remove states and make sure the case structure stays consistent.
07-02-2012 02:55 PM
Sorry, I didn't mean to use the word difficult. I do use type-def already, but I just find it troublesome to modify the enum multiple of times. I only want to update it one time.
07-02-2012 03:11 PM
You should know a large percentage of the cases you need in a state machine before you even start coding. Therefore the enum should not be changing all that much. Even so, the enum editor is not that bad.
07-02-2012 03:12 PM
@jyang72211 wrote:
Sorry, I didn't mean to use the word difficult. I do use type-def already, but I just find it troublesome to modify the enum multiple of times. I only want to update it one time.
That sounds like you never will modify the software. In my experience that is just wishful thinking. As soon as the application works you or whoever is using your application will come up with new requirements to include.
07-02-2012 04:24 PM
Now if only there was a tool that would let you define the states and the transitions and then create the code for you. It would be so simple to add, remove and edit transitions. Nah, that is just crazy talk....
07-02-2012 06:33 PM
@Darin.K wrote:
Now if only there was a tool that would let you define the states and the transitions and then create the code for you. It would be so simple to add, remove and edit transitions. Nah, that is just crazy talk....
07-03-2012 08:36 AM
haha. I meant one time during the first development.
07-03-2012 08:39 AM
At one point, there is a state editor that comes with labview? I always thought that there is only the separate module. It will so convenient if they bring the editer back.
07-03-2012 08:49 AM
@jyang72211 wrote:
haha. I meant one time during the first development.
I do not have an answer to your posted question but I have to ask out of concern.
Are you writing code before you know what the design will be?
In my minds eye writing code without a design is like starting a journey without knowing where you are going. Sure it may be a fun adventure but I would be suprised if it result in an efficent path to a solution.
Concerned,
Ben