Public Member Functions | Private Attributes | List of all members
fnex::Hasher< T > Struct Template Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-25/FNEX/utilities/Hashable.h"

Public Member Functions

std::size_t operator() (const fnex::Hashable< T > *h) const
 Hash function (for unordered_map) for a bare pointer. More...
 
std::size_t operator() (const std::shared_ptr< const fnex::Hashable< T >> h) const
 Hash function (for unordered_map) for a shared_ptr; uses the bare pointer version. More...
 
bool operator() (const fnex::Hashable< T > *h1, const fnex::Hashable< T > *h2)
 Less-than operator (for a regular map) for bare pointer. Uses the hash function. More...
 
bool operator() (std::shared_ptr< const fnex::Hashable< T >> h1, std::shared_ptr< const fnex::Hashable< T >> h2)
 Less-than operator (for a regular map) for shared_ptrs. Uses the bare pointer version. More...
 

Private Attributes

std::hash< std::stringfStringHasher
 

Detailed Description

template<typename T>
struct fnex::Hasher< T >

special sorter type to make Hashable* a usable key type. note that this ignores any other properties that a Hashable derivative might have available to disambiguate, so if necessary derived classes should further specialize the template.

Definition at line 51 of file Hashable.h.

Member Function Documentation

template<typename T >
std::size_t fnex::Hasher< T >::operator() ( const fnex::Hashable< T > *  h) const
inline

Hash function (for unordered_map) for a bare pointer.

Definition at line 54 of file Hashable.h.

References fnex::Hashable< T >::GetID().

55  {
56  if (!h)
57  return 0;
58 
59  return this->fStringHasher(h->GetID().to_string());
60  }
const Hash & GetID() const
Definition: Hashable.h:37
std::hash< std::string > fStringHasher
Definition: Hashable.h:81
template<typename T >
std::size_t fnex::Hasher< T >::operator() ( const std::shared_ptr< const fnex::Hashable< T >>  h) const
inline

Hash function (for unordered_map) for a shared_ptr; uses the bare pointer version.

Definition at line 63 of file Hashable.h.

References make_syst_table_plots::h.

64  {
65  return this->operator()(h.get());
66  }
std::size_t operator()(const fnex::Hashable< T > *h) const
Hash function (for unordered_map) for a bare pointer.
Definition: Hashable.h:54
template<typename T >
bool fnex::Hasher< T >::operator() ( const fnex::Hashable< T > *  h1,
const fnex::Hashable< T > *  h2 
)
inline

Less-than operator (for a regular map) for bare pointer. Uses the hash function.

Definition at line 69 of file Hashable.h.

70  {
71  return this->operator()(h1) < this->operator()(h2);
72  }
std::size_t operator()(const fnex::Hashable< T > *h) const
Hash function (for unordered_map) for a bare pointer.
Definition: Hashable.h:54
template<typename T >
bool fnex::Hasher< T >::operator() ( std::shared_ptr< const fnex::Hashable< T >>  h1,
std::shared_ptr< const fnex::Hashable< T >>  h2 
)
inline

Less-than operator (for a regular map) for shared_ptrs. Uses the bare pointer version.

Definition at line 75 of file Hashable.h.

References h1, and h2.

76  {
77  return this->operator()(h1.get()) < this->operator()(h2.get());
78  }
TH1F * h2
Definition: plot.C:45
TH1F * h1
std::size_t operator()(const fnex::Hashable< T > *h) const
Hash function (for unordered_map) for a bare pointer.
Definition: Hashable.h:54

Member Data Documentation

template<typename T >
std::hash<std::string> fnex::Hasher< T >::fStringHasher
private

Definition at line 81 of file Hashable.h.


The documentation for this struct was generated from the following file: