11-08-2021 09:58 AM
Is there a way to create a polymorphic resource handle in a data structure? I was planning to do a lookup on the Pin to grab the correct resource handle.
11-08-2021 10:30 AM
I suppose it can be done, but do you mind letting us know what the advantage to having an output of specific resource types gives you over just converting strings as needed? Maybe there's a simpler way to do this.
11-08-2021 10:38 AM
No, a cluster cannot have a polymorphic element in it. You could wrap things in a class structure and have your structure hold the parent class, writing a child class to it. Or, you could simply use flattened strings and have the "resource user" unflatten them.
You'd probably want a "key" of some kind. An enum or string would be fine. For example, the enum could be "VISA", "DC Power", etc. Later when you go to parse the resource string, you'd use the enum to determine which type it is so you could un-parse it correctly.
Then again, lots of systems can basically use strings already and will auto-coerce them. VISA is that way, for example. I haven't used NI DCPower though.
11-08-2021 12:11 PM
Use variant to store the sessions and convert them back to actual type when required.
I believe you're trying to implement the PinMap feature of TSM.