An identifier that compares as fast as an integer but has a string. More...
#include <hashedstring.h>
Public Member Functions | |
HashedString32 () | |
NonComputing Constructor. More... | |
HashedString32 (const String &StartingString) | |
String Constructor. More... | |
HashedString32 (const String &StartingString, Int32 PrecomputedHash) | |
Precomputed Constructor. More... | |
HashedString32 (const HashedString32 &StartingString) | |
Copy constructor. More... | |
Int32 | GetHash () const |
Get the 32 bit as an Int32. More... | |
String | GetString () const |
Get the string that was used to calculate the hash. More... | |
bool | operator!= (const HashedString32 &Other) const |
Compare The hash of this and another string for inequality. More... | |
bool | operator< (const HashedString32 &Other) const |
Provide a semantically useless, but quite fast sorting order for std containers based on only hashes. More... | |
bool | operator== (const HashedString32 &Other) const |
Compare The hash of this and another string for equality. More... | |
bool | operator> (const HashedString32 &Other) const |
Provide a semantically useless, but quite fast sorting order for std containers based on only hashes. More... | |
void | ProtoDeSerialize (const XML::Node &OneNode) |
Take the data stored in an XML and overwrite this instance of this object with it. More... | |
void | ProtoSerialize (XML::Node &CurrentRoot) const |
Convert this class to an XML::Node ready for serialization. More... | |
void | SetString (const String &NewString) |
Set a new string and recalculate its hash. More... | |
Static Public Member Functions | |
static String | GetSerializableName () |
Get the name of the the XML tag this class will leave behind as its instances are serialized. More... | |
static Int32 | Murmur32bit (const String &ToBeHashed) |
Compute a MurmurA aka MurmurX86-32bit has of a string and return it. More... | |
Protected Attributes | |
Int32 | Hash |
The computed hash. | |
String | TheString |
The Actual string to store. | |
An identifier that compares as fast as an integer but has a string.
This computes a MurmurA(x86 32bit) hash on creation. This is used in all comparisons, this means that in excedingly rare situations that hash collisions could cause silent failure.
Internally programming la
Definition at line 65 of file hashedstring.h.
Mezzanine::HashedString32::HashedString32 | ( | ) |
NonComputing Constructor.
Skip the hashing overhead and just do the work for h
Definition at line 57 of file hashedstring.cpp.
Mezzanine::HashedString32::HashedString32 | ( | const String & | StartingString | ) |
String Constructor.
StartingString | The String to work with |
Compute the hash of the String and hang onto both for future use.
Definition at line 61 of file hashedstring.cpp.
Precomputed Constructor.
StartingString | The String to work with |
PrecomputedHash | The value |
Does not Compute the hash of the String, Just trusts whatever it is given.
Definition at line 65 of file hashedstring.cpp.
Mezzanine::HashedString32::HashedString32 | ( | const HashedString32 & | StartingString | ) |
Copy constructor.
StartingString | The other hashed string |
Definition at line 69 of file hashedstring.cpp.
Int32 Mezzanine::HashedString32::GetHash | ( | ) | const |
Get the 32 bit as an Int32.
Definition at line 104 of file hashedstring.cpp.
|
static |
Get the name of the the XML tag this class will leave behind as its instances are serialized.
Definition at line 158 of file hashedstring.cpp.
String Mezzanine::HashedString32::GetString | ( | ) | const |
Get the string that was used to calculate the hash.
Definition at line 107 of file hashedstring.cpp.
Compute a MurmurA aka MurmurX86-32bit has of a string and return it.
ToBeHashed | The string to hash |
Definition at line 50 of file hashedstring.cpp.
bool Mezzanine::HashedString32::operator!= | ( | const HashedString32 & | Other | ) | const |
Compare The hash of this and another string for inequality.
Other | The other string to compare this one too. |
Definition at line 81 of file hashedstring.cpp.
bool Mezzanine::HashedString32::operator< | ( | const HashedString32 & | Other | ) | const |
Provide a semantically useless, but quite fast sorting order for std containers based on only hashes.
Other | The other string to compare this one too. |
Definition at line 89 of file hashedstring.cpp.
bool Mezzanine::HashedString32::operator== | ( | const HashedString32 & | Other | ) | const |
Compare The hash of this and another string for equality.
Other | The other string to compare this one too. |
Definition at line 73 of file hashedstring.cpp.
bool Mezzanine::HashedString32::operator> | ( | const HashedString32 & | Other | ) | const |
Provide a semantically useless, but quite fast sorting order for std containers based on only hashes.
Other | The other string to compare this one too. |
Definition at line 96 of file hashedstring.cpp.
void Mezzanine::HashedString32::ProtoDeSerialize | ( | const XML::Node & | OneNode | ) |
Take the data stored in an XML and overwrite this instance of this object with it.
OneNode | and XML::Node containing the data. |
Definition at line 142 of file hashedstring.cpp.
void Mezzanine::HashedString32::ProtoSerialize | ( | XML::Node & | CurrentRoot | ) | const |
Convert this class to an XML::Node ready for serialization.
CurrentRoot | The point in the XML hierarchy that all this HashedString32 should be appended to. |
Definition at line 116 of file hashedstring.cpp.
void Mezzanine::HashedString32::SetString | ( | const String & | NewString | ) |
Set a new string and recalculate its hash.
NewString | The data to hash and store for later use. |
Definition at line 110 of file hashedstring.cpp.