Jump to content

Best Way to Get class Inheritance from LV Object


Recommended Posts

I am trying to make a VI that can get a class inheritance paths from a LV Object.

post-121-1221504333.png?width=400

Additionally I want the VI to be able to do the following:

  1. Run in the runtime engine
  2. Get the inheritance without loading the classes in memory

I got one way of doing it right now that involve this VI (LabVIEW Root\vi.lib\Utility\LVClass\Get LV Class Path.vi) and getting the linker info of the parent classes recursively. Unfortunately this would not work when build in an exe.

There is a wiki article from Stephen Mercer on the LVClass Data Storage Format but this is more about the inherited class version that the inherited class path.

Has anybody already achieved this?

Thanks

Side Question to Stephen: Is the call to LV.exe method (LVClassPathFromInstance) in the Get LV Class Path VI implemented in the runtime engine?

PJM

Link to comment

QUOTE (PJM_labview @ Sep 15 2008, 07:53 PM)

I am trying to make a VI that can get a class inheritance paths from a LV Object.

http://lavag.org/old_files/monthly_09_2008/post-121-1221504333.png' target="_blank">post-121-1221504333.png?width=400

Additionally I want the VI to be able to do the following:

  1. Run in the runtime engine
  2. Get the inheritance without loading the classes in memory

Ummm, if that LV Object input is an instance of the class you want to get the inheritence tree for, don't you have to have all the parent classes in memory for the runtime dynamic dispatch to work ?

The lvclass xml file does appear to contain a class genalogy property which (if one could parse the binary data) might be the key....

Link to comment
QUOTE (PJM_labview @ Sep 15 2008, 01:53 PM)
Side Question to Stephen: Is the call to LV.exe method (LVClassPathFromInstance) in the Get LV Class Path VI implemented in the runtime engine?
I will say this: Get LV Class Path.vi works in the run time engine. Your question about the content of that VI's a password-protected block diagram I will decline to answer.
Link to comment

QUOTE (Gavin Burnell @ Sep 15 2008, 12:54 PM)

Good point. I actually forgot I now use/need the Get Class Inheritance for lvclass file path.

post-121-1221511412.png?width=400

QUOTE (Gavin Burnell @ Sep 15 2008, 12:54 PM)

The lvclass xml file does appear to contain a class genalogy property which (if one could parse the binary data) might be the key....

Ya, I noticed that too. This what actually gave me the idea to try the linker info app.method on an lvclass file.

PJM

Link to comment
QUOTE (Gavin Burnell @ Sep 15 2008, 02:54 PM)
Ummm, if that LV Object input is an instance of the class you want to get the inheritence tree for, don't you have to have all the parent classes in memory for the runtime dynamic dispatch to work ?
This is correct. You're never going to get this VI to work in any case where the class and its full ancestry are not already loaded into memory. You'll have to write something that takes a path in and gives a path out.
Link to comment

QUOTE (Aristos Queue @ Sep 15 2008, 01:57 PM)

Thanks

QUOTE (Aristos Queue @ Sep 15 2008, 01:57 PM)

Your question about the content of that VI's a password-protected block diagram I will decline to answer.

I am not sure what you mean by that (because I did not ask anything about the content of the password-protected Get LV Class Path.vi). If you infer about how I get the info about the method name, LV 8.6 hierarchy window now shows CIN/CLFN info (see image below). My question about this specific part was just about whether this work in the runtime engine.

post-121-1221512906.png?width=400

I am more interesting in finding an answer about how to get the lvclass inheritance.

Thanks

PJM

Link to comment

Why do you want to know the inheritance? If you're working on some sort of editor tool, there are some solutions. If you're wanting something to be part of a built application or deployed VIs, I'm likely to suggest a different architecture is going to be more efficient than any type testing we come up with (even if such facilities were easily available).

Link to comment

QUOTE (PJM_labview @ Sep 15 2008, 05:09 PM)

Have you looked at this post from Darren about Inheritance hierarchy? The VI is password-protected but should work at runtime.

I guess that's the output from LVClassPathFromInstance call you're looking for. I've used it to get the complete class hierarchy recursively. I don't have the result on my daytime computer, but could find it tonight. It's simply an implementation of Darren's VI with the tree control API from Norm the Captain.

Link to comment

QUOTE (Aristos Queue @ Sep 15 2008, 11:55 PM)

Yes, I am working on an editing tool that need inheritance information, among other things, in order to generate the configuration files used to configure the classes.

At the moment, this is not critical that it work without having the class in memory (this would be nice and faster if this were possible). Ultimately the editing capabilities will be built in the executable, hence the reason I am trying to have a way of doing it in the runtime engine.

QUOTE (normandinf @ Sep 16 2008, 05:26 AM)

Have you looked at this post from Darren about
? The VI is password-protected but should work at runtime.

I guess that's the output from LVClassPathFromInstance call you're looking for. I've used it to get the complete class hierarchy recursively. I don't have the result on my daytime computer, but could find it tonight. It's simply an implementation of Darren's VI with the tree control API from
Norm
the Captain.

Ah, I search LAVA before I start this thread and I did not found this post :(

From what I see I came up with a similar solution than Darren (using the linker info). I believe that this solution does not work in the runtime engine.

About, the "LVClassPathFromInstance", this was just a side question to know if the Get LV Class Path.vi work in runtime (which it does).

I am looking forward to see your recursive solution.

PJM

Link to comment

QUOTE (PJM_labview @ Sep 16 2008, 03:56 PM)

Yeah, I get that a lot too...

QUOTE (PJM_labview @ Sep 16 2008, 03:56 PM)

From what I see I came up with a similar solution than Darren (using the linker info). I believe that this solution does not work in the runtime engine.

About, the "LVClassPathFromInstance", this was just a side question to know if the
Get
LV
Class Path.vi
work in runtime (which it does).

I tried it and it does not work in EXE. (If AQ says it, I'll believe him).

I wonder if you could load them dynamically at runtime, check their inheritance and then close them all? If that's possible in EXE, I bet it would be slow and not memory-effective but it would get you there... :2cents: It is not available either at runtime... :(

QUOTE (PJM_labview @ Sep 16 2008, 03:56 PM)

Well here it is. This is saved in LV86. I didn't include Norm's Tree Control API vis, neither the OpenG packages I used, to keep the llb small. I'm sure you don't need them ;) , but if someone else does, please follow the links to get them as it makes too large a file to upload.

Download File:post-10515-1221609011.llb

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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