02-18-2009 12:33 PM
I have a situation where I need to duplicate some code in sibling
methods. Ideally, I would put this code inside the parent class, but
for performance reasons (I don't want to use variants) and a limitation
in LabVIEW's edit-time type adaption/propagation, the code must in the
child class.
This means that every time I want to change the
implementation of my code, I have to duplicate the code in the sibling
methods. What I'm looking for is an easy way to copy a method into a
sibling. Now, I can sort of do this with a "Save a Copy As" operation,
but then I have to manually relink the copy to the sibling classes data
types (such as the object/class-private-data, etc.).
Has anyone
solved this problem? I'm tempted to try to automate this using either
scripting or by modifying the linker info on disk, as described below:
Copy
"ClassA.lvclass:Method.vi" (<MyProject>/ClassA/Method.vi) to
"ClassB.lvclass:Method.vi" (<MyProject>/ClassB/Method.vi) on
disk. Modify the linker info of "ClassB.lvclass:Method.vi"
(<MyProject>/ClassB/Method.vi) on disk, such that every instance
of "ClassA.lvclass" in the linker info is replaced by "ClassB.lvclass".
I've got to do this periodically for about 30 sibling classes, so it's starting to make sense to automate this task.
02-18-2009 01:07 PM
02-18-2009 01:30 PM
You're probably right, although I'd like to avoid having 60 classes vs. the 30 sibling classes that I have now, due to the general pains of working with classes. As such, having an easy way to copy a method to a sibling is ideal.
02-18-2009 01:51 PM