Space Engineers
|
Generates string hashes deterministically and crashes on collisions. When used as key for hash tables (Dictionary or HashSet) always pass in MyStringHash.Comparer, otherwise lookups will allocate memory! Can be safely used in network but never serialize to disk! More...
Classes | |
class | HashComparerType |
Public Member Functions | |
override string | ToString () |
override int | GetHashCode () |
override bool | Equals (object obj) |
bool | Equals (MyStringHash id) |
Static Public Member Functions | |
static bool | operator== (MyStringHash lhs, MyStringHash rhs) |
static bool | operator!= (MyStringHash lhs, MyStringHash rhs) |
static | operator int (MyStringHash id) |
static | MyStringHash () |
static MyStringHash | GetOrCompute (string str) |
static MyStringHash | Get (string str) |
static bool | TryGet (string str, out MyStringHash id) |
static MyStringHash | TryGet (string str) |
static MyStringHash | TryGet (int id) |
Think HARD before using this. Usually you should be able to use MyStringHash as it is without conversion to int. More... | |
static bool | IsKnown (MyStringHash id) |
Static Public Attributes | |
static readonly MyStringHash | NullOrEmpty |
static readonly HashComparerType | Comparer = new HashComparerType() |
Properties | |
string | String [get] |
Generates string hashes deterministically and crashes on collisions. When used as key for hash tables (Dictionary or HashSet) always pass in MyStringHash.Comparer, otherwise lookups will allocate memory! Can be safely used in network but never serialize to disk!
IDs are computed as hash from string so there is a risk of collisions. Use only when MyStringId is not sufficient (eg. sending over network). Because the odds of collision get higher the more hashes are in use, do not use this for generated strings and make sure hashes are computed deterministically (eg. at startup) and don't require lengthy gameplay. This way we know about any collision early and not from rare and random crash reports.
Definition at line 20 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 94 of file MyStringHash.cs.
|
inline |
Definition at line 53 of file MyStringHash.cs.
|
inline |
Definition at line 58 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 127 of file MyStringHash.cs.
|
inline |
Definition at line 48 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 106 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 168 of file MyStringHash.cs.
|
inlineexplicitstatic |
Definition at line 66 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 64 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 63 of file MyStringHash.cs.
|
inline |
Definition at line 43 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 135 of file MyStringHash.cs.
|
inlinestatic |
Definition at line 143 of file MyStringHash.cs.
|
inlinestatic |
Think HARD before using this. Usually you should be able to use MyStringHash as it is without conversion to int.
Definition at line 156 of file MyStringHash.cs.
|
static |
Definition at line 87 of file MyStringHash.cs.
|
static |
Definition at line 22 of file MyStringHash.cs.
|
get |
Definition at line 33 of file MyStringHash.cs.