Whilst pondering Chris Relf's presentation on LVOOP based error handling for NI Week, it occured to me that it would be really nice if it was possible to define LVOOP methods that would be called automatically when LabVIEW needed to convert a class to a different (eg built in) type.
For example, imagine I have a class for handling errors - the obvious thing to do is to wire that class wire into a case structure selector and provide cases for error/no error. Of course that won't work, but if I could define a method that takes my class in and outputs an error cluster and was somehow appropriately marked so that LV would automatically call it, then the case structure could automatically do 'the right thing'.
The inverse functions that build a class from another type would be a form of constructor for the class that might be useful - e.g. I have a class that represents a measurement, wiring a path control into the class terminal causes LabVIEW to run a method that I have defined and appropriately marked that loads the measurement from disc and initialises the class.
There are a few problems I can immediately see - if one defines two possible conversion methods (e.g. class to error cluster and class to enum) one needs to have a way of defining which one is used (right click on terminal of node would seem the most obvious to me) and you'd probably want a specially covered coercion node as well....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.