This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Art Samples
Tutorials

Unigine::Hash class

Header: #include <UnigineHash.h>

A Hash is a collection of unique keys and their values, much like a dictionary. Hashes are also referred to as associative arrays; they are similar to arrays, but while an array uses integers as an index, a Hash can use any type of object.

Hash Class

Members


bool is_need_realloc ( ) #

Indicates whether reallocation is needed.

Return value

true if reallocation is needed, otherwise false.

void shrink ( ) #

Reduces memory usage by removing unused capacity.

Data * do_append ( const Key & key ) #

Appends an element with the specified key to the hash.

Arguments

  • const Key & key - Key of an element to be appended.

Return value

Pointer to Data.

void rehash ( Counter new_capacity ) #

Rebuilds the hash based on a specified capacity.

Arguments

  • Counter new_capacity - New hash capacity value.

Iterator begin ( ) #

Returns an iterator that points to the first element in the hash.

Return value

Iterator pointing to the first element.

ConstIterator end ( ) #

Returns a const iterator that points to the location succeeding the last element in the hash.

Return value

Const iterator pointing to the location after the last element.

Vector<Key> keys ( ) #

Returns a vector containing all the keys in the hash.

Return value

Vector of keys.

bool remove ( const ConstIterator & it ) #

Removes an element currently pointed to by the iterator from the hash.

Arguments

  • const ConstIterator & it - Iterator pointing to an element to be removed.

Return value

true on success, otherwise false.

Counter space ( ) #

Returns current capacity (number of elements the hash can currently contain).

Return value

Number of elements the hash can currently contain.

Data * do_append ( Key && key ) #

Appends an element with the specified key to the hash.

Arguments

  • Key && key - Key of an element to be appended.

Return value

Pointer to Data.

bool erase ( const ConstIterator & it ) #

Removes an element currently pointed to by the iterator from the hash.

Arguments

  • const ConstIterator & it - Iterator pointing to the element to be removed.

Return value

true on success, otherwise false.

bool erase ( const Iterator & it ) #

Removes an element currently pointed to by the iterator from the hash.

Arguments

  • const Iterator & it - Iterator pointing to the element to be removed.

Return value

true on success, otherwise false.

Counter round_up ( Counter v ) #

Performs rounding and returns the result.

Arguments

  • Counter v

void swap ( Hash<Key, Data, HashType, Counter> & hash ) #

Swaps this hash with the specified one.

Arguments

  • Hash<Key, Data, HashType, Counter> & hash - Specified hash.

Data * do_append ( HashType hash, const Key & key ) #

Appends an element with the specified key to the specified hash.

Arguments

  • HashType hash - Specified hash.
  • const Key & key - Key of an element to be appended.

Return value

Pointer to Data.

void rehash_data ( Counter index ) #

Rebuilds the hash.

Arguments

  • Counter index

Counter empty ( ) #

Checks if the hash is empty or not.

Return value

1 if the hash is empty, otherwise 0

bool contains ( const Key & key ) #

Checks if the given key is present in the hash.

Arguments

  • const Key & key - Key to be looked for.

Return value

true if the given key is present in the hash, otherwise false.

void clear ( ) #

Removes all key-value pairs from the hash.

bool do_remove ( HashType hash, const Key & key ) #

Removes an element with the specified key from the specified hash.

Arguments

  • HashType hash - Specified hash.
  • const Key & key - Key of an element to be removed.

Return value

true on success, otherwise false.

void getKeys ( Vector<Key> & keys ) #

Adds keys of the hash to the specified vector.

Arguments

  • Vector<Key> & keys - Specified vector to store the keys in.

void reserve ( Counter size ) #

Reserves storage to avoid repeated reallocation.

Arguments

  • Counter size - Hash size to be reserved.

bool erase ( const Key & key ) #

Removes an element having the specified key from the hash.

Arguments

  • const Key & key - Key of an element to be removed.

Return value

true on success, otherwise false.

Data ** do_find ( const Key & key ) #

Finds an element with a specified key.

Arguments

  • const Key & key - Key to look for.

Return value

Data of the element with the specified key if it exists, otherwise nullptr.

void realloc ( ) #

Performs memory reallocation.

bool remove ( const Key & key ) #

Removes an element having the specified key from the hash.

Arguments

  • const Key & key - Key of an element to be removed.

bool remove ( const Iterator & it ) #

Removes an element currently pointed to by the iterator from the hash.

Arguments

  • const Iterator & it - Iterator pointing to the element to be removed.

Return value

true on success, otherwise false.

void destroy ( ) #

Deletes the hash.

Counter size ( ) #

Returns the number of key-value pairs in the hash.

Return value

Number of key-value pairs in the hash.

Iterator end ( ) #

Returns an iterator that points to the location succeeding the last element in the hash.

Return value

Iterator pointing to the location after the last element.

ConstIterator begin ( ) #

Returns a const iterator that points to the first element in the hash.

Return value

Iterator pointing to the first element.

ConstIterator find ( const Key & key ) #

Finds an element with a specified key.

Arguments

  • const Key & key - Key to look for.

Return value

Iterator pointing to the element with a specified key if it exists, or to the end of the hash if it does not.

Iterator find ( const Key & key ) #

Finds an element with a specified key.

Arguments

  • const Key & key - Key to look for.

Return value

Iterator pointing to the element with a specified key if it exists, or to the end of the hash if it does not.
Last update: 2021-09-17
Build: ()