06-17-2008 08:00 PM
Rolfk;
@rolfk wrote:
I do sometimes use datalog refnums to pass around my private data handles. Dropping in an enum with a single enum value specific to your handle type will basically refuse to allow anyone to wire something else to that connection pane parameter than my own private handle type.
06-18-2008 12:49 AM
Well here it is! Basically you simply take a datalog refnum and drop in an enum with a single value describing somehow your connection. For my database library I simply used the letters ODBC (very original I know) for a connection refnum and STMT for statement refnums.
@dgholstein wrote:
What you describe sounds like something I want! Since I am defining more than one refnum (one for database connection and one for spline fits), it would be really cool to see a broken wire when trying to connect the wrong refnum to a subVI. Can you show me a screen shot of how to do that? (unless you do that with LV <= 7.1, I wouldn't be able to read your VI)
...Dan
06-18-2008 07:23 AM
Rolf;
@rolfk wrote:take a datalog refnum and drop in an enum
06-18-2008 10:08 AM - edited 06-18-2008 10:09 AM
You did get a datalog refnum, did you? It is similar to a datafile refnum but is really an empty shell that requires you to define some datatype. It is meant to be used for datalog file access a file format where LabVIEW does the flattening of more or less complex data structures for you.
@dgholstein wrote:Rolf;
@rolfk wrote:take a datalog refnum and drop in an enum
I'm getting closer, I've started wiring in the "Not a refnum constant" and it looks better already. I still don't see/understand "drop in an enum", is this in a custom control? When I add an enum to a custom control panel with a "Not a refnum constant", it breaks -- if I make it a cluster, the wire will not be correct.
BTW: Check out my sql_LV on Source Forge, it looks like we're doing similar things. I do use OpenG toolkit to wire in my data as field-named clusters.
Thanks,
...Dan
06-18-2008 10:34 AM
06-18-2008 11:08 AM
Rolf;
@rolfk wrote:I'm aware of lv_sql. This tool however has been started back in 1996 when I needed to interface to a customer specific database and the then called SQL Toolkit could not connect to their database driver. While it was crude in the beginning it has been refined to great lengths in several updates in the meantime and I do use it for all my database projects. All the datatype handling for retrieval and to a much smaller part on storing is however done inside the shared library code. All the C code is only tested on Windows but done in a way that it could fairly easily be recompiled for other LabVIEW plattforms, anyone saying ODBC Access for Linux?Message Edited by rolfk on 06-18-2008 05:09 PM
No OpenG Variant Toolkit or LabVIEW Variants used, since everyting is done inside te shared library but if NI would have documented the C API for the Variants, I would have added that too.
While I have been thinking about opening that up to other people I haven't done so yet for several reasons.
06-18-2008 11:34 AM
For our particular problems in working with LabView, you are correct; as well, for program readibility and programming ease.
@MathGuy wrote:
I would actually consider this a somewhat poor design approach on NR's part. The reference to the raw input data is hidden by two structures (first the NRVector<> and then the Spline2D_interp) making it difficult to track ownership. I would hope that they offer a non-reference constructor where this data is copied internally so it can be freed by the parent's destructor. Of course, that's just my opinion based on my experience in designing and using these types of math algos.
I think that's an understatement, I found "caching LV handles" to be no less than impossible -- but an easy trap to fall into.
Based on the current thread contents, I think you know that caching LV handles (or their pointer contents) is not recommended.
06-18-2008 11:41 AM
Rolf;You did get a datalog refnum, did you? It is similar to a datafile refnum but is really an empty shell that requires you to define some datatype. It is meant to be used for datalog file access a file format where LabVIEW does the flattening of more or less complex data structures for you.
06-18-2008 12:43 PM
Actually it's not impossible. But you need to take care that LabVIEW does not use them itself after you return from the external function. I explained how that can be done but it is involved and you need to be careful about it. And of course once you take ownership of such a handle you also have to dispose it yourself.
@dgholstein wrote:I think that's an understatement, I found "caching LV handles" to be no less than impossible -- but an easy trap to fall into.
Based on the current thread contents, I think you know that caching LV handles (or their pointer contents) is not recommended.
...Dan