JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
JHashCursor< V > Class Template Reference

#include <JHashCursor.h>

Inheritance diagram for JHashCursor< V >:
[legend]

Public Member Functions

 JHashCursor (JHashTable< V > *table)
 
 JHashCursor (JHashTable< V > *table, const JHashValue hash)
 
 ~JHashCursor () override
 
void ForceNextOpen ()
 
void ForceNextMapInsertHash ()
 
void ForceNextMapInsertKey ()
 
void Set (const JHashRecord< V > &record) const
 
void Set (const JHashValue hash, const V &value) const
 
void Set (const V &value) const
 
void SetHash (const V &value) const
 
void Remove () const
 
void MarkEmpty () const
 
- Public Member Functions inherited from JConstHashCursor< V >
 JConstHashCursor (const JHashTable< V > *table)
 
 JConstHashCursor (const JHashTable< V > *table, const JHashValue hash)
 
virtual ~JConstHashCursor ()
 
bool Next ()
 
bool Next (bool(*NextRecordType)(const JHashRecord< V > &), const bool stopOnEmpty)
 
bool NextFull ()
 
bool NextOpen ()
 
bool NextHash (const bool allowEmpty=false)
 
bool NextHashOrOpen ()
 
bool NextKey (const bool allowEmpty=false)
 
bool NextKeyOrOpen ()
 
bool NextMapInsertHash ()
 
bool NextMapInsertKey ()
 
void Reset (const bool clear=false)
 
void ResetHash (const JHashValue hash)
 
void ResetKey (const V &value)
 
JHashValue GetCursorHashValue () const
 
const JHashRecord< V > & GetRecord () const
 
JHashRecordT::State GetState () const
 
bool IsEmpty () const
 
bool IsDeleted () const
 
bool IsFull () const
 
JHashValue GetHashValue () const
 
const V & GetValue () const
 

Protected Member Functions

JHashTable< V > * GetMutableTable () const
 
- Protected Member Functions inherited from JConstHashCursor< V >
const JHashTable< V > * GetTable () const
 
JSize GetIndex () const
 
void Step ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from JConstHashCursor< V >
static JDualHashValue DualHash (const JHashValue hash)
 

Constructor & Destructor Documentation

◆ JHashCursor() [1/2]

template<class V >
JHashCursor< V >::JHashCursor ( JHashTable< V > *  table)

A hash table cursor which can modify its table.

Set automatically resizes the table.

Base code generated by Codemill v0.1.0 The version without a hash value or key parameter iterates through the entire table, obviously in no perceptible order. The others iterate over all records containing the given hash value.

◆ JHashCursor() [2/2]

template<class V >
JHashCursor< V >::JHashCursor ( JHashTable< V > *  table,
const JHashValue  hash 
)

◆ ~JHashCursor()

template<class V >
JHashCursor< V >::~JHashCursor ( )
override

Member Function Documentation

◆ ForceNextMapInsertHash()

template<class V >
void JHashCursor< V >::ForceNextMapInsertHash ( )

Like NextMapInsertHash(), but if no open space is found it resets, grows the table, and then tries again. Because it can resize a table, it asserts that you haven't used it on a table with the resize flag off.

It can safely be called on a cursor which has already been advanced with one of the Next... functions if you know what you're doing, but be careful.

◆ ForceNextMapInsertKey()

template<class V >
void JHashCursor< V >::ForceNextMapInsertKey ( )

Like NextMapInsertKey(), but if no open space is found it resets, grows the table, and then tries again. Because it can resize a table, it asserts that you haven't used it on a table with the resize flag off.

It can safely be called on a cursor which has already been advanced with one of the Next... functions if you know what you're doing, but be careful.

◆ ForceNextOpen()

template<class V >
void JHashCursor< V >::ForceNextOpen ( )

See notes in JConstHashCursor. Like NextOpen(), but if no open space is found it resets, grows the table, and then finds an open space. Since it always finds an open space, it has no return value. Because it can resize a table, it asserts that you haven't used it on a table with the resize flag off.

It can safely be called on a cursor which has already been advanced with one of the Next... functions if you know what you're doing, but be careful.

◆ GetMutableTable()

template<class V >
JHashTable< V > * JHashCursor< V >::GetMutableTable ( ) const
inlineprotected

◆ MarkEmpty()

template<class V >
void JHashCursor< V >::MarkEmpty ( ) const
inline

DANGER! Extreme memory leak hazard!

Don't use this unless you know what you're doing–this is the single easiest way to rip a hash table to shreds, and likely leak memory too.

◆ Remove()

template<class V >
void JHashCursor< V >::Remove ( ) const
inline

◆ Set() [1/3]

template<class V >
void JHashCursor< V >::Set ( const JHashRecord< V > &  record) const
inline

How a record may be set is restricted just as for individual records to make it harder to make errors. However, for efficiency's sake you don't get much hand-holding. In particularly, those versions which take a key but not a value use the hash value the cursor was initialized with; just make sure that the key and hash match!

The record being set must always be in a kFull state after the set. For this reason, Set() automatically sets the state to kFull.

◆ Set() [2/3]

template<class V >
void JHashCursor< V >::Set ( const JHashValue  hash,
const V &  value 
) const
inline

◆ Set() [3/3]

template<class V >
void JHashCursor< V >::Set ( const V &  value) const
inline

◆ SetHash()

template<class V >
void JHashCursor< V >::SetHash ( const V &  value) const
inline

The documentation for this class was generated from the following files: