OpenNI 1.5.4: XnHash Class Reference

OpenNI

#include <XnHash.h>

List of all members.

Classes

class  ConstIterator
class  Iterator

Public Types

typedef XnHashValue(* XnHashFunction )(const XnKey &key)
typedef XnInt32(* XnCompareFunction )(const XnKey &key1, const XnKey &key2)

Public Member Functions

 XnHash ()
virtual ~XnHash ()
XnStatus GetInitStatus () const
XnStatus Set (const XnKey &key, const XnValue &value)
XnStatus Get (const XnKey &key, XnValue &value) const
XnStatus Remove (const XnKey &key, XnValue &value)
XnStatus Remove (ConstIterator iter, XnKey &key, XnValue &value)
virtual XnStatus Remove (ConstIterator iter)
XnStatus Clear ()
XnBool IsEmpty () const
XnUInt32 Size () const
XnStatus Find (const XnKey &key, ConstIterator &hiter) const
XnStatus Find (const XnKey &key, Iterator &hiter)
Iterator begin ()
ConstIterator begin () const
Iterator end ()
ConstIterator end () const
XnStatus SetHashFunction (XnHashFunction hashFunction)
XnStatus SetCompareFunction (XnCompareFunction compareFunction)

Protected Member Functions

XnStatus Init ()
XnStatus Find (const XnKey &key, XnHashValue hashValue, ConstIterator &hiter) const

Protected Attributes

XnList ** m_Bins
XnUInt16 m_nMinBin
XnStatus m_nInitStatus
XnHashFunction m_HashFunction
XnCompareFunction m_CompareFunction

Friends

class ConstIterator

Detailed Description

The hash - associative array


Member Typedef Documentation

typedef XnInt32(* XnHash::XnCompareFunction)(const XnKey &key1, const XnKey &key2)

Definition of comparison function - receives 2 keys, returns 0 on equality

typedef XnHashValue(* XnHash::XnHashFunction)(const XnKey &key)

Definition of a hash function - receive key, and outputs HashValue


Constructor & Destructor Documentation

XnHash::XnHash ( ) [inline]

Constructor. Initializes internal representations.

virtual XnHash::~XnHash ( ) [inline, virtual]

Destructor. Destroys internal representations.


Member Function Documentation

Iterator XnHash::begin ( ) [inline]

Get an iterator to the beginning of the XnHash (non-const version)

ConstIterator XnHash::begin ( ) const [inline]

Get an iterator to the beginning of the XnHash (const version)

XnStatus XnHash::Clear ( ) [inline]

Remove all entries from the XnHash.

Iterator XnHash::end ( ) [inline]

Get an iterator to the end of the XnHash (position is invalid) (non-const version)

ConstIterator XnHash::end ( ) const [inline]

Get an iterator to the end of the XnHash (position is invalid) (const version)

XnStatus XnHash::Find ( const XnKey key,
ConstIterator hiter 
) const [inline]

Get an iterator pointing to the entry to which the key belongs

Parameters:
key[in] The key of the entry
hiter[out] Iterator to the entry described by key
Returns:
XN_STATUS_NO_MATCH No such key in the XnHash
XnStatus XnHash::Find ( const XnKey key,
Iterator hiter 
) [inline]

Get an iterator pointing to the entry to which the key belongs

Parameters:
key[in] The key of the entry
hiter[out] Iterator to the entry described by key
Returns:
XN_STATUS_NO_MATCH No such key in the XnHash
XnStatus XnHash::Find ( const XnKey key,
XnHashValue  hashValue,
ConstIterator hiter 
) const [inline, protected]

Get an iterator pointing to the entry to which the key belongs

Parameters:
key[in] The key of the entry
hashValue[in] The hash value of the key
hiter[out] Iterator to the entry described by key
Returns:
XN_STATUS_NO_MATCH No such key in the XnHash
XnStatus XnHash::Get ( const XnKey key,
XnValue value 
) const [inline]

Get the value associated with the supplied key

Parameters:
key[in] The key of the entry
value[out] The retrieved value
Returns:
XN_STATUS_NO_MATCH if no such key exists
XnStatus XnHash::GetInitStatus ( ) const [inline]

Returns the status of the initialization of the hash.

Returns:
XN_STATUS_OK if the hash was initialized successfully, or an error code otherwise (e.g. if memory could not be allocated).
XnStatus XnHash::Init ( ) [inline, protected]
XnBool XnHash::IsEmpty ( ) const [inline]

Checks if hash is empty.

XnStatus XnHash::Remove ( const XnKey key,
XnValue value 
) [inline]

Remove a key-value entry from the XnHash

Parameters:
key[in] The key of the entry
value[out] The value that was in the removed entry
Returns:
XN_STATUS_NO_MATCH if no such key exists
XnStatus XnHash::Remove ( ConstIterator  iter,
XnKey key,
XnValue value 
) [inline]

Remove an entry from the XnHash by iterator

Parameters:
iter[in] Iterator pointing to an entry in the hash
key[out] The key that was in the removed entry
value[out] The value that was in the removed entry
Returns:
XN_STATUS_ILLEGAL_POSITION if iterator is invalid
virtual XnStatus XnHash::Remove ( ConstIterator  iter) [inline, virtual]

Remove an entry from the XnHash by iterator

Parameters:
iter[in] Iterator pointing to an entry in the hash
Returns:
XN_STATUS_ILLEGAL_POSITION if iterator is invalid
XnStatus XnHash::Set ( const XnKey key,
const XnValue value 
) [inline]

Set a new key-value entry. If key exists, will replace value.

Parameters:
key[in] The key to which to associate the value
value[in] The value to add to the XnHash
XnStatus XnHash::SetCompareFunction ( XnCompareFunction  compareFunction) [inline]

Change the comparison function. The XnHash must be empty for this to succeed.

Parameters:
compareFunction[in] The new hash function
Returns:
XN_STATUS_IS_NOT_EMPTY if the XnHash isn't empty
XnStatus XnHash::SetHashFunction ( XnHashFunction  hashFunction) [inline]

Change the hash function. The XnHash must be empty for this to succeed.

Parameters:
hashFunction[in] The new hash function
Returns:
XN_STATUS_IS_NOT_EMPTY if the XnHash isn't empty
XnUInt32 XnHash::Size ( ) const [inline]

Gets the number of entries in the hash.


Friends And Related Function Documentation

friend class ConstIterator [friend]

Member Data Documentation

XnList** XnHash::m_Bins [protected]

Each bin is a XnList

The current comparison function

The current hash function

XnUInt16 XnHash::m_nMinBin [protected]

The documentation for this class was generated from the following file:
Generated on Wed May 16 2012 10:16:06 for OpenNI 1.5.4 by   doxygen 1.7.5.1