home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 28
/
amigaformatcd28.iso
/
-seriously_amiga-
/
programming
/
c
/
asap
/
memlist_.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-23
|
2KB
|
60 lines
/*****************************************************************************
* *
* ASAP - Amiga Software Authoring Platform *
* *
* Written by Laurie Perrin *
* *
* AMemList wrapper class *
* *
*****************************************************************************/
#ifndef ASAP_AMemList_H
#define ASAP_AMemList_H
#include <New.h>
extern "C"
{
#include <EXEC/Memory.h>
#include <Proto/EXEC.h>
}
template <unsigned int EntryCount>
class AMemList : public MemList
{
public:
LONG Entries[(EntryCount - 1) * 2];
inline AMemList * AllocEntry();
inline void * operator new(size_t, MemList *);
inline void FreeEntry();
inline void operator delete (void *);
};
//----------------------------------------------------------------------------
template <unsigned int EntryCount>
AMemList * AMemList<EntryCount>::AllocEntry ()
{
return (AMemList *) ::AllocEntry(this);
}
//----------------------------------------------------------------------------
template <unsigned int EntryCount>
void * AMemList<EntryCount>::operator new (size_t, MemList *entry)
{
return (AMemList *) ::AllocEntry(entry);
}
//----------------------------------------------------------------------------
template <unsigned int EntryCount>
void AMemList<EntryCount>::FreeEntry ()
{
::FreeEntry(this);
}
//----------------------------------------------------------------------------
template <unsigned int EntryCount>
void AMemList<EntryCount>::operator delete (void *entry)
{
((AMemList *) entry)->FreeEntry();
}
#endif