LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

Tags
This content has not been tagged yet

> Related links

Check out our OOP Code Repository Files or visit the LabVIEW Wiki OOP Portal.


 
Reply to this topic Start new topic
> How do I clone a LVOOP class?
neB
post Jul 2 2008, 02:31 PM
Post #1


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1110
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


I am developing my first LVOOP app and I can't find an option to copy or duplicate a class. In this app I am attempting implement the Holy-Grail of LV, create controls and indicators on the fly. All of the controls and indicators will be individual LVOOP classes and so far, I have the following class hiarchy.

Attached Image

Brief explanation;

Plug-ins - This class defines all objects I will be able to drop on the FP while the app is running.

Dynamic - All objects that will change while the app is in Operate mode. These will be controls and indicators.

Static - These will be background decorations and anything that has an image that does not change.

Boolean - All dynamic objects whos value is either 1 or 0.

LED - A round LED.

Toggle PB - Round push-button

Toggle SW - A toggle switch.

WEll it turns out that there is very little differnce between "Toogle PB" and Toogle SW" aside from the images associated with true and false. What I would like to do is right-click on the "Toogle SW" calss (in the project window) and select Duplicate class. But that option does not exist.

So far I have had to manually create the new class and then set all of the options and inheritances manually.

If there is no official way to do this, how do others go about cloning a class?

Ben


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Ad
post Jul 2 2008, 02:31 PM
Post #















Tags
This content has not been tagged yet
Go to the top of the page
Quote Post
normandinf
post Jul 2 2008, 02:46 PM
Post #2


Very Active
***

Premium Member
Posts: 162
Joined: 18-January 08
From: Montréal, Canada
Member No.: 10515
Using LabVIEW Since:2000
LV:8.6 ,8.5 ,.
ca_quebec Canada Nothing Selected


QUOTE (neB @ Jul 2 2008, 10:31 AM) *
So far I have had to manually create the new class and then set all of the options and inheritances manually.

If there is no official way to do this, how do others go about cloning a class?


I know that you can clone a GOOP class just by right-clicking. Not sure if "Save As" would be sufficient for you if not using GOOP. Would inheritance hierarchy be preserved? I haven't tried it yet.

Attached Image


Tags
clone class    
Go to the top of the page
+Quote Post
ragglefrock
post Jul 2 2008, 05:42 PM
Post #3


Very Active
***

Member
Posts: 62
Joined: 1-June 06
Member No.: 5171
LV:8.0 ,. ,.
Nothing Selected Nothing Selected Nothing Selected


I think right clicking the class and selecting Save As will do exactly what you want. It copies the member VIs, inheritance settings, maintains the directory organization and everything.

This post has been edited by ragglefrock: Jul 2 2008, 05:43 PM


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
neB
post Jul 2 2008, 06:08 PM
Post #4


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1110
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


QUOTE (ragglefrock @ Jul 2 2008, 01:42 PM) *
I think right clicking the class and selecting Save As will do exactly what you want. It copies the member VIs, inheritance settings, maintains the directory organization and everything.



Well it looks like I chose the wrong method of organizing my folders for this to work. I'll try re-arranging the furniture and see if I can get that to work.

Thanks!

Ben


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
crelf
post Jul 2 2008, 06:32 PM
Post #5


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3500
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


QUOTE (neB @ Jul 2 2008, 09:31 AM) *
I have the following class hiarchy

Sorry to bring down the SNR by posting slighty off topic - I suggest you arrange your heirachy using a similar structure that LabVIEW uses internally - that might make your solution a little more intuative:
Attached Image

--------------------


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
neB
post Jul 2 2008, 07:26 PM
Post #6


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1110
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


QUOTE (crelf @ Jul 2 2008, 02:32 PM) *
Sorry to bring down the SNR by posting slighty off topic - I suggest you arrange your heirachy using a similar structure that LabVIEW uses internally - that might make your solution a little more intuative:
Attached Image


THe end users will not know anything about LabVIEW so I'm not sure if that will help much.

Back to the issue at hand!

Rather than fumble around trying to get the project to open up without conflicts (that don't seem to go away, So I threw away an hours worth of file save as...)....

How do Y'all organize the LVcass file relative to the VI's that implement the methods for that class so that the "Save As...." on the Class results in cloning it and all that goes with it.

Boy this hurts! But its better to figure this out now rather than latter.

Thanks all,

Ben

PS: If I figure this out, I'll post back with a structure that works.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
ragglefrock
post Jul 2 2008, 08:26 PM
Post #7


Very Active
***

Member
Posts: 62
Joined: 1-June 06
Member No.: 5171
LV:8.0 ,. ,.
Nothing Selected Nothing Selected Nothing Selected


QUOTE (neB @ Jul 2 2008, 02:26 PM) *
How do Y'all organize the LVcass file relative to the VI's that implement the methods for that class so that the "Save As...." on the Class results in cloning it and all that goes with it.

Boy this hurts! But its better to figure this out now rather than latter.

Thanks all,

Ben

PS: If I figure this out, I'll post back with a structure that works.


The easiest thing to do is to have one root folder that contains a class with any number of subfolders for methods, typedefs, etc. I would personally never have a class member at a directory level lower than the lvclass file, and I wouldn't ever keep two lvclass files in the same directory.

In fact, I generally prefer to mirror the lvclass structure in the project on disk.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
normandinf
post Jul 2 2008, 08:43 PM
Post #8


Very Active
***

Premium Member
Posts: 162
Joined: 18-January 08
From: Montréal, Canada
Member No.: 10515
Using LabVIEW Since:2000
LV:8.6 ,8.5 ,.
ca_quebec Canada Nothing Selected


QUOTE (ragglefrock @ Jul 2 2008, 04:26 PM) *
The easiest thing to do is to have one root folder that contains a class with any number of subfolders for methods, typedefs, etc. I would personally never have a class member at a directory level lower than the lvclass file, and I wouldn't ever keep two lvclass files in the same directory.

In fact, I generally prefer to mirror the lvclass structure in the project on disk.



I agree with these rules.
I've created a "_class" folder where I store all my classes. One sub-directory per class. It acts as a user.lib and I add this main directory to the palette for quick access.


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Aristos Queue
post Jul 2 2008, 08:57 PM
Post #9


LV R&D Envoy
*****

NI
Posts: 1159
Joined: 15-August 06
From: Austin, TX
Member No.: 5877
Using LabVIEW Since:2000
LV:8.5.1 ,. ,.
United States Nothing Selected Nothing Selected My Gallery


QUOTE (neB @ Jul 2 2008, 02:26 PM) *
How do Y'all organize the LVcass file relative to the VI's that implement the methods for that class so that the "Save As...." on the Class results in cloning it and all that goes with it.
One class per directory. No subdirectories beneath that. Classes specific to a single project are in subdirectories next to the project file. Classes common to many projects are in another directory.

--------------------
"A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
neB
post Jul 3 2008, 12:18 PM
Post #10


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1110
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


QUOTE (Aristos Queue @ Jul 2 2008, 04:57 PM) *
One class per directory. No subdirectories beneath that. Classes specific to a single project are in subdirectories next to the project file. Classes common to many projects are in another directory.


OK thanks to All!

It turns I broke every one of those rules. frusty.gif

I'll call this a life leason and adjust my habits.

Again, Thank you!

Ben


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
normandinf
post Jul 3 2008, 02:24 PM
Post #11


Very Active
***

Premium Member
Posts: 162
Joined: 18-January 08
From: Montréal, Canada
Member No.: 10515
Using LabVIEW Since:2000
LV:8.6 ,8.5 ,.
ca_quebec Canada Nothing Selected


QUOTE (Aristos Queue @ Jul 2 2008, 04:57 PM) *
One class per directory. No subdirectories beneath that. Classes specific to a single project are in subdirectories next to the project file. Classes common to many projects are in another directory.


Do I understand that you recommend to classify Public/Protected/Private VIs only using virtual folders in project file and not real folders? Is there a known issue with this particular arrangement? Or perhaps a future one? ninja.gif
I normally like to keep my disk folders about the same as my project files... As Ben says, it's never too late to stop breaking the rules...


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Aristos Queue
post Jul 3 2008, 05:51 PM
Post #12


LV R&D Envoy
*****

NI
Posts: 1159
Joined: 15-August 06
From: Austin, TX
Member No.: 5877
Using LabVIEW Since:2000
LV:8.5.1 ,. ,.
United States Nothing Selected Nothing Selected My Gallery


QUOTE (normandinf @ Jul 3 2008, 09:24 AM) *
Do I understand that you recommend to classify Public/Protected/Private VIs only using virtual folders in project file and not real folders? Is there a known issue with this particular arrangement? Or perhaps a future one? ninja.gif
I normally like to keep my disk folders about the same as my project files... As Ben says, it's never too late to stop breaking the rules...
Virtual folders are supposed to be just that... virtual. Moving files physically on disk breaks source code control. I don't want to have to do a "perforce rename" command every time I change a VI from public to private, or whatever other organization scheme I may be using for my VIs. I don't want to have to make sure that all caller VIs are in memory so that they're kept up-to-date about the path change of the VI. To me, making the physical structure reflect the virtual structure is no different from putting "_private" in the name of the VI. It causes problems if you ever decide to change how you've got the VIs organized. Once you're completely done with development, you can use "Build>>Source Distribution" to create a particular disk layout if that's desirable for some reason.

This is all just my opinion, not a rule. But, as has been noted, things do work better when you use a tool the way its designers intended. :-)

