LVOOP - Casting Weirdness

I discovered a strange behavior of the method "to more specific class '... I use LV2011SP1.

My request:

I have an application that analyzes a collection of blobs of data, with each blob of data defined by a class of LV. Each of these blobs of data inherit from a common parent. I store my collection of BLOB data in a table. Standard stuff.

Obviously each blob data must be upcast to the parent type when stored in a table, but the execution of each element of the array value is kept as a type of child correct data.

It is part of the analysis where I have to do some type of control for some of the blobs, so I use the primitive "to more specific class" in an attempt to cast the elements of my table to the desired data type. A mismatch between the input type and the target type should produce an error, right?

Here's the weird part:

  • If I use the method "to more specific class ' to directly mount a class of the child to a different type, the cast fails (as expected).

  • When I use the method "to more specific class" to one of my elements of array cast to a different type, the cast * always * succeeds. Why?

The image below illustrates the problem. Ferrari and Mini are the two children in the car. Mini cast Ferrari gives an error (as expected), but casting an upcasted Ferrari version Mini works! This seems strange to me since the execution of the target type value is 'Ferrari' (as illustrated by the probe).

Then why the method "to more specific class ' use values of execution of its entries?

Just a quick follow-up...

I found all my answers in this post over at LAVA: http://lavag.org/topic/16081-am-i-understanding-the-reason-why-i-have-to-use-preserve-rt-class-corre...

It seems that the function of "preserve the Runtime class" does exactly what I need, i.e., it performs its type checking based on the value of execution of the reference to entry class. On the other hand, the function "to the more class specific" is very similar but not the verification at the time of publishingof its type.

The information is useful, but not so clear from the help page!

Tags: NI Software

