MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::HashFunction Class Reference

Hash function for data sequences. More...

#include <hash.hpp>

Public Member Functions

 HashFunction ()
 Default constructor: initialize the hash function.
 
 ~HashFunction ()
 Destructor.
 
HashFunctionAppendBytes (const void *seq, size_t num_bytes)
 Add a sequence of bytes for hashing.
 
template<typename int_type >
HashFunctionAppendInts (const int_type *ints, size_t num_ints)
 Add a sequence of integers for hashing, given as a c-array.
 
template<typename int_type , size_t num_ints>
HashFunctionAppendInts (const int_type(&ints)[num_ints])
 Add a sequence of integers for hashing, given as a fixed-size c-array.
 
template<typename int_type_container >
HashFunctionAppendInts (const int_type_container &ints)
 Add a sequence of integers for hashing, given as a container.
 
HashFunctionAppendDoubles (const real_t *doubles, size_t num_doubles)
 Add a sequence of doubles for hashing, given as a c-array.
 
template<size_t num_doubles>
HashFunctionAppendDoubles (const real_t(&doubles)[num_doubles])
 Add a sequence of doubles for hashing, given as a fixed-size c-array.
 
template<typename double_container >
HashFunctionAppendDoubles (const double_container &doubles)
 Add a sequence of doubles for hashing, given as a container.
 
std::string GetHash () const
 Return the hash string for the current sequence and reset (clear) the sequence.
 

Protected Member Functions

void HashBuffer (const void *buffer, size_t num_bytes)
 Add a sequence of bytes for hashing.
 
template<typename int_type_const_iter >
HashFunctionEncodeAndHashInts (int_type_const_iter begin, int_type_const_iter end)
 Integer encoding method; result is independent of endianness and type.
 
template<typename double_const_iter >
HashFunctionEncodeAndHashDoubles (double_const_iter begin, double_const_iter end)
 Double encoding method: encode in little-endian byte-order.
 

Protected Attributes

void * hash_data
 

Detailed Description

Hash function for data sequences.

Depends on GnuTLS for SHA-256 hashing.

Definition at line 458 of file hash.hpp.

Constructor & Destructor Documentation

◆ HashFunction()

mfem::HashFunction::HashFunction ( )

Default constructor: initialize the hash function.

Definition at line 29 of file hash.cpp.

◆ ~HashFunction()

mfem::HashFunction::~HashFunction ( )

Destructor.

Definition at line 38 of file hash.cpp.

Member Function Documentation

◆ AppendBytes()

HashFunction & mfem::HashFunction::AppendBytes ( const void * seq,
size_t num_bytes )
inline

Add a sequence of bytes for hashing.

Definition at line 484 of file hash.hpp.

◆ AppendDoubles() [1/3]

template<typename double_container >
HashFunction & mfem::HashFunction::AppendDoubles ( const double_container & doubles)
inline

Add a sequence of doubles for hashing, given as a container.

Before hashing the sequence is encoded so that the result is independent of endianness.

Definition at line 525 of file hash.hpp.

◆ AppendDoubles() [2/3]

HashFunction & mfem::HashFunction::AppendDoubles ( const real_t * doubles,
size_t num_doubles )
inline

Add a sequence of doubles for hashing, given as a c-array.

Before hashing the sequence is encoded so that the result is independent of endianness.

Definition at line 511 of file hash.hpp.

◆ AppendDoubles() [3/3]

template<size_t num_doubles>
HashFunction & mfem::HashFunction::AppendDoubles ( const real_t(&) doubles[num_doubles])
inline

Add a sequence of doubles for hashing, given as a fixed-size c-array.

Before hashing the sequence is encoded so that the result is independent of endianness.

Definition at line 518 of file hash.hpp.

◆ AppendInts() [1/3]

template<typename int_type >
HashFunction & mfem::HashFunction::AppendInts ( const int_type * ints,
size_t num_ints )
inline

Add a sequence of integers for hashing, given as a c-array.

Before hashing the sequence is encoded so that the result is independent of endianness and type: int, long, unsigned, etc.

Definition at line 491 of file hash.hpp.

◆ AppendInts() [2/3]

template<typename int_type , size_t num_ints>
HashFunction & mfem::HashFunction::AppendInts ( const int_type(&) ints[num_ints])
inline

Add a sequence of integers for hashing, given as a fixed-size c-array.

Before hashing the sequence is encoded so that the result is independent of endianness and type: int, long, unsigned, etc.

Definition at line 498 of file hash.hpp.

◆ AppendInts() [3/3]

template<typename int_type_container >
HashFunction & mfem::HashFunction::AppendInts ( const int_type_container & ints)
inline

Add a sequence of integers for hashing, given as a container.

Before hashing the sequence is encoded so that the result is independent of endianness and type: int, long, unsigned, etc.

Definition at line 505 of file hash.hpp.

◆ EncodeAndHashDoubles()

template<typename double_const_iter >
HashFunction & mfem::HashFunction::EncodeAndHashDoubles ( double_const_iter begin,
double_const_iter end )
protected

Double encoding method: encode in little-endian byte-order.

Definition at line 987 of file hash.hpp.

◆ EncodeAndHashInts()

template<typename int_type_const_iter >
HashFunction & mfem::HashFunction::EncodeAndHashInts ( int_type_const_iter begin,
int_type_const_iter end )
protected

Integer encoding method; result is independent of endianness and type.

Definition at line 937 of file hash.hpp.

◆ GetHash()

std::string mfem::HashFunction::GetHash ( ) const

Return the hash string for the current sequence and reset (clear) the sequence.

Definition at line 60 of file hash.cpp.

◆ HashBuffer()

void mfem::HashFunction::HashBuffer ( const void * buffer,
size_t num_bytes )
protected

Add a sequence of bytes for hashing.

Definition at line 45 of file hash.cpp.

Member Data Documentation

◆ hash_data

void* mfem::HashFunction::hash_data
protected

Definition at line 461 of file hash.hpp.


The documentation for this class was generated from the following files: