Re: array of pfDCS (CORRECTION - again)

New Message Reply Date view Thread view Subject view Author view

Scott McMillan (scott++at++ht.com)
Fri, 11 Jul 1997 12:28:56 -0400 (EDT)


>
> Hi!
>
> I had similar problem as the original poster of the question.
> As you showed, I wrote codes that make pfSwitch array.
> But I got compile error and cannot figure out how to fix it.
> Can you tell me what I am missing?
>
> Thank you in advance.
>
> Byungsung Cho
> rtv++at++bbs.para.co.kr
>
> --------------------------------------------
> My code looks like below:
>
> // Make switch array
> pfSwitch **sw;
> sw = new( pfGetSharedArena() ) pfSwitch * [numEvents];
> for ( i = 0; i < numEvents; i++ )
> sw[i] = new pfSwitch();
>
> And, error message when compiled:
>
> making OpenGL DSO version of suri
> /usr/bin/CC -DIRIX6 -I.. -I../../common
> -I../../../../../../usr/include/ -nostdinc -I/usr/include/CC
> -I/usr/include -mips2 -o32 -O -MDupdate Makedepend -c ../srScene.C
> "../srScene.C", line 1428: error(3464): no instance of overloaded
> "operator new" matches these operands
> sw = new( pfGetSharedArena() ) pfSwitch * [numEvents];
> ^
>
> 1 error detected in the compilation of "../srScene.C".
> *** Error code 1
> smake: Error: 1 error
> *** Error code 2

My bad, I thought I understood the overloaded new in pfObject (my C++ is
apparently not even that good). Try this (I know it will
compile... honest... I tried it myself this time):

    // Make switch array
    int num_events = 10;
    pfSwitch **sw = (pfSwitch **) pfMalloc(num_events*sizeof(pfSwitch *),
                                           pfGetSharedArena()) ;
    for (int i = 0; i < num_events; i++ )
        sw[i] = new pfSwitch();

At this point I start getting paranoid about C++ and shared arena stuff, and
start wondering if the sw variable should be in the shared arena as well. I
do this by putting sw in a struct that is allocated from the shared arena.

So can someone out there tell me if and how to use the new operators in
pfObject. Note that the man pages for libpr classes list both new functions
(including the one where you can specify an arena). On the other hand, libpf
classes inherit from pfUpdatable which in turn inherets from pfObject, but
the man pages only list one new operator which is actually specified in
pfUpdatable (as well as pfObject)....does the override of one new operator in
pfUpdatable hide both new operators in pfObject?

Thanks in advance,
scott

-- 
  Scott McMillan  |    HT Medical, Inc.   | Developing medical VE's
   scott++at++ht.com   |   http://www.ht.com   | surgical simulations
 Ph: 301-984-3706 |6001 Montrose Rd., #902| and surgery simulation
Fax: 301-984-2104 |  Rockville, MD 20852  | creation tools.

"It's just like having your computer screen lock up on you when you're using Microsoft Word. You have to hit the reset button."

-- Matt Wallace, NASA Rover Coordinator, on the solution to the modem problems on Sojourner in The Seattle Times July 6 1997. ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:36 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.