Now, there are those who advocate the opposite, and for those people, the "disk sync'd folders" exist. I loathe the disk-sync'd folder feature. Why? Because it does not and never can work with libraries (including .lvlib, .lvclass, .xctl and .lvsc). The physical hierarchy and the ownership hierarchy cannot be simultaneously reflected in the tree, and the two features end up fighting with each other. But if you're just using raw VIs, you may enjoy disk sync'd folders. Assuming you're not using source code control, of course. :-(

--------------------
"A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Jul 3 2008, 09:42 PM
Post #13


Confucius say, Man with tight trousers is pressing his luck.
Group Icon
*****

Admin
Posts: 2308
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE (Aristos Queue @ Jul 3 2008, 10:51 AM) *
This is all just my opinion, not a rule. But, as has been noted, things do work better when you use a tool the way its designers intended. :-)

Maybe tools should be designed as users expect them to work. :-)

--------------------


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
normandinf
post Jul 4 2008, 02:24 AM
Post #14


Very Active
***

Premium Member
Posts: 162
Joined: 18-January 08
From: Montréal, Canada
Member No.: 10515
Using LabVIEW Since:2000
LV:8.6 ,8.5 ,.
ca_quebec Canada Nothing Selected


QUOTE (Aristos Queue @ Jul 3 2008, 01:51 PM) *
This is all just my opinion, not a rule. But, as has been noted, things do work better when you use a tool the way its designers intended. :-)


Point taken. smile.gif


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post
neB
post Jul 4 2008, 12:32 PM
Post #15


Certified Kool-Aid Kid
*****

Premium Member
Posts: 1110
Joined: 6-December 02
From: Pittsburgh PA USA
Member No.: 29
Using LabVIEW Since:1998
LV:7.1 ,. ,.
United States Germany Nothing Selected


Notes to others:

"Rename" is handy for moving your files around.

Use a Source Distribution to pull out only the active files.

If you do something that results the project trying to re-open the old files, check your lvproj file with a text editor for the files it is looking to find, they sometimes get stuck in a section labeled VI's in memory. Just edting out that line fixes that.

Ben


Tags
This content has not been tagged yet
Go to the top of the page
+Quote Post