blace.ai
blace::ml_core::BlaceHash Struct Reference

#include <types.h>

Public Member Functions

bool operator== (const BlaceHash &rhs) const
 
bool operator!= (const BlaceHash &rhs) const
 
long long to_long_long ()
 
std::string to_hex (int len=8)
 
 BlaceHash ()
 
 BlaceHash (int seed)
 
 BlaceHash (std::string str)
 
 BlaceHash (int64_t a, int64_t b, int64_t c, int64_t d)
 
std::string print ()
 

Static Public Member Functions

static void mix_string_into_hash (BlaceHash &hash, std::string str)
 
static void mix_float_into_hash (BlaceHash &hash, float data)
 

Public Attributes

uint64_t hash [4]
 

Friends

std::ostream & operator<< (std::ostream &os, const BlaceHash &obj)
 

Detailed Description

Struct to hold a hash.

Constructor & Destructor Documentation

◆ BlaceHash() [1/4]

blace::ml_core::BlaceHash::BlaceHash ( )

Default constructor.

◆ BlaceHash() [2/4]

blace::ml_core::BlaceHash::BlaceHash ( int  seed)

Construct hash from a seed.

Parameters
seedThe seed

◆ BlaceHash() [3/4]

blace::ml_core::BlaceHash::BlaceHash ( std::string  str)

Construct random from a string.

Parameters
strThe string to create the hash from.

◆ BlaceHash() [4/4]

blace::ml_core::BlaceHash::BlaceHash ( int64_t  a,
int64_t  b,
int64_t  c,
int64_t  d 
)

Construct from 4 values.

Parameters
aA
bB
cC
dD, who would have thought?

Member Function Documentation

◆ mix_float_into_hash()

static void blace::ml_core::BlaceHash::mix_float_into_hash ( BlaceHash hash,
float  data 
)
static

x

Parameters
hashx
datax

◆ mix_string_into_hash()

static void blace::ml_core::BlaceHash::mix_string_into_hash ( BlaceHash hash,
std::string  str 
)
static

x

Parameters
hashx
strx

◆ operator!=()

bool blace::ml_core::BlaceHash::operator!= ( const BlaceHash rhs) const

Inequality operator.

Parameters
rhsThe other hash.
Returns
true if equal.

◆ operator==()

bool blace::ml_core::BlaceHash::operator== ( const BlaceHash rhs) const

Equality operator.

Parameters
rhsThe other hash.
Returns
true if equal.

◆ print()

std::string blace::ml_core::BlaceHash::print ( )
inline

Simple print helper.

Returns

◆ to_hex()

std::string blace::ml_core::BlaceHash::to_hex ( int  len = 8)

Convert hash to a hexadecimal string.

Parameters
lenLength of the string.
Returns
The hex string.

◆ to_long_long()

long long blace::ml_core::BlaceHash::to_long_long ( )

Convert hash to a long long.

Returns
the long long

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const BlaceHash obj 
)
friend

Print helper.

Member Data Documentation

◆ hash

uint64_t blace::ml_core::BlaceHash::hash[4]

The internal value store.