DiSMEC++
dismec::VectorHash Class Reference

A unique identifier for a HashVector. More...

#include <hash_vector.h>

Public Member Functions

 VectorHash ()
 Default constructor. Initializes the VectorHash to special marker. More...
 
bool operator== (const VectorHash &other) const
 Checks that two hashes are equal. More...
 
bool operator!= (const VectorHash &other) const
 negation of the equality check More...
 

Private Member Functions

 VectorHash (std::size_t id)
 Creates a VectorHash for the given ID. More...
 

Private Attributes

std::size_t m_UniqueID
 

Friends

class HashVector
 

Detailed Description

A unique identifier for a HashVector.

This is the type that is returned by HashVector::hash(). It can be used to verify whether two given vectors are guaranteed to have the same content. In particular, it makes it possible to implement caching of calculated values without having to store and compare a vector valued argument, see the code example in HashVector.

Definition at line 118 of file hash_vector.h.

Constructor & Destructor Documentation

◆ VectorHash() [1/2]

VectorHash::VectorHash ( )

Default constructor. Initializes the VectorHash to special marker.

The default-constructed VectorHash contains a special marker value as the id. This value never compares equal to any hash of a real HashVector.

Definition at line 49 of file hash_vector.cpp.

◆ VectorHash() [2/2]

dismec::VectorHash::VectorHash ( std::size_t  id)
inlineprivate

Creates a VectorHash for the given ID.

This function is private and will only be called from HashVector::hash()

Definition at line 144 of file hash_vector.h.

Member Function Documentation

◆ operator!=()

bool dismec::VectorHash::operator!= ( const VectorHash other) const
inline

negation of the equality check

Definition at line 136 of file hash_vector.h.

◆ operator==()

bool dismec::VectorHash::operator== ( const VectorHash other) const
inline

Checks that two hashes are equal.

Parameters
otherThe other VectorHash to compare to.
Returns
Returns whether both refer to the same id, or both are empty.

Definition at line 132 of file hash_vector.h.

References m_UniqueID.

Friends And Related Function Documentation

◆ HashVector

friend class HashVector
friend

Definition at line 147 of file hash_vector.h.

Member Data Documentation

◆ m_UniqueID

std::size_t dismec::VectorHash::m_UniqueID
private

Definition at line 145 of file hash_vector.h.

Referenced by operator==().


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