LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WORM Global

Solved!
Go to solution

You could change it so that you dont have to specify Add | Read. Just the Global name and its value or return its value.

 

First time its delete all.

 

Second time and specifying Global for the first time, then it adds

 

Next time and specifying Global and it exist and the Value In is empty then it returns the Value.

 

If the Value In contains data then and error is generated because its trying the change the stored value.

 

Regards

Ray Farmer

 

 

 

 

Regards
Ray Farmer
0 Kudos
Message 11 of 43
(3,082 Views)

Ray "Mr. TestStand" Farmer:  Good to hear from you in this forum.

 

So you are saying that if the user specifies a value, then the add function should be implied.  If a value is specified and the name already exists, then it is in error.  If the user does not specify a value, then this implies a read function.  Very good point.  One less input to send.

 

Does anyone else think this is the way to go?  It is a good idea, but I'm undecided.  I would like to hear some pros and cons.  My pro would be one less input to wire.  My con would be that it takes a little more effort to determine the action when looking at the code.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 43
(3,068 Views)

Here is the modified WORM_Global as suggested by Ray Farmer.  After playing with it, I like it.  First call still does delete all and then adds first value (if name and value in are present), all in one.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 43
(3,052 Views)

I haven't looked at you latest WORMs, yet, but I think RayF was on the right track.

 

Since the first time you use it, it would be to input all the .... euh.. "global" values, then you just wire that funtion, so a single terminal would do as an input.  Afterwards, wiring something to the input would be futile.  However, you can always read.  If you read upon the first time, then you just read nothing and serves whoever right for misusing it.  (it's a bit early in the morning... waiting for the tea to finish infusing, so the braincells are still asleep.  hopefully what I wrote made sense. I need to work on mind-melding techniques 😉 )

0 Kudos
Message 14 of 43
(3,027 Views)

I completely agree with the automatic read if no value is supplied.

Now it is a real WORM

greetings from the Netherlands
0 Kudos
Message 15 of 43
(3,012 Views)

What about the following idea.

To make a WORM without variants.

Simple polymorphism can do this job but the problem is that duplicate names can occur.

We could of course check in a simple string name WORM for these duplcate names and issue an error before creating the var of the given type.

It makes the receiving program much easier to use the var.

greetings from the Netherlands
0 Kudos
Message 16 of 43
(3,009 Views)

Albert Geven wrote:

What about the following idea.

To make a WORM without variants.

Simple polymorphism can do this job but the problem is that duplicate names can occur.

We could of course check in a simple string name WORM for these duplcate names and issue an error before creating the var of the given type.

It makes the receiving program much easier to use the var.


 

Can't store different data types in a shift register unless you use a cluster.  But you can't add to a cluster at runtime.  That is why I use an array of variants.  Any data type fits, and you can add to it during runtime.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 43
(2,995 Views)

In fact in a polymorph vi you don't store different datatypes in a cluster, in each polymorph vi you only have the shiftregister for that type.

The only problem in programming is that for each separate type you need a separate implementation.

So what I think of is a polymorph base vi for which the compiler places the call to the actual implementation and that actual implementation checks in a common string wormglobal (or special WORM) for name collisions.

greetings from the Netherlands
0 Kudos
Message 18 of 43
(2,988 Views)

Albert Geven wrote:

In fact in a polymorph vi you don't store different datatypes in a cluster, in each polymorph vi you only have the shiftregister for that type.

The only problem in programming is that for each separate type you need a separate implementation.

So what I think of is a polymorph base vi for which the compiler places the call to the actual implementation and that actual implementation checks in a common string wormglobal (or special WORM) for name collisions.


 

You would have to have a separate vi for each data type.  You would have to search for a name in each vi.  To me this is very cumbersome compared to using variants.  I would rather have just one vi.  There is nothing so wrong with using variants that you would have to go through so much trouble to avoid using them.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 19 of 43
(2,974 Views)

Maybe you could use LVGOOP to handle this and have the base method store the data as a variant with higher level (polymorhic VI handling the different data types) That why you could keep the one search vi.

 

regards

RayF

Regards
Ray Farmer
0 Kudos
Message 20 of 43
(2,965 Views)