• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/serialization

  • KDevelop
  • Bucket
Public Types | Public Member Functions | List of all members
KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize > Class Template Reference

#include <itemrepository.h>

Public Types

enum  { AdditionalSpacePerItem = 2 }
 
enum  {
  ObjectMapSize = ((ItemRepositoryBucketSize / ItemRequest::AverageSize) * 3) / 2 + 1, MaxFreeItemsForHide = 0, MaxFreeSizeForHide = fixedItemSize ? fixedItemSize : 0, MinFreeItemsForReuse = 10,
  MinFreeSizeForReuse = ItemRepositoryBucketSize / 20
}
 
enum  { NextBucketHashSize = ObjectMapSize, DataSize }
 
enum  { CheckStart = 0xff00ff1, CheckEnd = 0xfafcfb }
 

Public Member Functions

 Bucket ()
 
 ~Bucket ()
 
uint available () const
 
bool canAllocateItem (unsigned int size) const
 
bool changed () const
 
void countFollowerIndexLengths (uint &usedSlots, uint &lengths, uint &slotCount, uint &longestInBucketFollowerChain)
 
char * data ()
 
uint dataSize () const
 
template<class Repository >
void deleteItem (unsigned short index, unsigned int hash, Repository &repository)
 
bool dirty () const
 
template<class Repository >
int finalCleanup (Repository &repository)
 
unsigned short findIndex (const ItemRequest &request) const
 
uint freeItemCount () const
 
bool hasClashingItem (uint hash, uint modulo)
 
unsigned short index (const ItemRequest &request, unsigned int itemSize)
 
void initialize (int monsterBucketExtent)
 
void initializeFromMap (char *current)
 
bool isEmpty () const
 
const Item * itemFromIndex (unsigned short index) const
 
bool itemReachable (const Item *item, uint hash) const
 
short unsigned int largestFreeSize () const
 
int lastUsed () const
 
uint lostSpace ()
 
int monsterBucketExtent () const
 
unsigned short nextBucketForHash (uint hash) const
 
bool noNextBuckets () const
 
void prepareChange ()
 
template<class T >
void readValue (char *&from, T &to)
 
void setNextBucketForHash (unsigned int hash, unsigned short bucket)
 
void store (QFile *file, size_t offset)
 
void tick () const
 
short unsigned int totalFreeItemsSize () const
 
uint usedMemory () const
 
template<class Visitor >
bool visitAllItems (Visitor &visitor) const
 

Detailed Description

template<class Item, class ItemRequest, bool markForReferenceCounting, uint fixedItemSize>
class KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >

Buckets are the memory-units that are used to store the data in an ItemRepository.

About monster buckets: Normally a bucket has a size of 64kb, but when an item is allocated that is larger than that, a "monster bucket" is allocated, which spans the space of multiple buckets.

Definition at line 109 of file itemrepository.h.

Member Enumeration Documentation

◆ anonymous enum

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
anonymous enum
Enumerator
AdditionalSpacePerItem 

Definition at line 112 of file itemrepository.h.

◆ anonymous enum

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
anonymous enum
Enumerator
ObjectMapSize 
MaxFreeItemsForHide 
MaxFreeSizeForHide 
MinFreeItemsForReuse 
MinFreeSizeForReuse 

Definition at line 115 of file itemrepository.h.

◆ anonymous enum

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
anonymous enum
Enumerator
NextBucketHashSize 
DataSize 

Definition at line 122 of file itemrepository.h.

◆ anonymous enum

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
anonymous enum
Enumerator
CheckStart 
CheckEnd 

Definition at line 127 of file itemrepository.h.

Constructor & Destructor Documentation

◆ Bucket()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::Bucket ( )
inline

Definition at line 131 of file itemrepository.h.

◆ ~Bucket()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::~Bucket ( )
inline

Definition at line 134 of file itemrepository.h.

Member Function Documentation

◆ available()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
uint KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::available ( ) const
inline

Definition at line 635 of file itemrepository.h.

◆ canAllocateItem()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::canAllocateItem ( unsigned int  size) const
inline

Definition at line 738 of file itemrepository.h.

◆ changed()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::changed ( ) const
inline

Definition at line 766 of file itemrepository.h.

◆ countFollowerIndexLengths()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::countFollowerIndexLengths ( uint &  usedSlots,
uint &  lengths,
uint &  slotCount,
uint &  longestInBucketFollowerChain 
)
inline

Definition at line 483 of file itemrepository.h.

◆ data()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
char* KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::data ( )
inline

Definition at line 259 of file itemrepository.h.

◆ dataSize()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
uint KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::dataSize ( ) const
inline

Definition at line 264 of file itemrepository.h.

◆ deleteItem()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
template<class Repository >
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::deleteItem ( unsigned short  index,
unsigned int  hash,
Repository &  repository 
)
inline

