Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

QHashData Struct Reference

Search for all occurrences

Detailed Description

Definition at line 112 of file qhash.h.

#include <qhash.h>

List of all members.

Classes

struct   Node

Public Member Functions

void *  allocateNode ()
void *  allocateNode (int nodeAlign)
void  freeNode (void *node)
QHashData detach_helper (void(*node_duplicate)(Node *, void *), int nodeSize)
QHashData detach_helper2 (void(*node_duplicate)(Node *, void *), void(*node_delete)(Node *), int nodeSize, int nodeAlign)
void  mightGrow ()
bool  willGrow ()
void  hasShrunk ()
void  rehash (int hint)
void  free_helper (void(*node_delete)(Node *))
void  destroyAndFree ()
Node firstNode ()

Static Public Member Functions

static Node nextNode (Node *node)
static Node previousNode (Node *node)

Public Attributes

Node fakeNext
Node **  buckets
QBasicAtomicInt  ref
int  size
int  nodeSize
short  userNumBits
short  numBits
int  numBuckets
uint  sharable: 1
uint  strictAlignment: 1
uint  reserved: 30

Static Public Attributes

static QHashData  shared_null

Member Function Documentation

void* allocateNode ( )
void* allocateNode ( int  nodeAlign )
void freeNode ( void *  node )
QHashData* detach_helper ( void(*)(Node *, void *)  node_duplicate,
int  nodeSize 
)
QHashData* detach_helper2 ( void(*)(Node *, void *)  node_duplicate,
void(*)(Node *)  node_delete,
int  nodeSize,
int  nodeAlign 
)
void mightGrow ( ) [inline]

Definition at line 154 of file qhash.h.

{
    if (size >= numBuckets)
        rehash(numBits + 1);
}
bool willGrow ( ) [inline]

Definition at line 160 of file qhash.h.

{
    if (size >= numBuckets) {
        rehash(numBits + 1);
        return true;
    } else {
        return false;
    }
}
void hasShrunk ( ) [inline]

Definition at line 170 of file qhash.h.

{
    if (size <= (numBuckets >> 3) && numBits > userNumBits) {
        QT_TRY {
            rehash(qMax(int(numBits) - 2, int(userNumBits)));
        } QT_CATCH(const std::bad_alloc &) {
            // ignore bad allocs - shrinking shouldn't throw. rehash is exception safe.
        }
    }
}
void rehash ( int  hint )
void free_helper ( void(*)(Node *)  node_delete )
void destroyAndFree ( )
QHashData::Node * firstNode ( ) [inline]

Definition at line 181 of file qhash.h.

{
    Node *e = reinterpret_cast<Node *>(this);
    Node **bucket = buckets;
    int n = numBuckets;
    while (n--) {
        if (*bucket != e)
            return *bucket;
        ++bucket;
    }
    return e;
}
static Node* nextNode ( Node node ) [static]
static Node* previousNode ( Node node ) [static]

Member Data Documentation

Definition at line 119 of file qhash.h.

Definition at line 120 of file qhash.h.

Definition at line 121 of file qhash.h.

int size

Definition at line 122 of file qhash.h.

int nodeSize

Definition at line 123 of file qhash.h.

short userNumBits

Definition at line 124 of file qhash.h.

short numBits

Definition at line 125 of file qhash.h.

Definition at line 126 of file qhash.h.

uint sharable

Definition at line 127 of file qhash.h.

Definition at line 128 of file qhash.h.

uint reserved

Definition at line 129 of file qhash.h.

Definition at line 151 of file qhash.h.


The documentation for this struct was generated from the following file: