This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Professional (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Materials and Shaders
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

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: 10.10.2022
Build: ()