Go to Post It is very difficult for a large, inexperienced, impatient group to create order from chaos. - Wayne TenBrink [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 13-08-2013, 08:27
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Flat sequence in Begin.vi

Well, since you ask ...

I'm not sure I'd use the network variables for that purpose. They are meant for shared data across computers. Those aren't local variables as previously stated. They will obviously work as a variable, but they are rather heavy to replace a constant and of course need something like the sequence to prevent a race condition.

There are many alternatives.

The first year, there was no refnum registry. You would allocate things in Begin, bundle them together, and pass them through the subVI as a parameter and into the other functions where the references would be indexed by name. The difficulty of creating or modifying a type and getting it to match with the various inputs and outputs suggested we do something simpler. But if you are ready to create clusters and/or typedefs, this would be the most commonly used solution by professionals.

The refnum registry, introduced in year two, stores the refnums in a named global location. It uses strings, to refer to the refnums for store and read operations. This is far simpler to understand, but it does allow for misspellings to cause a bug. But the misspelling will result in messages going to the DS Message box, so it is pretty easy to detect. And if your "misspelling" was to use front when you really meant back, that isn't really a misspelling and none of the solutions will prevent that mistake.

If you would like to modify the refnum registry, you can add your own wrapper that takes in an enum instead of a string. You'll create a typedef enum that contains all motor names. The store and read operations will then use the enum instead of the string, but adding a motor will mean updating the registry to know about the new motor name. Enums -- enumerations -- are really just numbers at runtime, but in your code you get to use a name for enhanced readability. LV enums are further restricted to be compact ordinals.

I'm not sure this was what you looking for, but that is my input on the code I was shown.

Greg McKaskle
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi