class SwCache
{
std::vector<std::unique_ptr<SwCacheObj>> m_aCacheObjects;
std::vector<sal_uInt16> m_aFreePositions; /// Free positions for the Insert if the maximum has not been reached /// Every time an object is deregistered, its position is added here
SwCacheObj *m_pRealFirst; /// _ALWAYS_ the real first LRU
SwCacheObj *m_pFirst; /// The virtual first, only different to m_pRealFirst when SetLRUOfst has been called
SwCacheObj *m_pLast;
sal_uInt16 m_nCurMax; // Maximum of accepted objects
void DeleteObj( SwCacheObj *pObj );
#ifdef DBG_UTIL
OString m_aName;
tools::Long m_nAppend; /// number of entries appended
tools::Long m_nInsertFree; /// number of entries inserted on freed position
tools::Long m_nReplace; /// number of LRU replacements
tools::Long m_nGetSuccess;
tools::Long m_nGetFail;
tools::Long m_nToTop; /// number of reordering (LRU)
tools::Long m_nDelete; /// number of explicit deletes
tools::Long m_nGetSeek; /// number of gets without index
tools::Long m_nAverageSeekCnt; /// number of seeks for all gets without index
tools::Long m_nFlushCnt; /// number of flush calls
tools::Long m_nFlushedObjects;
tools::Long m_nIncreaseMax; /// number of cache size increases
tools::Long m_nDecreaseMax; /// number of cache size decreases
void Check(); #endif
public:
// Only add sal_uInt8!!! #ifdef DBG_UTIL
SwCache( const sal_uInt16 nInitSize, OString aNm ); #else
SwCache( const sal_uInt16 nInitSize ); #endif /// The dtor will free all objects still in the vector
~SwCache();
/// Mark some entries as "do not delete" /// @param nOfst determines how many are not to be touched void SetLRUOfst( const sal_uInt16 nOfst ); void ResetLRUOfst() { m_pFirst = m_pRealFirst; }
/// Try to prevent visible SwParaPortions from being deleted. class SwSaveSetLRUOfst
{ public:
SwSaveSetLRUOfst();
~SwSaveSetLRUOfst();
};
/** *TheCacheobjectbaseclass *UsersoftheCachemustderiveaclassfromtheSwCacheObjandstore *theirpayloadthere
*/ class SwCacheObj
{ friendclass SwCache; /// Can do everything
SwCacheObj *m_pNext; /// For the LRU chaining
SwCacheObj *m_pPrev;
sal_uInt16 m_nCachePos; /// Position in the Cache array
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.