09-30-2008 08:21 AM
It is possible to change the strings to variants thus allowing enum types.
I modified the basic functions to test it out and it does work. I have attached a sample demonstrating the actions. The only addition was the variant to data to wire the variant element to the case structure.
When I get some free time I will finish converting the Polymorphic VIs to variants.
10-02-2008 01:30 AM - edited 10-02-2008 01:34 AM
Christian L wrote:
A tool to copy and rename the wrapper, as tst' suggested, is what is needed.
The easiest way to do this is to create the wrappers once and to build a VI which will have an array of static references to the wrappers and the typedef. After asking the user for a target folder and a namespace, you can simply call the Save method on all the VIs. Just be sure NOT to use the Save a Copy option and to save them in order, because after changing the typedef, all its callers are updated. Also, if you use static refs, the caller will probably want to be saved to, so you need to account for that somehow.
Another nice addition, which brings this closer to LVOOP, is the ability to carry additional data with the command. You can do this by separating the enum and the variant and you can see examples here and here:
If you use one of the subVI as a template, then you can create something like this:
You can add the enum to the variant to create a cluster, and because this is a subVI for creating a specific variant, it can have the enum as a constant and can do whatever validation code is required on the inputs.
P.S. As Ben mentioned, wrappers around core VIs will hurt performance, so you can just add the core VIs to the duplicating process. Of course, that has its own problem and converting the data to a variant already hurts performance, so its probably not the best option for utility VIs which you distribute to many people.