Pete Willemsen (pete-willemsen++at++uiowa.edu)
Thu, 25 Jun 1998 21:55:45 -0500
class ShmObject {
public:
void* operator new(size_t size);
void operator delete(void*);
};
void* ShmObject::operator new(size_t size)
{
// allocate the necessary memory from wherever
}
void ShmObject::operator delete(void* mem_ptr)
{
// deallocate the shared memory
}
then, your real object is derived as such
public RealSimObject : public ShmObject {
public:
....
};
By deriving your "Sim" object from the ShmObject, you will overload the new
and delete operators. You need only manage the memory however you wish.
Pete
At 07:30 PM 6/25/98 -0400, you wrote:
>
>I need to create some variables of a class that I created, however I need
the structure to be allocated from the shared memory arena. I tried using
pfMalloc but if I do, I cannot call the variable's constructor. Ideally I'd
like to overload new so that I can pass the arena to it as a parameter. My
C++ book says that this can be done however it does not tell how. Does
anyone know how to do this? If so any help would be appreciated. Thanks.
>
> Ken
> Sewell++at++siscom.net
>ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
>List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
>
Pete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pete Willemsen <pete-willemsen++at++uiowa.edu>
http://www.cs.uiowa.edu/~willemsn
Dept. of Computer Science, Univ. of Iowa
===================================List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:35 PDT