bmcquear++at++dw3f.ess.harris.com
Mon, 11 Sep 95 08:41:48 -0400
Lionel,
Here's one way to do it in 1.2 (excerpt from vrfly, which can be
found at sgigate++at++sgi.com). You can use this as a parent class to all of
your classes you want allocated from the arena, or you can overload the
operator in each class.
////////////////////////////////////////////
#ifndef __PFNEW__
#define __PFNEW__
#include <pf.h>
#include <stdlib.h>
class pfnew
{
public:
void * operator new(size_t);
void operator delete(void *);
};
#endif
///////////////////////////////////////////
#include "pfnew.h"
#include <pf.h>
void *
pfnew::operator new(size_t s)
{
void * buff = pfMalloc(s, pfGetSharedArena());
return buff;
}
void
pfnew::operator delete(void * p)
{
pfFree(p);
}
-----------------------------------------------------------
Bruce McQueary | Phone 407-984-5964 (Office)
Harris Corporation, ISD | 407-984-6813 (Lab)
P.O. Box 98000 | Fax 407-984-6323
W3-3207 | email: bmcquear++at++harris.com
Melbourne, FL 32902 |
-----------------------------------------------------------
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:52 PDT