Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CDPA Class Reference

#include <list.h>

Inheritance diagram for CDPA:

CControlList CEdgeCache CEdgeList List of all members.

Public Member Functions

int GetCount ()
 CDPA ()
 ~CDPA ()
BOOL Append (LPVOID)
LPVOID GetPointer (int iItem) const
void Remove (int iItem)

Protected Member Functions

int GetNextFree () const

Private Member Functions

int GetAllocated () const
void SetAllocated (int i)
void SetNextFree (int i)
void FAR *FAR * GetData () const
void SetData (void FAR *FAR *pD)
HANDLE GetHeap () const
void SetHeap (HANDLE h)

Private Attributes

int m_iAllocated
int m_iCurrentTop
void FAR *FAR * m_pData
HANDLE m_Heap

Constructor & Destructor Documentation

CDPA::CDPA  ) 
 

Definition at line 13 of file list.cpp.

References NULL.

00014 : m_iAllocated(0), 00015 m_iCurrentTop(0), 00016 m_pData(NULL), 00017 m_Heap(NULL) //Allocate from global heap. 00018 { 00019 }

CDPA::~CDPA  ) 
 

Definition at line 21 of file list.cpp.

References GetData(), GetHeap(), GetPointer(), and LPVOID.

00022 { 00023 LPVOID lpV; 00024 int i=0; 00025 while( lpV=GetPointer(i++) ) 00026 delete lpV; 00027 00028 // 00029 // BugBug - you must delete all the data that we allocated in the list 00030 // 00031 if(GetData()) 00032 HeapFree(GetHeap(), 0, GetData()); 00033 }


Member Function Documentation

BOOL CDPA::Append LPVOID   ) 
 

Definition at line 40 of file list.cpp.

References Append(), BOOL, FALSE, FAR, GetAllocated(), GetData(), GetHeap(), GetNextFree(), LPVOID, SetAllocated(), SetData(), SetHeap(), SetNextFree(), and TRUE.

Referenced by Append(), CGuide::Attatch(), CEdge::Attatch(), and CResizeDlg::FindControls().

00041 { 00042 if(GetNextFree()==GetAllocated()) 00043 { 00044 int iNewSize = GetAllocated()+32; // Grow in 32 allocations; 00045 void FAR * FAR * ppNew; 00046 00047 if(GetData()) 00048 ppNew = (void FAR * FAR *)HeapReAlloc(GetHeap(), HEAP_ZERO_MEMORY, GetData(), iNewSize * sizeof(LPVOID)); 00049 else 00050 { 00051 if(!GetHeap()) 00052 SetHeap(HeapCreate(0,0x4000,0)); 00053 ppNew = (void FAR * FAR *)HeapAlloc(GetHeap(), HEAP_ZERO_MEMORY, iNewSize * sizeof(LPVOID)); 00054 } 00055 00056 SetData(ppNew); 00057 if(ppNew) 00058 { 00059 SetAllocated(iNewSize); 00060 } 00061 else 00062 return FALSE; 00063 } 00064 00065 *(GetData()+GetNextFree())=lpData; 00066 SetNextFree(GetNextFree()+1); 00067 return TRUE; 00068 }

int CDPA::GetAllocated  )  const [inline, private]
 

Definition at line 26 of file list.h.

References m_iAllocated.

Referenced by Append(), GetPointer(), and Remove().

00026 {return m_iAllocated;}

int CDPA::GetCount  ) 
 

Definition at line 82 of file list.cpp.

References GetNextFree().

00083 { 00084 return GetNextFree(); 00085 }

void FAR* FAR* CDPA::GetData  )  const [inline, private]
 

Definition at line 31 of file list.h.

References FAR, and m_pData.

Referenced by Append(), GetPointer(), Remove(), and ~CDPA().

00031 { return m_pData; };

HANDLE CDPA::GetHeap  )  const [inline, private]
 

Definition at line 34 of file list.h.

References m_Heap.

Referenced by Append(), and ~CDPA().

00034 { return m_Heap; }

int CDPA::GetNextFree  )  const [inline, protected]
 

Definition at line 23 of file list.h.

References m_iCurrentTop.

Referenced by Append(), CControlList::GetControlCount(), GetCount(), and CEdgeList::GetEdgeCount().

00023 { return m_iCurrentTop; }

LPVOID CDPA::GetPointer int  iItem  )  const
 

Definition at line 74 of file list.cpp.

References GetAllocated(), GetData(), GetPointer(), LPVOID, and NULL.

Referenced by GetPointer(), CResizeDlg::PlaceControls(), CScaleDlg::ResizeControls(), CResizeDlg::ResizeControls(), CResizeDlg::SpecialRowCol(), and ~CDPA().

00075 { 00076 if(GetData()) 00077 if(iItem<GetAllocated()) // mCurrentTop is not active. 00078 return *(GetData()+iItem); 00079 return NULL; 00080 }

void CDPA::Remove int  iItem  ) 
 

Definition at line 87 of file list.cpp.

References GetAllocated(), GetData(), NULL, and Remove().

Referenced by CGuide::DeAttatch(), and Remove().

00088 { 00089 if(GetData()) 00090 if(iItem<GetAllocated()) // mCurrentTop is not active. 00091 *(GetData()+iItem)=NULL; 00092 }

void CDPA::SetAllocated int  i  )  [inline, private]
 

Definition at line 27 of file list.h.

References m_iAllocated, and SetAllocated().

Referenced by Append(), and SetAllocated().

00027 { m_iAllocated=i; }

void CDPA::SetData void FAR *FAR *  pD  )  [inline, private]
 

Definition at line 32 of file list.h.

References m_pData, and SetData().

Referenced by Append(), and SetData().

00032 { m_pData=pD; }

void CDPA::SetHeap HANDLE  h  )  [inline, private]
 

Definition at line 35 of file list.h.

References m_Heap, and SetHeap().

Referenced by Append(), and SetHeap().

00035 { m_Heap = h; }

void CDPA::SetNextFree int  i  )  [inline, private]
 

Definition at line 29 of file list.h.

References m_iCurrentTop, and SetNextFree().

Referenced by Append(), and SetNextFree().

00029 { m_iCurrentTop=i; }


Member Data Documentation

HANDLE CDPA::m_Heap [private]
 

Definition at line 40 of file list.h.

Referenced by GetHeap(), and SetHeap().

int CDPA::m_iAllocated [private]
 

Definition at line 37 of file list.h.

Referenced by GetAllocated(), and SetAllocated().

int CDPA::m_iCurrentTop [private]
 

Definition at line 38 of file list.h.

Referenced by GetNextFree(), and SetNextFree().

void FAR* FAR* CDPA::m_pData [private]
 

Definition at line 39 of file list.h.

Referenced by GetData(), and SetData().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:27 2004 for test by doxygen 1.3.7