ObjectCacheFIFO Class Reference

provides a FIFO cache replacement policy See also: class ObjectCache More...

#include <cachfifo.h>

Inheritance diagram for ObjectCacheFIFO:

ObjectCache CCObject SimpleCCObject List of all members.

Public Member Functions

 ObjectCacheFIFO ()
 default constructor for ObjectCacheFIFO. First contains the handle of the first object in the hash table. Note:
 ObjectCacheFIFO (UINT32 ceiling)
 constructor for ObjectCacheFIFO Note:
 ~ObjectCacheFIFO ()
 destructor for ObjectCache Note:

Protected Member Functions

virtual BOOL DeleteObject ()
 FIFO Cache replacement policy. Note:.

Protected Attributes

WORD m_first

Private Member Functions

 CC_DECLARE_DYNCREATE (ObjectCacheFIFO)

Detailed Description

provides a FIFO cache replacement policy See also: class ObjectCache

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/97

Definition at line 118 of file cachfifo.h.


Constructor & Destructor Documentation

ObjectCacheFIFO::ObjectCacheFIFO  ) 
 

default constructor for ObjectCacheFIFO. First contains the handle of the first object in the hash table. Note:

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/97
See also:

Definition at line 128 of file cachfifo.cpp.

00129 {
00130     m_Ceiling = 0;
00131     m_first = 1;
00132 }

ObjectCacheFIFO::ObjectCacheFIFO UINT32  ceiling  ) 
 

constructor for ObjectCacheFIFO Note:

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/97
Parameters:
ceiling,: max size of available memory for the cache [INPUTS]
See also:

Definition at line 145 of file cachfifo.cpp.

00146 {
00147     m_first = 1;
00148     m_Ceiling = ceiling;
00149 }

ObjectCacheFIFO::~ObjectCacheFIFO  ) 
 

destructor for ObjectCache Note:

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/97
See also:

Definition at line 161 of file cachfifo.cpp.

00162 {
00163 }


Member Function Documentation

ObjectCacheFIFO::CC_DECLARE_DYNCREATE ObjectCacheFIFO   )  [private]
 

BOOL ObjectCacheFIFO::DeleteObject  )  [protected, virtual]
 

FIFO Cache replacement policy. Note:.

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/97 Return: TRUE if success (an object is deleted), FALSE otherwise.
See also:

Reimplemented from ObjectCache.

Definition at line 178 of file cachfifo.cpp.

00179 {
00180     CachedObject* pObj = NULL;
00181 
00182     if (m_NumObjects == 0)
00183         return FALSE;
00184 
00185     WORD hObj = m_first;                    // First element in the hash table, 
00186                                             // corresponds to the first generated handle.
00187     pObj = LookUp(hObj);
00188     BOOL ok = (pObj != NULL);
00189 
00190     if (ok)
00191     {
00192         Remove(hObj);                       // remove from the hash table
00193         m_NumObjects--;                     // decrease the number of objects
00194         m_CurrentSize -= pObj->GetSize();   // decrease the used space of cache
00195 
00196         delete pObj;
00197         pObj = NULL;
00198 
00199         if (m_NumObjects >= 1)
00200             m_first++;
00201 
00202         return TRUE;
00203     }
00204 
00205     return FALSE;
00206 }


Member Data Documentation

WORD ObjectCacheFIFO::m_first [protected]
 

Definition at line 130 of file cachfifo.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:16 2007 for Camelot by  doxygen 1.4.4