Conflicting Data structures [message #15933] |
Sun, 27 June 1999 00:00  |
dirk
Messages: 15 Registered: March 1998
|
Junior Member |
|
|
First off, i want to thank David, Liam, and all the rest who helped me with my
question about how to retain data after a widget has been destroyed. I think i
was partially confused to begin with, but somehow the answers cleared things up
anyway.
Now! I have a widget that allows a user to select an ascii data file and read
it into a structure. Lets say widget#2 queries that structure and performs some
operations based on the data, and then widget#2 is destroyed.
Ideally, i would like the user (me) to be able to choose a new data file, read it
in, and query it, but i keep get the conflicting data structures error. Even
if i exit the program and rerun it, it seems like that structure is still hanging
around. I can't figure out how or where to zero it out! What am i missing?
Thanks! - dirk
|
|
|
Re: Conflicting Data structures [message #16060 is a reply to message #15933] |
Wed, 30 June 1999 00:00  |
Nando Iavarone
Messages: 48 Registered: December 1998
|
Member |
|
|
<HTML>
dfabian@my-deja.com wrote:
<BLOCKQUOTE TYPE=CITE>Can anyone tell me what the purpose
<BR>of having a named structure versus an anonymous
<BR>structure might be? It doesn't seem like the
<BR>named structures are as versatile - you certainly
<BR>can't destroy them and re-fill them with new
<BR>information.</BLOCKQUOTE>
A few examples on the use of a non anonymous structure can be found in
the idlhelp.
<P>I'm developing a great system,
<BR>and I think the non anonymous structures are useful from the
point of view of the architectural design.
<P>Have a good job.
<BLOCKQUOTE TYPE=CITE>Sometimes.. i just want to pinch IDL.</BLOCKQUOTE>
So do I ;o)
<PRE>--
Nando Iavarone
Advanced Computer System - SPACE DIVISION
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440968 (direct)
E-mail:
f.iavarone@acsys.it
FrdndVrn@altavista.net</PRE>
</HTML>
|
|
|
Re: Conflicting Data structures [message #16068 is a reply to message #15933] |
Tue, 29 June 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dirk (dfabian@my-deja.com) writes:
> This was it! I had defined the structure with a
> name (i'm not sure why) and somehow that caused
> the conflict. Can anyone tell me what the purpose
> of having a named structure versus an anonymous
> structure might be?
Named structures are much easier to use sometimes, since
the *definition* of the structure is stored inside of
IDL. So, if I make a structure like this:
a = {EMPLOYEE, name:'', age:0, salary:0.0}
Then, I can get one of those "things" named
EMPLOYEE like this:
b = {EMPLOYEE}
And IDL knows that b is that kind of a structure with
three fields, name, age, and salary and it knows how
those fields are defined. I don't have to reproduce
this information each time I make another EMPLOYEE
structure.
In general, use named structures for structures whose
fields are not likely to ever change. Use anonymous
structures for all the rest.
> It doesn't seem like the
> named structures are as versatile - you certainly
> can't destroy them and re-fill them with new
> information.
Anything that will be changing inside of a structure
should be implemented with a pointer, regardless of
whether you are using Named or Anonymous structures.
If done this way, "re-filling" them is not difficult
at all.
> Sometimes.. i just want to pinch IDL.
Humm. I don't think we want to bring up this subject
in *this* group. Please take this over to alt.comp.fetish. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Conflicting Data structures [message #16074 is a reply to message #15933] |
Tue, 29 June 1999 00:00  |
dfabian
Messages: 1 Registered: June 1999
|
Junior Member |
|
|
In article <37778EB0.2CE6EEAA@acsys.it>,
Nando Iavarone <f.iavarone@acsys.it> wrote:
>
> --------------94CC3193604DD96E7DB7AF78
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Dirk Fabian wrote:
>
>> Ideally, i would like the user (me) to be able
to choose a new data file, read it
>> in, and query it, but i keep get the
conflicting data structures error. Even
>> if i exit the program and rerun it, it seems
like that structure is still hanging
>> around. I can't figure out how or where to
zero it out! What am i missing?
>
> A few weeks ago I had a "Conflicting Data
structures". I tried to
> redefine a non anonymous structure. I had a file
with an header
> defining its dimension, and I use them to
allocate a structure array.
>
[Example snipped]
> To resolve the problem I had to use an anonymous
struct.
> --
> Nando Iavarone
>
This was it! I had defined the structure with a
name (i'm not sure why) and somehow that caused
the conflict. Can anyone tell me what the purpose
of having a named structure versus an anonymous
structure might be? It doesn't seem like the
named structures are as versatile - you certainly
can't destroy them and re-fill them with new
information.
Thanks much, Dirk
Sometimes.. i just want to pinch IDL.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
|
|
|
Re: Conflicting Data structures [message #16116 is a reply to message #15933] |
Mon, 28 June 1999 00:00  |
Nando Iavarone
Messages: 48 Registered: December 1998
|
Member |
|
|
<HTML>
Dirk Fabian wrote:
<BLOCKQUOTE TYPE=CITE>Ideally, i would like the user (me) to be able to
choose a new data file, read it
<BR>in, and query it, but i keep get the conflicting data structures error.
Even
<BR>if i exit the program and rerun it, it seems like that structure is
still hanging
<BR>around. I can't figure out how or where to zero it out!
What am i missing?</BLOCKQUOTE>
A few weeks ago I had a "Conflicting Data structures". I tried to
<BR>redefine a non anonymous structure. I had a file with an header
<BR>defining its dimension, and I use them to allocate a structure array.
<P>For example:
<P>pro try_struct__define
<BR> n = 5
<BR> struct = {try_struct, $
<BR>
a: findgen(n)}
<BR>end
<P>pro pippo
<BR> a = {try_struct}
<BR> help, /struct, a
<P> n = 6
<BR> b={try_struct, $
<BR> a: findgen(n)}
<BR>
<BR> help, /struct, b
<BR>end
<BR>
<P>To resolve the problem I had to use an anonymous struct.
<BR>pro pippo
<BR> n = 5
<BR> a = {$
<BR> a: findgen(n)}
<BR> help, /struct, a
<BR> n = 6
<BR> b={$
<BR> a: findgen(n)}
<BR> a={$
<BR> a: findgen(n)}
<BR> help, /struct, a,b
<BR>end
<PRE>--
Nando Iavarone
Advanced Computer System - SPACE DIVISION
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440968 (direct)
E-mail:
f.iavarone@acsys.it
FrdndVrn@altavista.net</PRE>
</HTML>
|
|
|