Jump to content

Aristos Queue

Members
  • Posts

    3,183
  • Joined

  • Last visited

  • Days Won

    204

Posts posted by Aristos Queue

  1. With the advent of DVR in 2009 it became necessary for terminals with typed references, that have objects as their data type, to permit the full hierarcy of decendants to be allowed to enter that terminal. But luckily, because it was required for DVR, every other type reference came along for the ride.

    So whereas pre 09, you could not have an input terminal to a VI be a QRef with a parent class as its data and wire in a QRef w/ a descendant class as its data, you now can in 2009.

    OH NO. This is VERY BAD. That's going to have to be fixed in LV2010. That's a severe bug and I had no idea it existed until today. The ONLY reference on which it is safe -- and by safe I mean "won't cause a crash" -- is the DVRs. Take a look:

    post-5877-126391068144_thumb.png

  2. Hello,

    I have been using LabVIEW for nearly 10 years but I have to admit I am a little stuck.

    I have to use several VC++ DLLs from LabVIEW 2009.

    I have no choice than using those DLLs as the code is very large and there is no time to revert back to LabVIEW only.

    I have found a good article about calling C++ using a C wrapper at http://labviewwiki.o.../shared_library

    I was wondering if someone had done something where instead of calling a double it would be an object.

    Any help would be welcome.

    Many Thanks,

    Christophe

    The only DLL calls I've had to make to C++ all involved a C interface where I just needed to pass the pointer to the class (which LV can easily hold onto in a uInt32 or a uInt64 as long as LV isn't expected to access the data of the object directly). I'm sure there is a solution if the interface is actually a C++ exported function, but I don't know what it is. This may be a question better posted on NI.com/forums pages. The AEs there get questions about DLL calls all the time and may have a ready answer for you. No promises, but I'd suggest trying it.

  3. These are the only ideas I can think of...

    a) Try upcasting your objects to LabVIEW Object. That loses your type safety but it might be acceptable in some cases.

    b) You can wrap them in a variant and carry around an array of variants

    c) The Event Registration node creates a composite event registration wire out of multiple events. Can you use that? (It's more like bundling with a cluster than building an array, so probably not much use to you.)

    post-5877-126351917644_thumb.png

    For the record, no one has ever asked for this before and I've never thought to try this. Anyone see a reason why the polymorphism couldn't be added?

    • Like 1
  4. Just a thought... but could there be any possiblility to allow "special VIs" for classes kind of like "Ability" VIs for XControls. That way, a developer could specify how a class should behave when it gets serialized, etc?

    Yeah... I've got a whole set of specs for this, including VIs that would define the class's behavior when wired to the ? terminal of a case structure, defining coercion dots for classes to non-class types, etc. I wanted those back in 8.2, but other things keep getting in the way. There is some limited work being done in this area today that you should see either 2010 or 2011.
  5. How do other OO languages handle persisting objects to disk?
    JAVA has a built-in serialization mechanism that can be privitized if desired. C# has a built-in "to string" but not a "from string". C++ does not have a built-in to or from string. I find that the C# system is the most common among other languages.

    Just out of curiosity, was there ever consideration given to the primitive having a context-menu option to offer access to either behavior?

    No. That would defeat the entire purpose. It has to be a class-level decision, in the hands of whoever is deciding how much security this particular class needs to have.
  6. There's always the option to draw the instance icon instead of the poly icon. If the icons are good enough to distinguish between the different instances then there's no problem, even if they have the same type inputs.
    Kind of... without the selector being visible, there's no way to select the alternate functionality, so it might as well not exist. And without the selector, I think it is reasonable for any user of the the poly VI node to assume that all the functionality is available just by wiring inputs. Drawing the instance doesn't really help with those usability issues.
  7. In newer versions, you can also just use a feedback node without a loop.
    Yeah. I don't like that at all. I know it works, but visually, it tends to be a problem for me. For one thing, the location of that feedback node floats around just like the stop terminal. For another thing, I still get twitchy about that one wire running backwards on the diagram.
  8. I asked around. Here's the best answer I got:

    Inlining with the token in LV 2009 can't handle front-panel terminals inside structures, locals variables, property nodes, invoke nodes, or control references.

    I'll bet it is the FPTerms inside a structure node that is your problem as that would be the least obvious of items on this list.

  9. For example, sometimes I like to have a poly parent that has children that are selectable based on the required functionality, not actual polymorphism (the inputs and outputs might be the same between the children).
    Crelf & Daklu: You do realize that this is possible in LV today, right? And has been around since at least LV 6.0? The DAQ VIs are rife with this usage.

    Create a PolyVI... On the configuration page for that PolyVI, there's a checkbox for "Show Selector by Default". This makes the poly VI instance selection ring appear under the node when you drop it. Then when users wire up to the node, they can select from the ring which bit of functionality they'd like to use. It's almost like having an action engine where the action is required to be a constant directly wired to the node. When I first learned about polyVIs, I filed a bug report that the poly VI wasn't broken even if two member VIs had the same inputs. Someone pointed this checkbox out to me, and I thought, ah, ok, now it makes sense. I let the bug report close as "not a bug." I did suggest that if there are two VIs added to the poly VI whose inputs are identical that the poly VI should be broken unless this checkbox is checked. That was rejected because it might break existing poly VIs that users had. Makes sense, but you should still be encouraged to use this checkbox for that case.

    Maybe you knew all that, but it sounded like from your post (Daklu's in particular) that you didn't.

  10. AQ made a post about this relationship recently in explaining some checking that occurs - I can't find the link yet - sorry! :frusty: .

    To be clear: the upcast coercion dot has no effect at runtime. It is not the same type of performance penalty that the coercion dot from int to double represents. We've talked about wanting two different coercion dots, but that's hard to provide since red appears to be the only color that most people can see in that small a space and there's no way to put a different pattern when you only have 6 pixels. So all the coercion dots look the same.

    Typedef to not-typedef-but-still-same-type (and vice versa) is another coercion that has no runtime performance penalty.

    • Like 1
  11. Out of curiosity, is there any particular reason you used a single iteration For loop over a single iteration While loop in Get Reference, or is it just your preferred way to build it?
    Personal choice. Most documents you'll see from NI use the while loop, but I like being able to read, at the start of the loop, "This will only execute once." The stop terminal for the while loop can drift around a bit, and even if it was fixed in place, it's still at the right side of the loop instead of the left side. Wiring the N with a 1 means I recognize this type of loop as soon as I start reading it, instead of scanning across it to see the constant wired to the stop terminal.

    Under the hood, my understanding is that they both convert to the same assembly code, so it doesn't matter which you use.

    • Like 1
  12. I like it. One issue I see that doesn't really seem to have a workaround is inheritance. I don't see how it could be done with this model, at least not easily.

    If you mean "make the Singleton inherit from another class", that should work just fine.

    If you mean "inherit from the Singleton", that's correct. This particular implementation is not intended to support inheriting from the Singleton. Singletons don't generally have inheritance in my experience -- there's supposed to only be one of them. If you want inheritance, there are variations on this theme that can be applied. All of them involve passing in some sort of "key" that says which Singleton you would like to use or moving to a "get and lock, then operate, then unlock" paradigm. But these are generally undesirable for singletons since even asking the question "which of several singletons do you want?" is somewhat ridiculous, since singleton should mean "there is only one."

  13. (I'm curious, is that implementation something you've been sitting on for a while waiting to see if the community would 'discover' it or did you actually have to sit down and think about it for a while?)
    It's been in my head in theory, but I hadn't had time to type it out. I declined to make it a shipping example in LV 2009 because the DVRs were new and I needed to see how they'd be accepted (or not) by the community. Including it (a cleaned up, more commented version of it) in 2010 is probable if the folks here think it solves the issues.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.