19#ifndef INCLUDED_SW_SOURCE_CORE_INC_SWCACHE_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_SWCACHE_HXX
49#include <rtl/string.hxx>
90 SwCache(
const sal_uInt16 nInitSize, OString aNm );
92 SwCache(
const sal_uInt16 nInitSize );
100 SwCacheObj *
Get(
const void *pOwner,
const bool bToTop =
true );
101 SwCacheObj *
Get(
const void *pOwner,
const sal_uInt16 nIndex,
102 const bool bToTop =
true );
106 void Delete(
const void * pOwner, sal_uInt16 nIndex);
107 void Delete(
const void *pOwner );
171 inline bool IsOwner(
const void *pNew )
const;
201 void Get_(
bool isDuplicateOwnerAllowed);
246 const sal_uInt16 nIndex ) :
262 Get_(isDuplicateOwnerAllowed);
Access class for the Cache.
void Get_(bool isDuplicateOwnerAllowed)
virtual SwCacheObj * NewObj()=0
Can be use in NewObj.
SwCacheAccess(SwCache &rCache, const void *pOwner, bool bSeek)
SwCacheObj * Get(bool isDuplicateOwnerAllowed)
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
void SetNext(SwCacheObj *pNew)
sal_uInt8 m_nLock
Position in the Cache array.
sal_uInt16 GetCachePos() const
const void * GetOwner() const
SwCacheObj(const void *pOwner)
SwCacheObj * m_pNext
Can do everything.
SwCacheObj * m_pPrev
For the LRU chaining.
bool IsOwner(const void *pNew) const
virtual void UpdateCachePos()
void SetPrev(SwCacheObj *pNew)
void SetCachePos(const sal_uInt16 nNew)
std::vector< sal_uInt16 > m_aFreePositions
bool Insert(SwCacheObj *pNew, bool isDuplicateOwnerAllowed)
tools::Long m_nFlushedObjects
number of flush calls
tools::Long m_nGetSeek
number of explicit deletes
tools::Long m_nReplace
number of entries inserted on freed position
void Delete(const void *pOwner, sal_uInt16 nIndex)
SwCacheObj * m_pLast
The virtual first, only different to m_pRealFirst when SetLRUOfst has been called.
tools::Long m_nFlushCnt
number of seeks for all gets without index
SwCacheObj * m_pFirst
ALWAYS the real first LRU
void ToTop(SwCacheObj *pObj)
sal_uInt16 GetCurMax() const
SwCache(const sal_uInt16 nInitSize, OString aNm)
void IncreaseMax(const sal_uInt16 nAdd)
std::vector< std::unique_ptr< SwCacheObj > > m_aCacheObjects
void DecreaseMax(const sal_uInt16 nSub)
tools::Long m_nAverageSeekCnt
number of gets without index
void Check()
number of cache size decreases
void SetLRUOfst(const sal_uInt16 nOfst)
Mark some entries as "do not delete".
void DeleteObj(SwCacheObj *pObj)
~SwCache()
The dtor will free all objects still in the vector.
tools::Long m_nDecreaseMax
number of cache size increases
tools::Long m_nGetSuccess
number of LRU replacements
SwCacheObj * Get(const void *pOwner, const bool bToTop=true)
tools::Long m_nDelete
number of reordering (LRU)
static SwCacheObj * Next(SwCacheObj *pCacheObj)
SwCacheObj * m_pRealFirst
Free positions for the Insert if the maximum has not been reached Every time an object is deregistere...
tools::Long m_nInsertFree
number of entries appended
SwCacheObj * operator[](sal_uInt16 nIndex)
tools::Long m_nIncreaseMax
Try to prevent visible SwParaPortions from being deleted.
SwSaveSetLRUOfst()
Prevent the SwParaPortions of the visible paragraphs from being deleted; they would just be recreated...
ContentProvider * m_pOwner