Re: Direct access to members in C++API ?

New Message Reply Date view Thread view Subject view Author view

Steve Baker (sbaker++at++link.com)
Thu, 16 Oct 1997 15:10:33 -0500 (CDT)


On Thu, 16 Oct 1997, Lionel Maiaux wrote:

> Hi,
>
> Are there some good reasons not to have given direct access to members
> of Performer C++API classes (reasons more important than performance!)
>
> 2 examples:
>
> 1) the only way to access the pfPlanes of a pfPolytope (without a copy)
> is to subclass it (the "facets" member is protected),

> 2) there is no way to access the culling pfPolytopes of a pfChannel
> (without a copy) (the "cullVol" and "nomCullVol" members are privates).

What's wrong with:

       int pfPolytope::getFacet(int i, pfPlane *facet);
and
       void pfChannel::getPtope(pfPolytope *ptope);

???

I understand that you'd like to avoid a copy - but if the channel object
gave you the address of the pfPolytope then you'd be able to *write* to
it without pfChannel knowing that you'd done that - if the channel caches
other information related to the Polytope (or more likely - passes it on
to daughter processes in a mp-safe manner) then the fact that you could
change it at any time *might* be a very bad thing.

Hence it's a private/protected member to be on the safe side.

Since you say that you need this access for reasons *other* than
performance - and a copy is for some reason no use to you - then it seems
like it must be that you were planning just such a dangerous access
and the protection afforded by the pfChannel class was warranted.

Steve Baker 817-619-8776 (Vox/Vox-Mail)
Hughes Training Inc. 817-619-4028 (Fax)
2200 Arlington Downs Road SBaker++at++link.com (eMail)
Arlington, Texas. TX 76005-6171 SJBaker1++at++airmail.net (Personal eMail)
http://www.hti.com http://web2.airmail.net/sjbaker1 (personal)

** Beware of Geeks bearing GIF's. **

=======================================================================
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:56:05 PDT

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