Jump to content

Q: How to get a valid reference to created object without a wire


Recommended Posts

Sorry , posted to 8.xx discussion forum by mistake.

Reposting an edited version here.

Let me try to re-phrase this Q since its possible I am looking at this the wrong way.

GOOP 3.0.5

1) Create object (x)

2) Use object (x) in VI(a) : ( VI(a) runs independently using object(x) methods to do some task )

3) Start VI(b) : (ALso an independent process)

4) Inside VI(b) obtain a valid reference to object (x)

How to get this ref in VI(b) without a direct wire connection?

Thank you

JR

Link to post

QUOTE(John Rouse @ Jun 22 2007, 06:48 PM)

1) Create object (x)

2) Use object (x) in VI(a) : ( VI(a) runs independently using object(x) methods to do some task )

3) Start VI(b) : (ALso an independent process)

4) Inside VI(b) obtain a valid reference to object (x)

How to get this ref in VI(b) without a direct wire connection?

You can name your objects..

The private "New" method that is used in the Create method to construct the object has inputs Create method and Object name. Set the latter to some unique name for your object and set Create method to Create or lookup existing. This way a first call to the create method will create the object, but every subsequent call will return a reference to the existing object.

Link to post

QUOTE(Jeffrey Habets @ Jun 22 2007, 06:33 PM)

You can name your objects..

The private "New" method that is used in the Create method to construct the object has inputs Create method and Object name. Set the latter to some unique name for your object and set Create method to Create or lookup existing. This way a first call to the create method will create the object, but every subsequent call will return a reference to the existing object.

Thanks guys for the comments. I think I figured it out. Sorry I am not always clear about what I am looking for because Im not sure myself sometimes ;)

I am using the singleton nature of a Named object and also the "Create or look up existing" feature.

What I couldn't figure out (until today) is how to keep from initializing my object attributes from its external ini file in the create method.

I guess the only obvious solution is to have a boolean attribute such as "Active" that I could set to TRUE once the object is created and properly initialized.

Then, when creating it again elsewhere check on the "Active" boolean to determine what to do next.

If "Active is True, pass the ref through and do nothing else.

If "Active" is False, Load the attributes from disk file and do whatever other setup it needs.

The destructor will set the "Active" back to False before storing the object state back to the disk file.

I think this will work.

Link to post

QUOTE(John Rouse @ Jun 22 2007, 09:48 AM)

Sorry , posted to 8.xx discussion forum by mistake.

Reposting an edited version here.

Admin Note: Next time, you don't have to repost. Just click on the report post button at the bottom left of the post. Then type your request into the text box. An admin will move the post into the right forum.

Link to post

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.