kdevplatform/serialization
#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
anonymous enum |
Enumerator | |
---|---|
AdditionalSpacePerItem |
Definition at line 112 of file itemrepository.h.
◆ anonymous enum
anonymous enum |
Enumerator | |
---|---|
ObjectMapSize | |
MaxFreeItemsForHide | |
MaxFreeSizeForHide | |
MinFreeItemsForReuse | |
MinFreeSizeForReuse |
Definition at line 115 of file itemrepository.h.
◆ anonymous enum
anonymous enum |
Enumerator | |
---|---|
NextBucketHashSize | |
DataSize |
Definition at line 122 of file itemrepository.h.
◆ anonymous enum
anonymous enum |
Enumerator | |
---|---|
CheckStart | |
CheckEnd |
Definition at line 127 of file itemrepository.h.
Constructor & Destructor Documentation
◆ Bucket()
|
inline |
Definition at line 131 of file itemrepository.h.
◆ ~Bucket()
|
inline |
Definition at line 134 of file itemrepository.h.
Member Function Documentation
◆ available()
|
inline |
Definition at line 635 of file itemrepository.h.
◆ canAllocateItem()
|
inline |
Definition at line 738 of file itemrepository.h.
◆ changed()
|
inline |
Definition at line 766 of file itemrepository.h.
◆ countFollowerIndexLengths()
|
inline |
Definition at line 483 of file itemrepository.h.
◆ data()
|
inline |
Definition at line 259 of file itemrepository.h.
◆ dataSize()
|
inline |
Definition at line 264 of file itemrepository.h.
◆ deleteItem()
|
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()
|
inline |
Definition at line 778 of file itemrepository.h.
◆ finalCleanup()
|
inline |
Returns whether something was changed.
Definition at line 667 of file itemrepository.h.
◆ findIndex()
|
inline |
Definition at line 270 of file itemrepository.h.
◆ freeItemCount()
|
inline |
Definition at line 709 of file itemrepository.h.
◆ hasClashingItem()
|
inline |
- Parameters
-
modulo Returns 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()
|
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()
|
inline |
Definition at line 143 of file itemrepository.h.
◆ initializeFromMap()
|
inline |
Definition at line 170 of file itemrepository.h.
◆ isEmpty()
|
inline |
Definition at line 620 of file itemrepository.h.
◆ itemFromIndex()
|
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()
|
inline |
Definition at line 508 of file itemrepository.h.
◆ largestFreeSize()
|
inline |
Definition at line 726 of file itemrepository.h.
◆ lastUsed()
|
inline |
Definition at line 760 of file itemrepository.h.
◆ lostSpace()
|
inline |
Definition at line 790 of file itemrepository.h.
◆ monsterBucketExtent()
|
inline |
Returns the count of following buckets that were merged onto this buckets data array.
Definition at line 784 of file itemrepository.h.
◆ nextBucketForHash()
|
inline |
Definition at line 696 of file itemrepository.h.
◆ noNextBuckets()
|
inline |
Returns true if this bucket has no nextBucketForHash links.
Definition at line 626 of file itemrepository.h.
◆ prepareChange()
|
inline |
Definition at line 771 of file itemrepository.h.
◆ readValue()
|
inline |
Definition at line 164 of file itemrepository.h.
◆ setNextBucketForHash()
|
inline |
Definition at line 702 of file itemrepository.h.
◆ store()
|
inline |
Definition at line 193 of file itemrepository.h.
◆ tick()
|
inline |
Definition at line 754 of file itemrepository.h.
◆ totalFreeItemsSize()
|
inline |
Definition at line 714 of file itemrepository.h.
◆ usedMemory()
|
inline |
Definition at line 640 of file itemrepository.h.
◆ visitAllItems()
|
inline |
Definition at line 646 of file itemrepository.h.
The documentation for this class was generated from the following file:
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.