LibreOffice Module sw (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
SwCache Class Reference

#include <swcache.hxx>

Inheritance diagram for SwCache:
[legend]
Collaboration diagram for SwCache:
[legend]

Public Member Functions

 SwCache (const sal_uInt16 nInitSize, OString aNm)
 
 ~SwCache ()
 The dtor will free all objects still in the vector. More...
 
void Flush ()
 
SwCacheObjGet (const void *pOwner, const bool bToTop=true)
 
SwCacheObjGet (const void *pOwner, const sal_uInt16 nIndex, const bool bToTop=true)
 
void ToTop (SwCacheObj *pObj)
 
bool Insert (SwCacheObj *pNew, bool isDuplicateOwnerAllowed)
 
void Delete (const void *pOwner, sal_uInt16 nIndex)
 
void Delete (const void *pOwner)
 
void SetLRUOfst (const sal_uInt16 nOfst)
 Mark some entries as "do not delete". More...
 
void ResetLRUOfst ()
 
void IncreaseMax (const sal_uInt16 nAdd)
 
void DecreaseMax (const sal_uInt16 nSub)
 
sal_uInt16 GetCurMax () const
 
SwCacheObjFirst ()
 
SwCacheObjoperator[] (sal_uInt16 nIndex)
 
sal_uInt16 size ()
 

Static Public Member Functions

static SwCacheObjNext (SwCacheObj *pCacheObj)
 

Private Member Functions

void DeleteObj (SwCacheObj *pObj)
 
void Check ()
 number of cache size decreases More...
 

Private Attributes

std::vector< std::unique_ptr< SwCacheObj > > m_aCacheObjects
 
std::vector< sal_uInt16 > m_aFreePositions
 
SwCacheObjm_pRealFirst
 Free positions for the Insert if the maximum has not been reached Every time an object is deregistered, its position is added here. More...
 
SwCacheObjm_pFirst
 ALWAYS the real first LRU More...
 
SwCacheObjm_pLast
 The virtual first, only different to m_pRealFirst when SetLRUOfst has been called. More...
 
sal_uInt16 m_nCurMax
 
OString m_aName
 
tools::Long m_nAppend
 
tools::Long m_nInsertFree
 number of entries appended More...
 
tools::Long m_nReplace
 number of entries inserted on freed position More...
 
tools::Long m_nGetSuccess
 number of LRU replacements More...
 
tools::Long m_nGetFail
 
tools::Long m_nToTop
 
tools::Long m_nDelete
 number of reordering (LRU) More...
 
tools::Long m_nGetSeek
 number of explicit deletes More...
 
tools::Long m_nAverageSeekCnt
 number of gets without index More...
 
tools::Long m_nFlushCnt
 number of seeks for all gets without index More...
 
tools::Long m_nFlushedObjects
 number of flush calls More...
 
tools::Long m_nIncreaseMax
 
tools::Long m_nDecreaseMax
 number of cache size increases More...
 

Detailed Description

Definition at line 54 of file swcache.hxx.

Constructor & Destructor Documentation

◆ SwCache()

SwCache::SwCache ( const sal_uInt16  nInitSize,
OString  aNm 
)

Definition at line 77 of file swcache.cxx.

References m_aCacheObjects, and m_aName.

◆ ~SwCache()

SwCache::~SwCache ( )

The dtor will free all objects still in the vector.

Definition at line 106 of file swcache.cxx.

References Check(), m_aName, m_nAppend, m_nAverageSeekCnt, m_nDecreaseMax, m_nDelete, m_nFlushCnt, m_nFlushedObjects, m_nGetFail, m_nGetSeek, m_nGetSuccess, m_nIncreaseMax, m_nInsertFree, m_nReplace, m_nToTop, and SAL_INFO.

Member Function Documentation

◆ Check()

void SwCache::Check ( )
private

number of cache size decreases

Definition at line 30 of file swcache.cxx.

References SwCacheObj::GetNext(), SwCacheObj::GetPrev(), m_aFreePositions, m_nCurMax, m_pFirst, m_pLast, m_pRealFirst, SAL_WARN_IF, and size().

Referenced by ~SwCache().

◆ DecreaseMax()

void SwCache::DecreaseMax ( const sal_uInt16  nSub)

Definition at line 139 of file swcache.cxx.

References m_nCurMax, and m_nDecreaseMax.

Referenced by SwViewShell::~SwViewShell().

◆ Delete() [1/2]

void SwCache::Delete ( const void *  pOwner)

Definition at line 329 of file swcache.cxx.

References DeleteObj(), Get(), INCREMENT, m_nDelete, and pOwner.

◆ Delete() [2/2]

void SwCache::Delete ( const void *  pOwner,
sal_uInt16  nIndex 
)

◆ DeleteObj()

void SwCache::DeleteObj ( SwCacheObj pObj)
private

◆ First()

SwCacheObj * SwCache::First ( )
inline

Definition at line 117 of file swcache.hxx.

References m_pRealFirst.

Referenced by SwFntCache::First().

◆ Flush()

void SwCache::Flush ( void  )

◆ Get() [1/2]

SwCacheObj * SwCache::Get ( const void *  pOwner,
const bool  bToTop = true 
)

◆ Get() [2/2]

SwCacheObj * SwCache::Get ( const void *  pOwner,
const sal_uInt16  nIndex,
const bool  bToTop = true 
)

◆ GetCurMax()

sal_uInt16 SwCache::GetCurMax ( ) const
inline

Definition at line 116 of file swcache.hxx.

References m_nCurMax.

Referenced by SwSaveSetLRUOfst::SwSaveSetLRUOfst(), and SwViewShell::SwViewShell().

◆ IncreaseMax()

void SwCache::IncreaseMax ( const sal_uInt16  nAdd)

◆ Insert()

bool SwCache::Insert ( SwCacheObj pNew,
bool  isDuplicateOwnerAllowed 
)

◆ Next()

SwCacheObj * SwCache::Next ( SwCacheObj pCacheObj)
inlinestatic

Definition at line 224 of file swcache.hxx.

References SwCacheObj::GetNext().

Referenced by SwFntCache::Next().

◆ operator[]()

SwCacheObj * SwCache::operator[] ( sal_uInt16  nIndex)
inline

Definition at line 119 of file swcache.hxx.

References m_aCacheObjects, and nIndex.

◆ ResetLRUOfst()

void SwCache::ResetLRUOfst ( )
inline

Definition at line 112 of file swcache.hxx.

References m_pFirst, and m_pRealFirst.

Referenced by SwSaveSetLRUOfst::~SwSaveSetLRUOfst().

◆ SetLRUOfst()

void SwCache::SetLRUOfst ( const sal_uInt16  nOfst)

Mark some entries as "do not delete".

Parameters
nOfstdetermines how many are not to be touched

Definition at line 439 of file swcache.cxx.

References CHECK, SwCacheObj::GetNext(), i, m_aCacheObjects, m_aFreePositions, m_nCurMax, m_pFirst, and m_pRealFirst.

Referenced by SwSaveSetLRUOfst::SwSaveSetLRUOfst().

◆ size()

sal_uInt16 SwCache::size ( )
inline

Definition at line 120 of file swcache.hxx.

References m_aCacheObjects.

Referenced by Check().

◆ ToTop()

void SwCache::ToTop ( SwCacheObj pObj)

Member Data Documentation

◆ m_aCacheObjects

std::vector<std::unique_ptr<SwCacheObj> > SwCache::m_aCacheObjects
private

Definition at line 56 of file swcache.hxx.

Referenced by DeleteObj(), Flush(), Get(), Insert(), operator[](), SetLRUOfst(), size(), and SwCache().

◆ m_aFreePositions

std::vector<sal_uInt16> SwCache::m_aFreePositions
private

Definition at line 57 of file swcache.hxx.

Referenced by Check(), DeleteObj(), Flush(), Insert(), and SetLRUOfst().

◆ m_aName

OString SwCache::m_aName
private

Definition at line 68 of file swcache.hxx.

Referenced by ~SwCache().

◆ m_nAppend

tools::Long SwCache::m_nAppend
private

Definition at line 69 of file swcache.hxx.

Referenced by Insert(), and ~SwCache().

◆ m_nAverageSeekCnt

tools::Long SwCache::m_nAverageSeekCnt
private

number of gets without index

Definition at line 77 of file swcache.hxx.

Referenced by Get(), and ~SwCache().

◆ m_nCurMax

sal_uInt16 SwCache::m_nCurMax
private

Definition at line 63 of file swcache.hxx.

Referenced by Check(), DecreaseMax(), DeleteObj(), GetCurMax(), IncreaseMax(), Insert(), and SetLRUOfst().

◆ m_nDecreaseMax

tools::Long SwCache::m_nDecreaseMax
private

number of cache size increases

Definition at line 81 of file swcache.hxx.

Referenced by DecreaseMax(), and ~SwCache().

◆ m_nDelete

tools::Long SwCache::m_nDelete
private

number of reordering (LRU)

Definition at line 75 of file swcache.hxx.

Referenced by Delete(), and ~SwCache().

◆ m_nFlushCnt

tools::Long SwCache::m_nFlushCnt
private

number of seeks for all gets without index

Definition at line 78 of file swcache.hxx.

Referenced by Flush(), and ~SwCache().

◆ m_nFlushedObjects

tools::Long SwCache::m_nFlushedObjects
private

number of flush calls

Definition at line 79 of file swcache.hxx.

Referenced by Flush(), and ~SwCache().

◆ m_nGetFail

tools::Long SwCache::m_nGetFail
private

Definition at line 73 of file swcache.hxx.

Referenced by Get(), and ~SwCache().

◆ m_nGetSeek

tools::Long SwCache::m_nGetSeek
private

number of explicit deletes

Definition at line 76 of file swcache.hxx.

Referenced by Get(), and ~SwCache().

◆ m_nGetSuccess

tools::Long SwCache::m_nGetSuccess
private

number of LRU replacements

Definition at line 72 of file swcache.hxx.

Referenced by Get(), and ~SwCache().

◆ m_nIncreaseMax

tools::Long SwCache::m_nIncreaseMax
private

Definition at line 80 of file swcache.hxx.

Referenced by IncreaseMax(), and ~SwCache().

◆ m_nInsertFree

tools::Long SwCache::m_nInsertFree
private

number of entries appended

Definition at line 70 of file swcache.hxx.

Referenced by Insert(), and ~SwCache().

◆ m_nReplace

tools::Long SwCache::m_nReplace
private

number of entries inserted on freed position

Definition at line 71 of file swcache.hxx.

Referenced by Insert(), and ~SwCache().

◆ m_nToTop

tools::Long SwCache::m_nToTop
private

Definition at line 74 of file swcache.hxx.

Referenced by ToTop(), and ~SwCache().

◆ m_pFirst

SwCacheObj* SwCache::m_pFirst
private

ALWAYS the real first LRU

Definition at line 60 of file swcache.hxx.

Referenced by Check(), DeleteObj(), Flush(), Get(), Insert(), ResetLRUOfst(), SetLRUOfst(), and ToTop().

◆ m_pLast

SwCacheObj* SwCache::m_pLast
private

The virtual first, only different to m_pRealFirst when SetLRUOfst has been called.

Definition at line 61 of file swcache.hxx.

Referenced by Check(), DeleteObj(), Flush(), Insert(), and ToTop().

◆ m_pRealFirst

SwCacheObj* SwCache::m_pRealFirst
private

Free positions for the Insert if the maximum has not been reached Every time an object is deregistered, its position is added here.

Definition at line 59 of file swcache.hxx.

Referenced by Check(), DeleteObj(), First(), Flush(), Get(), Insert(), ResetLRUOfst(), SetLRUOfst(), and ToTop().


The documentation for this class was generated from the following files: