QHashData Struct Reference

#include <qhash.h>

Class Description

Definition at line 112 of file qhash.h.

Classes

struct  Node
 

Public Member Functions

voidallocateNode ()
 
voidallocateNode (int nodeAlign)
 
void freeNode (void *node)
 
QHashDatadetach_helper (void(*node_duplicate)(Node *, void *), int nodeSize)
 
QHashDatadetach_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 ()
 
NodefirstNode ()
 

Static Public Member Functions

static NodenextNode (Node *node)
 
static NodepreviousNode (Node *node)
 

Public Attributes

NodefakeNext
 
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.

155 {
156  if (size >= numBuckets)
157  rehash(numBits + 1);
158 }
short numBits
Definition: qhash.h:125
void rehash(int hint)
int numBuckets
Definition: qhash.h:126
GLsizeiptr size
Definition: GLee.h:1561
bool willGrow ( )
inline

Definition at line 160 of file qhash.h.

161 {
162  if (size >= numBuckets) {
163  rehash(numBits + 1);
164  return true;
165  } else {
166  return false;
167  }
168 }
short numBits
Definition: qhash.h:125
void rehash(int hint)
int numBuckets
Definition: qhash.h:126
GLsizeiptr size
Definition: GLee.h:1561
void hasShrunk ( )
inline

Definition at line 170 of file qhash.h.

171 {
172  if (size <= (numBuckets >> 3) && numBits > userNumBits) {
173  QT_TRY {
174  rehash(qMax(int(numBits) - 2, int(userNumBits)));
175  } QT_CATCH(const std::bad_alloc &) {
176  // ignore bad allocs - shrinking shouldn't throw. rehash is exception safe.
177  }
178  }
179 }
short numBits
Definition: qhash.h:125
short userNumBits
Definition: qhash.h:124
void rehash(int hint)
int numBuckets
Definition: qhash.h:126
GLsizeiptr size
Definition: GLee.h:1561
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.

182 {
183  Node *e = reinterpret_cast<Node *>(this);
184  Node **bucket = buckets;
185  int n = numBuckets;
186  while (n--) {
187  if (*bucket != e)
188  return *bucket;
189  ++bucket;
190  }
191  return e;
192 }
Node ** buckets
Definition: qhash.h:120
GLenum GLsizei n
Definition: GLee.h:3432
int numBuckets
Definition: qhash.h:126
static Node* nextNode ( Node node)
static
static Node* previousNode ( Node node)
static

Member Data Documentation

Node* fakeNext

Definition at line 119 of file qhash.h.

Node** buckets

Definition at line 120 of file qhash.h.

Definition at line 121 of file qhash.h.

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.

int numBuckets

Definition at line 126 of file qhash.h.

uint sharable

Definition at line 127 of file qhash.h.

uint strictAlignment

Definition at line 128 of file qhash.h.

uint reserved

Definition at line 129 of file qhash.h.

QHashData shared_null
static

Definition at line 151 of file qhash.h.


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