Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!apollo!mrst!sdti!turner From: turner@sdti.SDTI.COM (Prescott K. Turner) Newsgroups: comp.lang.c++ Subject: Re: Objects and Shared Memory Summary: surrogate solution problematic Message-ID: <448@sdti.SDTI.COM> Date: 11 Apr 89 22:17:00 GMT References: <5462@cbnews.ATT.COM> <9171@alice.UUCP> Reply-To: turner@sdti.UUCP (0006-Prescott K. Turner, Jr.) Organization: Software Development Technologies, Sudbury MA Lines: 31 In article <9171@alice.UUCP> shopiro@alice.UUCP (Jonathan Shopiro) writes: >I think the best way to deal with data in shared memory is with >what I like to call ``surrogates.'' ... > >If you can't have real pointers in shared memory because of address >mapping considerations, it is simple to put whatever transformations >are necessary between the data in Actual_shared_data and regular >pointers into access functions in Shared_data. Shared_data can also >have whatever virtual functions are appropriate. At SDTI we have been dealing with a similar problem using a "surrogate" solution. Our most significant objects go in the memory which can't have real pointers. Even though Shared_data can have virtual functions, and can refer to the Actual_shared_data object, it will behave according to how the Shared_data object was constructed, not according to how the Actual_shared_data object was constructed. This has been so restrictive that I wonder if I'm getting any experience with real object-oriented design in my area of application. I've been tempted to hack at Shared_data's constructors. When a Shared_data object is constructed which refers to a pre-existing Actual_shared_data object, the underlying vtbl pointer of the constructed Shared_data object would be modified. It would then refer to the class derived from Shared_data which corresponds correctly to the Actual_share_data object. Anyone care to comment on the level of danger of such a hack? -- Prescott K. Turner, Jr. Software Development Technologies, Inc. P.O. Box 366, Sudbury, MA 01776 USA (508) 443-5779 UUCP: ...{harvard,mit-eddie}!sdti!turner Internet: turner@sdti.sdti.com