102 lines
2.9 KiB
C++
102 lines
2.9 KiB
C++
// File name: $Workfile: ser_alloc.h $
|
|
// Last modified: $Modtime: 2/09/98 12:08p $
|
|
// Last modified by: $Author: Rob $
|
|
//
|
|
// VCS archive path: $Archive: /Hank/DMM/FirmWare/Level3/ObDatMgr/ser_alloc.h $
|
|
// VCS revision: $Revision: 3 $
|
|
|
|
#ifndef PQALLOC_INC
|
|
#define PQALLOC_INC
|
|
|
|
//#define bool short
|
|
//#define DWORD unsigned long
|
|
//#define TRUE 1
|
|
//#define FALSE 0
|
|
|
|
struct MemNode;
|
|
class PQAlloc
|
|
{
|
|
private:
|
|
void LinkIn (void * obj, size_t siz);
|
|
int LinkOut(void * obj);
|
|
|
|
MemNode * pmemFirst;
|
|
MemNode * pmemLast;
|
|
|
|
protected:
|
|
public:
|
|
PQAlloc();
|
|
~PQAlloc();
|
|
|
|
void Initialize();
|
|
void Reinitialize(long offset = 0L);
|
|
|
|
bool bShowMessage;
|
|
long lMemTotal; // Total size of objects managed in allocator
|
|
|
|
long idxFilePosition; // next available position in pseudo file
|
|
long idxOffset; // Offset to be added to the idx
|
|
// parameter returned by allocate
|
|
// Used to allow resetting allocators
|
|
// but return correct file offset
|
|
|
|
void *allocate(size_t siz);
|
|
void *allocate(size_t siz, long &idx);
|
|
|
|
// Routines to add specific PQDIF elements
|
|
c_collection_element * addCollection
|
|
(
|
|
UINT4 count,
|
|
long & idx,
|
|
SIZE4& size
|
|
);
|
|
c_collection_element * addCollection
|
|
(
|
|
UINT4 count,
|
|
long & idx,
|
|
SIZE4& size,
|
|
const GUID& tag,
|
|
c_collection_element& ce
|
|
);
|
|
bool addScalarValue
|
|
(
|
|
long typePhysical,
|
|
PQDIFValue value,
|
|
long & idx,
|
|
SIZE4& size,
|
|
const GUID& tag,
|
|
c_collection_element& ce
|
|
);
|
|
bool addVectorValue
|
|
(
|
|
long typePhysical,
|
|
long count,
|
|
BYTE * values,
|
|
long & idx,
|
|
SIZE4& size,
|
|
const GUID & tag,
|
|
c_collection_element& ce
|
|
);
|
|
|
|
static bool convertValue
|
|
(
|
|
long typePhysical,
|
|
PQDIFValue value,
|
|
BYTE * pdata
|
|
);
|
|
|
|
void deallocate(void * obj);
|
|
|
|
long WriteListToFile(FILE *pf);
|
|
long WriteListToStream( CPQDIF_StreamIO *pf );
|
|
|
|
void WalkList();
|
|
void DestroyList();
|
|
|
|
};
|
|
|
|
//extern int cdecl AuxPrint (char *szFormat,...);
|
|
//extern int cdecl DebugPrint (char *szFormat,...);
|
|
|
|
#endif
|