MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mfem::HashFunction Class Reference

Hash function for data sequences. More...

#include <hash.hpp>

Public Member Functions

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

Protected Member Functions

void HashBuffer (const void *buffer, size_t num_bytes)
 Add a sequence of bytes for hashing. More...
 
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. More...
 
template<typename double_const_iter >
HashFunctionEncodeAndHashDoubles (double_const_iter begin, double_const_iter end)
 Double encoding method: encode in little-endian byte-order. More...
 

Protected Attributes

void * hash_data
 

Detailed Description

Hash function for data sequences.

Depends on GnuTLS for SHA-256 hashing.

Definition at line 218 of file hash.hpp.

Constructor & Destructor Documentation

mfem::HashFunction::HashFunction ( )

Default constructor: initialize the hash function.

Definition at line 29 of file hash.cpp.

mfem::HashFunction::~HashFunction ( )

Destructor.

Definition at line 38 of file hash.cpp.

Member Function Documentation

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

Add a sequence of bytes for hashing.

Definition at line 244 of file hash.hpp.

HashFunction& mfem::HashFunction::AppendDoubles ( const double *  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 271 of file hash.hpp.

template<size_t num_doubles>
HashFunction& mfem::HashFunction::AppendDoubles ( const double(&)  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 278 of file hash.hpp.

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 285 of file hash.hpp.

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 251 of file hash.hpp.

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 258 of file hash.hpp.

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 265 of file hash.hpp.

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 704 of file hash.hpp.

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 654 of file hash.hpp.

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.

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

void* mfem::HashFunction::hash_data
protected

Definition at line 221 of file hash.hpp.


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