This is a monster-bucket. Make it completely empty again.

Put the space into the free-set

Definition at line 523 of file itemrepository.h.

◆ dirty()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::dirty ( ) const
inline

Definition at line 778 of file itemrepository.h.

◆ finalCleanup()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
template<class Repository >
int KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::finalCleanup ( Repository &  repository)
inline

Returns whether something was changed.

Definition at line 667 of file itemrepository.h.

◆ findIndex()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
unsigned short KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::findIndex ( const ItemRequest &  request) const
inline

Definition at line 270 of file itemrepository.h.

◆ freeItemCount()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
uint KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::freeItemCount ( ) const
inline

Definition at line 709 of file itemrepository.h.

◆ hasClashingItem()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::hasClashingItem ( uint  hash,
uint  modulo 
)
inline
Parameters
moduloReturns whether this bucket contains an item with (hash % modulo) == (item.hash % modulo) The default-parameter is the size of the next-bucket hash that is used by setNextBucketForHash and nextBucketForHash
Note
modulo MUST be a multiple of ObjectMapSize, because (b-a) | (x * h1) => (b-a) | h2, where a|b means a is a multiple of b. This allows efficiently computing the clashes using the local object map hash.

Definition at line 458 of file itemrepository.h.

◆ index()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
unsigned short KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::index ( const ItemRequest &  request,
unsigned int  itemSize 
)
inline

This is a monster-bucket. Other rules are applied here. Only one item can be allocated, and that must be bigger than the bucket data

Todo:
Achieve this without full iteration

Definition at line 291 of file itemrepository.h.

◆ initialize()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::initialize ( int  monsterBucketExtent)
inline

Definition at line 143 of file itemrepository.h.

◆ initializeFromMap()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::initializeFromMap ( char *  current)
inline

Definition at line 170 of file itemrepository.h.

◆ isEmpty()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::isEmpty ( ) const
inline

Definition at line 620 of file itemrepository.h.

◆ itemFromIndex()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
const Item* KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::itemFromIndex ( unsigned short  index) const
inline
Warning
The returned item may be in write-protected memory, so never try doing a const_cast and changing some data If you need to change something, use dynamicItemFromIndex
When using multi-threading, mutex() must be locked as long as you use the returned data

Definition at line 614 of file itemrepository.h.

◆ itemReachable()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::itemReachable ( const Item *  item,
uint  hash 
) const
inline

Definition at line 508 of file itemrepository.h.

◆ largestFreeSize()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
short unsigned int KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::largestFreeSize ( ) const
inline

Definition at line 726 of file itemrepository.h.

◆ lastUsed()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
int KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::lastUsed ( ) const
inline

Definition at line 760 of file itemrepository.h.

◆ lostSpace()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
uint KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::lostSpace ( )
inline

Definition at line 790 of file itemrepository.h.

◆ monsterBucketExtent()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
int KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::monsterBucketExtent ( ) const
inline

Returns the count of following buckets that were merged onto this buckets data array.

Definition at line 784 of file itemrepository.h.

◆ nextBucketForHash()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
unsigned short KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::nextBucketForHash ( uint  hash) const
inline

Definition at line 696 of file itemrepository.h.

◆ noNextBuckets()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::noNextBuckets ( ) const
inline

Returns true if this bucket has no nextBucketForHash links.

Definition at line 626 of file itemrepository.h.

◆ prepareChange()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::prepareChange ( )
inline

Definition at line 771 of file itemrepository.h.

◆ readValue()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
template<class T >
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::readValue ( char *&  from,
T &  to 
)
inline

Definition at line 164 of file itemrepository.h.

◆ setNextBucketForHash()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::setNextBucketForHash ( unsigned int  hash,
unsigned short  bucket 
)
inline

Definition at line 702 of file itemrepository.h.

◆ store()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::store ( QFile *  file,
size_t  offset 
)
inline

Definition at line 193 of file itemrepository.h.

◆ tick()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
void KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::tick ( ) const
inline

Definition at line 754 of file itemrepository.h.

◆ totalFreeItemsSize()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
short unsigned int KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::totalFreeItemsSize ( ) const
inline

Definition at line 714 of file itemrepository.h.

◆ usedMemory()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
uint KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::usedMemory ( ) const
inline

Definition at line 640 of file itemrepository.h.

◆ visitAllItems()

template<class Item , class ItemRequest , bool markForReferenceCounting, uint fixedItemSize>
template<class Visitor >
bool KDevelop::Bucket< Item, ItemRequest, markForReferenceCounting, fixedItemSize >::visitAllItems ( Visitor &  visitor) const
inline

Definition at line 646 of file itemrepository.h.


The documentation for this class was generated from the following file:
  • itemrepository.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 23:39:09 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/serialization

Skip menu "kdevplatform/serialization"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal