Sparkette Posted January 28, 2022 Report Share Posted January 28, 2022 (edited) Yes, LabVIEW has operator overloading, or at least a form of it. It's what the matrix typedefs use to override various math operators, where it replaces them with a subVI. Operator overloading, as far as I can tell, is undocumented, and not used anywhere outside the matrix typedefs. It's configured using a "NI.LV.All.OperatorInfo1" tag on the control VI, set using the private method "Tag.Set Tag". I've attached a VI I was using to mess around with; it's supposed to create a string typedef which, when wired to a Multiply node, will replace said node with a Three-Button Dialog subVI, but it seems I haven't gotten it to work yet. I haven't really investigated that much, and I'm sure I can figure out what the issue is, but I thought I'd share my VI anyway. In addition to creating that VI, it also loads the NI.LV.All.OperatorInfo1 tag from the RealMatrix typedef as a working example. It's worth pointing out, for anyone else who feels like experimenting, that there's a "Debug Operator Overloading" toggle in the Ned options, as well as an "Available Implementers" section in Heap Peek which seems to be related. Operator Overloading Test.vi Edited January 28, 2022 by flarn2006 Quote Link to comment
Taylorh140 Posted January 28, 2022 Report Share Posted January 28, 2022 So now i can just add my string instead of concatenating them! but joking aside, I feel like this should be an inherited property of LVobject. 19 hours ago, flarn2006 said: I've attached a VI I was using to mess around with; it's supposed to create a string typedef which, when wired to a Multiply node, will replace said node with a Three-Button Dialog subVI It's interesting if that is the way it works. usually for multiplies you would take the operation depending on the binary operator inputs types. e.g. if you add u8 and a single float something would have to make a decision that upcasting to a single float is the right decision. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.