add hash iterator functions to access the pointer to the value.

This commit is contained in:
2013-09-02 02:58:53 +00:00
parent 26cbf331a8
commit d59b4752e4
4 changed files with 22 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) ATTR_MALLOC ATTR_WARN
void BLI_edgehashIterator_free(EdgeHashIterator *ehi);
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, unsigned int *v0_r, unsigned int *v1_r);
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) ATTR_WARN_UNUSED_RESULT;
void **BLI_edgehashIterator_getValue_p(EdgeHashIterator *ehi) ATTR_WARN_UNUSED_RESULT;
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val);
void BLI_edgehashIterator_step(EdgeHashIterator *ehi);
bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) ATTR_WARN_UNUSED_RESULT;

View File

@@ -86,6 +86,7 @@ void BLI_ghashIterator_free(GHashIterator *ghi);
void *BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
void *BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
void BLI_ghashIterator_step(GHashIterator *ghi);
bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;

View File

@@ -601,6 +601,18 @@ void *BLI_ghashIterator_getValue(GHashIterator *ghi)
return ghi->curEntry ? ghi->curEntry->val : NULL;
}
/**
* Retrieve the value from an iterator.
*
* \param ghi The iterator.
* \return The value at the current index, or NULL if the
* iterator is done.
*/
void **BLI_ghashIterator_getValue_p(GHashIterator *ghi)
{
return ghi->curEntry ? &ghi->curEntry->val : NULL;
}
/**
* Steps the iterator to the next index.
*

View File

@@ -483,6 +483,14 @@ void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
return ehi->curEntry ? ehi->curEntry->val : NULL;
}
/**
* Retrieve the pointer to the value from an iterator.
*/
void **BLI_edgehashIterator_getValue_p(EdgeHashIterator *ehi)
{
return ehi->curEntry ? &ehi->curEntry->val : NULL;
}
/**
* Set the value for an iterator.
*/