Showing results for 
Search instead for 
Did you mean: 

Is Polymorphic Resource Handle Possible?

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. PolyResourceFrontPanel.pngPolyResourceBlockDiagram.png




0 Kudos
Message 1 of 4

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.

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 4

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.

Message 3 of 4

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.

Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 4