comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » STRUCT_ASSIGN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
STRUCT_ASSIGN [message #12622] Sat, 22 August 1998 00:00
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
Hi all,


I have a structure defined as follows:

a = { f1: 0, f2: { x: 0, y: 0}}

I want to initialize the substructure f2
in a subroutine by having an instance of the f2
structure, then copying it field-by-field to
a.f2. STRUCT_ASSIGN seemed ideal for this,
except one problem - it doesn't work :-)

Assuming I have initialized an instance of
f2 (called data) with some values

data = {x: 10, y: 20}

the statement is

STRUCT_ASSIGN, data, a.f2

This fails with the error

% STRUCT_ASSIGN: Expression must be named variable
in this context: <STRUCT Array[1]>.

because a.f2 is an <Expression>, not a "named variable".
So, must I resort to field-by-field copy? The problem
is that "a" is actually an object ("self"), which has
some member variables that are large structures.
A field-by-field copy would be tedious, as each
structure has on the order of 30 fields, or so.
I wanted to write a generic "set" method that will
initialize the object's structures with some data.
If I must do a field-by-field copy, I would then
have to have several "set" methods, each of which is
specialized for each of the different stuctures
within the object.


Regards,

-bob m.


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code ES 84
Work: http://crazyhorse.msfc.nasa.gov/ Marshall Space Flight Center
Play: http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
[Message index]
 
Read Message
Previous Topic: [Q] Reading compressed TIFF image?
Next Topic: Re: STRUCT_ASSIGN

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:10:57 PDT 2025

Total time taken to generate the page: 0.16226 seconds