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

Home » Public Forums » archive » Re: Object as a member to object/class
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Object as a member to object/class [message #58698 is a reply to message #58696] Tue, 12 February 2008 14:10 Go to previous messageGo to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Feb 12, 3:45 pm, Sven Utcke <utcke+n...@informatik.uni-hamburg.de>
wrote:
> Hi,
>
> I'm plainly too stupid for the following: I would like to have an
> object as a member to a second class. I.e. I have something like
> this:
>
> PRO MODBUS__DEFINE
> struct = { MODBUS, Host:"hasgkssccdkal.desy.de", Port:502, tid:0L }
> END
>
> and, later on,
>
> PRO GKSSBC__DEFINE
> struct = { GKSSBC, Con:Obj_New(), addr:'4020'XL, Factor:1.0, Steps:200, Micro:6 }
> END
>
> Now, I would _like_ to do something like
>
> FUNCTION GKSSBC::INIT, addr = addr, factor = factor, con = con
> IF KEYWORD_SET(addr) THEN self.Addr = addr ELSE self.Addr = '4020'XL
> IF KEYWORD_SET(factor) THEN self.Factor = factor ELSE self.Factor = 1.0
> IF KEYWORD_SET(con) THEN self.Con = con ELSE self.Con = obj_new("modbus")
> return, 1
> END
>
> But even just doing
>
> FUNCTION GKSSBC::INIT
> self.Con = obj_new("modbus")
> return, 1
> END
>
> does't wor at all in IDL 6.4 (it results in something like:
>
> % Object reference expression not allowed in this context: <OBJREF
> (<ObjHeapVar38(MODBUS)>)>.
> % Execution halted at: GKSSBC::INIT 13
> /afs/desy.de/user/u/utcke/src/Modbus/gkss9100C.pro
> % OBJ_NEW
> % $MAIN$
>
> So how does this _really_ work?

Hi,

No such thing as too stupid. Learning curves can be twisted, that's
all. My first thought is that MODBUS does not have an MODBUS::INIT
method since you don't show it. Can you successfully instantiate a
MODBUS object on its own? Like...

IDL> obj = OBJ_NEW("MODBUS")

On a different note, you might find it fruitful to look at David
Fanning's excellent description of when to use KEYWORD_SET vs.
N_ELEMENTS. http://www.dfanning.com/tips/keyword_check.html

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLVM arguments
Next Topic: Using callable IDL from a Qt application

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

Current Time: Sat Oct 11 21:35:59 PDT 2025

Total time taken to generate the page: 1.68174 seconds