LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom object refnum

Hello all,

there are some VIs that works with refnums ( file i/o, semaphores, queues, notifications,). If i understand this refnum is pointer to object.
Now i want create my object and create vis that will work with object through such refnum.
How can i create this refnum and how to work with it?


Thanks for your answer."
0 Kudos
Message 1 of 5
(4,304 Views)
Try this:

First, look through some of these VIs, and the configuration VIs. This will give you some idea as to how NI creates and uses references. Basically, a reference is just a numeric that corresponds to a particular data set in an "object".

You will likely not be able to create a 'true' reference in the strictest sense, but as far as simulating data objects, it will be fairly transparent. I have been using a similar method, but use the data objects themselves, as opposed to a reference.

In creating your objects, in order to determine if you want to use these "references" or not, you will need to determine what you are doing, and how you are going to implement it. I suspect that in your case, you will do what I and most other people that use d
ata objects do, and that is to access the object itself. The refnum cases within LabVIEW are usually for extremely flexible (and therefore exremely difficult/time consuming to create) objects with nearly universal application. These are more programming tools than code.
0 Kudos
Message 2 of 5
(4,304 Views)
The custom refnums that semaphores, queues, and notifiers, and GOOP objects use are enumerated constants inside on a file refnum shell. The enumerated constants have one possible named state, which is thier name; however the U32 pointer is cast to the enum, so that it will have a value which can be non-zero. The semaphores, queues, and notifiers have fancy images, which have been added to the enumerations decoration component in the control editor.

Confused Yet?

If you would like to create your own objects and refnums, the easiest solution is the GOOP Wizard. It will walk you through the process and provides a core which creates, destroys, and manages objects for you.

Download it here:

http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22
862567a9006ffe76/5d7db42c91f392fc86256aae00463d78?OpenDocument

Good Luck,

Jim
Message 3 of 5
(4,304 Views)
So, if i want create such custom refnum i have know U32 pointer to object? How can i know it?
Also, how can i operate the object through the pointer?
0 Kudos
Message 4 of 5
(4,304 Views)
There are a some issues here:

First, the custom refnum is only used as a way to create a data type that nothing else, but that refnum type, will wire to. This helps avoid wiring mistakes. Also it is a way to give the refnum a fancy icon.

Second, you need to have something that creates objects and passes a pointer to you. You will also need something that returns objects, replaces objects, and destroys objects by pointer (reference). You can do all this yourself, but I recommend using the GOOP Wizard.

I am currently working on a project to create an Open Source Object Oriented programming scheme, which will include an Object Manager. This project will use Python-like objects (Python is a scripting language that uses object structur
es ). This project will not be completed for a couple months or so. If you want to stay up to date, check out www.OpenG.org for the Leviathon project (it's not up there yet) or you can go to www.sourceforge.net/projects/leviathon .

Good Luck,

-Jim
0 Kudos
Message 5 of 5
(4,304 Views)