Similar Questions

  • using LVOOP with several instrument drivers

    I created 3 classes SigGen.lvclass, HP8657B.lvclass and HP8648B.lvclass. The second 2 classes inherit from SigGen is simply the address of the instrument and virtual functions. I created a VI that initializes a class according to the configuration in a file. This VI emits a SigGen.lvclass. This seems to work fairly well with dynamic distribution. So, I created another set of classes for power meters. However, in the VI which initializes one of objects and the fate as a base class, I get a constraint point while on the SigGen I get none. I am new to LVOOP so I don't know that I'm doing this correctly. Can someone take a look?

    LabVIEW 8.5 Professional

    Nothing to worry about. This is because the cast can't until it hits the indicator so you don't have to only one type of power to the output meter. With the SigGens casting goes to the Terminal output of the case structure (which does not show a point constraint).

    LabVIEW should probably be more dynamically in the question about if it shows a constraint when dot LVOOP ascending cast objects.

  • Weird with LV2009 when questions of the decommissioning project version

    Hello people,

    I'm having a weird problem with LV2009.

    One of my projects that worked very well in LV8.6, broken arrows LV2009 when I wore on it.

    On further investigation, I found that under ...\LabVIEW 8.6\vi.lib\Utility\config.llb does not exist in LV2009 as a Bachelor's degree in LAW, but as a regular directory.

    In addition, some of the screws that were in the config.llb are not even in the config.llb folder.

    I realized that NEITHER completely changed the iner workings of "Screw of Configuration file" [they use queues instead of the file refnums!]

    Although, I realized that I have how can I operate most of the code by type-casting the file with a queue refnum refnums] but change the code is currently not option and a file 'Config data write to File.vi' (which is config.llb) is always absent from the LV2009.

    Therefore, I had no choice but to descend slope back to LV8.6.

    However, after saving the project 2009 to 8.6, LabVIEW always says that changes were made to some of the screws if opened within the project or line, even if no changes were made.

    The change in detail State "Disable dial-up structure frame. I did disable the schema structure in these screws, but I deleted them.

    I searched the forums for "Disable dial-up structure frame", but got no results.

    Someone has experienced this problem or have any suggestions?

    Thanks in advance.

    LVexpert2b

    CLD


  • Combining LVOOP DVR with dynamic distribution class and asynchronous Runtime Preserve

    OK, the title seems like a cornucopia of terms LVOOP.  But there's a reason.  It is sort of an extension of THIS thread.

    Do I have recently created a LVOOP approach to load completely asynchronous user interface elements into sub-panels.  This I have combined with a global repository for objects (which are essentially the singletons with functionality of the user interface) which are shared via DVR, thus eliminating a large number of synchronization headaches).

    This means that I can have a universal framework to initiate a secondary user interface elements.  Changes made to the object there are automatically reflected in the global repository.

    So far so good.

    What I do like is a combination of two buildings of apparently clumsy code that I need to keep things running.

    Construct odd 1:

    I defined a function "Launch UI" in my parent class which is the dynamic distribution (which allows to take care to launch its own UI of each object).  It takes a parent DVR as second entry object which sure is the exact type and the type of object called using the code below.  The Type REAL to two entries for the launch of VI in PEI are identical.  This is guaranteed because I need every new class instead of this function.

    Here I pass the DVR from outside to 'Launch' VI International preliminary examination, but the object obtained within the IPE retains information for DD thereby ensuring that the VI called for the launch of the user interface is identical to the type of object in the DVR REAL.  It works well and putting this bizarre construction within the parent class, abuse is minimized, it works very well and seems to have no major side effects.

    So now we have a VI running asynchronously in the background that belongs to a specific object, but has a DVR which it * thinks * is a parent Type, but because of the measures taken previously, is actually of the same type as the object itself.

    In order to make use of the functionality defined in this kind of real object, I continually have to re - interpret the object within the IPE as described below.  Otherwise only the Parent feature is available.

    If I access only methods of the parent class, then the Preserve feature is not necessary.

    Is there a more elegant way to do it?  I find the net result of this code and cast to be really useful and much easier to manage the road non - DVR since synchronization problems disappear.  Through the use of the near-atomic REI, we remove the chances of blocking.

    All editing in the asynchronous interface user of VI is automatically reflected in all subsequent use of the DVR.  Even if digital recorders are not shared between the screws, this makes it easier (for me) the puzzle of the synchronization.  If you start this expansion beyond the limits of a single VI, the benefits in synchronization becomes really huge.  You can even have several interface user objects based on the same data in the background without additional synchronization needs.  Required only one synchronization is a global 'data updates' for the object in question, in which case the UI elements simply update their indicators and the DVR's controls again.  It is trivial.

    So, I am convinced that the net result of this is very beneficial.

    My question is if there is a better, safer, or more 'official' way to do?

    I was about to start a new idea to combine the 'Preserve Run time class' and Terminal DVR of the International preliminary examination so that the casting is done automatically.  We could then have a double entry in PEI, the DVR (of the base type) as well as the ACTUAL Type of the object, but of course to return an error if the types are incompatible.  It would be like an "imposter" DVR of entry for International preliminary examination which allows a re-interpretation of the object type.

    Would all of this go away if we allowed dynamic distribution work with DVRs?  No doubt.

    Shane

    I agree that the deletion of bizarre construction #1 probably requires a dynamic send on DVR.  Unfortunately, if you look at the post of the exchange of ideas on that, there are a few nasty subtleties concerned by the application, so I wasn't expecting any time soon.

    For bizarre construction #2, you can cast the DVR itself.  Make a constant DVR that refers to the class of the child and lowered it seized goes in PEI.  If you need to return the parent type after the International preliminary examination, branch just the wire DVR before melting and use it as your lead.

  • Error 1448. LVOOP: Referring to objects of the child class

    Hi all.

    In a project using LVOOP, I defined a class parent with several attributes. Of this class, there are three classes of children who inherit the attributes of the parent class and also have their own.

    Imagine that I instantiated an object belonging to the parent class and initialize its attributes. So I want this object even belong to a class of the child in particular, and refer to its attributes in the class of the child, of course, keep the values of the parent class. How can I do?

    I tried to use "in a more specific class" tool but I get the following text: "error 1448: bad type cast." LabVIEW does not deal with the run-time value of this class of LabVIEW as an instance of the given class of LabVIEW. »

    Exactly the same problem is committed and solved here http://lavag.org/topic/7473-lvoop-class-variable-as-child/, but because the links are temporarily disabled I can't download and understand the code example, which shows what it says there.

    Thank you very much
    Francisco.

    Hi Francisco,.

    Take a look at this thread: http://forums.ni.com/ni/board/message?board.id=170&message.id=362388&requireLogin=False

    Christian

  • Weird problem with dynamic text

    Hello

    I created a dynamic text field - mediaImportName001 (created and it contains the name of a file that I have chosen to import them using a browser (as3 and AIR) button.)

    It works very well - I can import the file, and the name appears in the field.

    I would now like to pass the content of the text field to another text field.  But I'm not content. If I try to find the contents of the textField trace("mediaImportName"+thisNum).text - Flash returns "undefined" (even though I'm him asking to draw once the field has been filled).

    I use the following code to check that the material is really there and named correctly (the code returns the children):

    for (var i: uint = 0; i < this.numChildren; i ++) {}
    trace (this.getChildAt (i) .name + "\t type:" + typeof (this.getChildAt (i)) + "\t" + this.getChildAt (i));
    }

    It returns:

    object: type instance370 [object, form]
    object: type mediaImportName001 [TextField object]
    object: type mediaFiletype001 [TextField object]

    How can I get Flash to give me the text in mediaImportName001?

    It's weird - this.getChildAt (i) .name

    from above gives me...

    mediaImportName001,

    yet

    trace (['mediaImportName' + thisNum] .name);

    returns undefined (thisNum represents an increment I used to name several clips and text fields and in this case trace (thisNum); return 001)

    Any ideas why this happens?

    Thank you

    Shaun

    No logic problem, just a problem with describing the problem (as far as the fix goes) and using the property name (as far as the issue goes).  There is a difference between the creation of a dynamic textfield (a type of textfield) and dynamically a textfield (using code to create).

    In AS3, the name property is a property and it is not the same as the name of the instance that you can assign to an object on the stage.  To target an object using its name property, you must use the getChildByName() method, or alternatively, you can use the variable you used to create it.  You may need to cast as a TextField object as well as to operate...

    trace (TextField (this.getChildByName ("mediaImportName" + thisNum)). (Text);

    which would produce the same result as the use of...

    trace (mediaImportName.Text);

    I don't know how the numbering disperses on "001", but you might find it easier to work with by storing just the instances of an Array by using the media_file_num to set the index where they get.  Then, you would be able to target the textfield to help...

    trace (tfArray [thisNum]. (Text);

  • Cannot be implicitly cast to Bitmap in class?

    Hi all

    I created a dynamic ResourceLoader class that loads all the necessary assets in an internal dictionary, store the Loader.content (which is a bitmap object) indexed by a string name. Everything works fine and dandy when I clone() the bitmapdata and cast to an object of display, but when I try to do the same thing and assign setStyle, I get this weird error:

    Type coercion failed: cannot convert flash.display::Bitmap@c479439 to class.

    How can this be? If everything is not derived from class?

    So, instead: (only the lines below)

    [Embed (source ='... / media/actionbar_def - click.png "")]
    private var defClick: Class;
    in ctor...
    setStyle ("downSkin", defClick);

    Now, I'm doing it:

    mLoader.load (new URLRequest(I'.. / media/actionbar_def-click.png')));
    After loading...
    mImages ["defClick"] = mLoader.content;
    during the construction of button...
    setStyle ("downSkin", DisplayObject (new Bitmap (Bitmap(mImages["defClick"]).bitmapData.clone ()));

    Does anyone have any suggestions on where I'm wrong?

    Thank you.

    ZenSeven

    I thought about it, even if it does not solve my problem.

    A 'class' is that actionscript is a static class - while Bitmap@c479439 is an instance of Bitmap. So it makes sense why it cannot convert!

    I love being a n00b ActionScropt!

  • Weird lines and do not wake

    My computer has been acting since weird transition to macOS Sierra. When you log in you get these weird lines. They do not always. Also, I noticed when disconnection and pushing the standby button it wake up and I have to stop it and start it up. I didn't want to reinstall sierra. Who took about two days.

    Retina 5K, 27-inch, late 2015 3.3 GHz Intel Core i5 16 GB 1867 MHz DDR macOS Sierra 10.12

    Material or something is very wrong and I would like to call or make a Service appointment as soon as POSSIBLE,

    help > desktop Mac Service response - Apple Support Center

    FWIW I've updated 2 old iMac and several other year of the Mac Mini to Sierra. Each of them updated in less than 30 minutes and no having problems or ill consequences.

  • iPhone 7 weird noise ticking after sending message sound

    Hello

    I use an iPhone 7 for 4 days now and yesterday, I, after I send a message (using iMessager, Wechat or Whatsup), I started noticing a sound weird/click tick immediately after application. That weird noise resembles a small distortion in the enclosure which happens after some noise is played.

    Did anyone encounter the same problem?

    Thank you in advance.

    Best regards

    Ricardo

    Same here, but also after taking a screenshot. Shortly after the sound of the camera.

  • Login screen of the MacBook is weird.

    Hello! Login screen of my computer is weird. The colors are darker and the cursor moves more slowly than usual. Everything started after I updated my MacBook (retina, 12 inch, early 2015) to OS X El Capitan 10.11.6. Everyone knows about this problem? Is it possible to fix it?

    If that had happened to me, I would try Safe Mode boot because that passes through a few additional system checks.

    Try safe mode if your Mac does not end commissioning - Apple Support

  • I lost my phone 2 weeks ago. Now, I received a message telling me to connect to find my iphone but the link is very weird

    I lost my phone 2 weeks ago. Now, I received a message telling me to connect to find my iphone, but the link is very weird.

    I entered my information it because I wanted to see where was my phone, but nothing has arrived. After that I connected to my laptop and I could go on my account, but it seems that my Iphone (that got stolen) are there any more and I can't locate. What do you think? would it be the thievs who send me this message on my news?

    This is because it is a phishing attempt to make you try to open a session, so that they get the powers they need to disable find my iPhone on your device. Do NOT click on anything and ignore it.

    Sorry, I see that you were already there and gave them the information. Your device, as well as your iCloud account have been compromised. You need to change your password immediately. Your device is finished now, you will never recover.

  • Finder of freezing and acting weird

    Hi I had a couple issues Finder weird recently any help would be much appreciated!

    The finder drawing seems to freeze - can I open a folder or a new window of finder and sometimes it will be fine, but then it will be half freeze - the content of the window is not displayed - it will just be white or the background (desktop etc) is drawn in the finder window. I screen shotted because it's a little hard to describe...

    It seems to go there I kill finder / restart for 2-5 minutes... then the problem comes back.

    I deleted finder prefs, doesn't seem to help. I did a reboot in recovery mode and ran the repair disc utilities and which seem to help for a few days, but now back!

    I can close the windows in the finder and open new, and the question seems to come and go a little... Any ideas?

    Thank you

    Stuart

    Hello

    Start Safe Mode removes the system caches that can help.

    Follow these steps to start in safe mode.

    1. Start or restart your Mac.
    2. As soon as you hear the startup tone, hold down the SHIFT key.
    3. Release the SHIFT key when you see the logo Apple appears on the screen.

    After the Apple logo appears, this may take longer than usual to reach the login screen or your office. This is because your Mac performs a check of directory of your drive to boot in safe mode.

    To leave safe mode, restart your computer without pressing any keys during startup.

    Then, try the Finder.

  • Weird behavior of Safari Dock icon

    For several months now, I noticed a weird behavior of the Safari icon on the dock.

    Note: I have the Safari Dock permanently icon in the dock if the application is running or not for quick access.

    With open Safari, after periods of inactivity or after the awakening of the mode standby, the icon will lose the small black dot on the bottom that indicates an active application.

    By clicking on the icon or a .webloc file reveals that Safari is still active, but because the icon does not animate as it does when it is launched.

    How can I fix and when Safari * is * open its Dock icon indicates that it * all the time *?

    Probably also related...

    All too often, after similar as scenarios above, Safari actually leave - all on its own.

    How can I fix this too?

    Safari has also been freezing quite often lately have to be re-launched or sometimes requiring a restart of the computer system.

    Something is not.

    Go step by step and test.

    1. Disable Extensions and test them.

    Safari > Preferences > Extensions

    Uncheck 'Enable the Extension' and test.

    Enable the Extensions one by one and test.

    To uninstall any extension, select it and click the "Uninstall" button

    2. Quit Safari if it is open.

    Hold down the option key and click on the "Go" menu in the Finder menu bar.

    Select 'Library', then 'Caches.

    Find the folder "com.apple.Safari".

    Right-click on "com.apple.Safari" and select "move to trash".

    Restart Safari.

    3 remove the test and com.apple.Safari.plist file.

    Empty the trash.

    Quit all applications.

    Hold down the option key and click on the "Go" menu in the Finder menu bar.

    Select 'Library' in the menu dropdown.

    Library > Preferences > com.apple.Safari.plist

    Right-click on it and select "place it in the trash.

    Close the Finder window.

    Turn it back on.    Restart Safari.

    If this does not help, "put back" the com.apple.Safari.plist

    Right click on the trash icon in the Dock, then select 'open '.

    Right-click on the com.apple.Safari.plist and select 'Put Back'.

  • How to change the tempo of the bass guitar? no weird noise.

    I clicked on the change of tempo to follow on a bass guitar recorded, but it appears totally artificial and strange, sped upwards or downwards.

    I'm doing something wrong?   why it sounds so weird!

    Please can someone answer this!  It's the same thing if I transpose the bass, sounds strange wobbly sounds.

  • iPhone 5 s acting weird from the hotmail interface has changed

    Hello

    My 5's mail app iPhone acted as weird as the hotmail Web site interface has changed a few weeks ago. The Junk folder disappeared and now, when I get an email, the phone rings and vibrates as before, but it is there no preview on the lock screen, or the notification Center.

    What is happening to someone else? How can I fix it?

    Thank you

    Hello

    It can help to check your email notification settings:

    • Go to settings > Notifications > mail > select an account to check the notification settings.

    You can also update your iPhone to the latest version of the software (your post indicates that it is not up-to-date):

Maybe you are looking for