This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
内容优化
Materials
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: 2022-03-10
Build: ()