LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::Hash< I > Class Template Reference

#include "Hash.h"

Public Types

using value_type = std::string
 

Public Member Functions

 Hash ()
 
 Hash (std::string const &)
 
 Hash (Hash< I > const &)
 
 Hash (Hash< I > &&)
 
Hash< I > & operator= (Hash< I > const &)
 
Hash< I > & operator= (Hash< I > &&)
 
bool isValid () const
 
bool isCompactForm () const noexcept
 
std::string compactForm () const
 
bool operator< (Hash< I > const &) const
 
bool operator> (Hash< I > const &) const
 
bool operator== (Hash< I > const &) const
 
bool operator!= (Hash< I > const &) const
 
std::ostream & print (std::ostream &) const
 
void swap (Hash< I > &)
 

Static Public Member Functions

static short Class_Version () noexcept
 

Private Attributes

std::string hash_ {}
 

Detailed Description

template<int I>
class art::Hash< I >

Definition at line 34 of file Hash.h.

Member Typedef Documentation

template<int I>
using art::Hash< I >::value_type = std::string

Definition at line 36 of file Hash.h.

Constructor & Destructor Documentation

template<int I>
art::Hash< I >::Hash ( )

Definition at line 77 of file Hash.h.

References art::detail::fixup().

78  {
80  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12
template<int I>
art::Hash< I >::Hash ( std::string const &  s)
explicit

Definition at line 83 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

83  : hash_{s}
84  {
86  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12
template<int I>
art::Hash< I >::Hash ( Hash< I > const &  rhs)

Definition at line 89 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

89  : hash_{rhs.hash_}
90  {
92  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12
template<int I>
art::Hash< I >::Hash ( Hash< I > &&  rhs)

Definition at line 95 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

95  : hash_{std::move(rhs.hash_)}
96  {
98  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12

Member Function Documentation

template<int I>
short art::Hash< I >::Class_Version ( )
staticnoexcept

Definition at line 71 of file Hash.h.

72  {
73  return 10;
74  }
template<int I>
std::string art::Hash< I >::compactForm ( ) const

Definition at line 189 of file Hash.h.

References art::Hash< I >::compactForm(), art::Hash< I >::hash_, and art::Hash< I >::isCompactForm().

Referenced by art::Hash< I >::compactForm().

190  {
191  if (isCompactForm()) {
192  return hash_;
193  }
194  Hash<I> tMe(*this);
195  return tMe.compactForm();
196  }
std::string hash_
Definition: Hash.h:65
bool isCompactForm() const noexcept
Definition: Hash.h:200
template<int I>
bool art::Hash< I >::isCompactForm ( ) const
noexcept

Definition at line 200 of file Hash.h.

References art::Hash< I >::hash_.

Referenced by art::Hash< I >::compactForm(), art::Hash< I >::isValid(), art::Hash< I >::operator<(), art::Hash< I >::operator==(), and art::Hash< I >::operator>().

201  {
202  return hash_.size() == 16;
203  }
std::string hash_
Definition: Hash.h:65
template<int I>
bool art::Hash< I >::isValid ( ) const

Definition at line 122 of file Hash.h.

References art::Hash< I >::hash_, art::detail::InvalidHash(), and art::Hash< I >::isCompactForm().

Referenced by art::Principal::ctor_fetch_process_history(), and art::SourceHelper::updatedProcessHistoryID_().

123  {
124  if (isCompactForm()) {
125  return hash_ != art::detail::InvalidHash();
126  }
127  return !hash_.empty();
128  }
std::string const & InvalidHash()
Definition: Hash.cc:43
std::string hash_
Definition: Hash.h:65
bool isCompactForm() const noexcept
Definition: Hash.h:200
template<int I>
bool art::Hash< I >::operator!= ( Hash< I > const &  rhs) const

Definition at line 165 of file Hash.h.

References art::Hash< I >::operator==().

166  {
167  return !operator==(rhs);
168  }
bool operator==(Hash< I > const &) const
Definition: Hash.h:154
template<int I>
bool art::Hash< I >::operator< ( Hash< I > const &  rhs) const

Definition at line 132 of file Hash.h.

References art::Hash< I >::hash_, and art::Hash< I >::isCompactForm().

133  {
134  if (isCompactForm() == rhs.isCompactForm()) {
135  return hash_ < rhs.hash_;
136  }
137  // Force both into compact form.
138  return Hash<I>{*this} < Hash<I>{rhs};
139  }
std::string hash_
Definition: Hash.h:65
bool isCompactForm() const noexcept
Definition: Hash.h:200
template<int I>
Hash< I > & art::Hash< I >::operator= ( Hash< I > const &  rhs)

Definition at line 102 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

103  {
104  if (this != &rhs) {
105  hash_ = rhs.hash_;
107  }
108  return *this;
109  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12
template<int I>
Hash< I > & art::Hash< I >::operator= ( Hash< I > &&  rhs)

Definition at line 113 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

114  {
115  hash_ = std::move(rhs.hash_);
117  return *this;
118  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12
template<int I>
bool art::Hash< I >::operator== ( Hash< I > const &  rhs) const

Definition at line 154 of file Hash.h.

References art::Hash< I >::hash_, and art::Hash< I >::isCompactForm().

Referenced by art::Hash< I >::operator!=().

155  {
156  if (isCompactForm() == rhs.isCompactForm()) {
157  return hash_ == rhs.hash_;
158  }
159  // Force both into compact form.
160  return Hash<I>{*this} == Hash<I>{rhs};
161  }
std::string hash_
Definition: Hash.h:65
bool isCompactForm() const noexcept
Definition: Hash.h:200
template<int I>
bool art::Hash< I >::operator> ( Hash< I > const &  rhs) const

Definition at line 143 of file Hash.h.

References art::Hash< I >::hash_, and art::Hash< I >::isCompactForm().

144  {
145  if (isCompactForm() == rhs.isCompactForm()) {
146  return hash_ > rhs.hash_;
147  }
148  // Force both into compact form.
149  return Hash<I>{*this} > Hash<I>{rhs};
150  }
std::string hash_
Definition: Hash.h:65
bool isCompactForm() const noexcept
Definition: Hash.h:200
template<int I>
std::ostream & art::Hash< I >::print ( std::ostream &  os) const

Definition at line 172 of file Hash.h.

References art::detail::hash_to_string().

173  {
174  Hash<I> tMe{*this};
175  return os << detail::hash_to_string(tMe.hash_);
176  }
std::string hash_to_string(std::string const &hash)
Definition: Hash.cc:34
template<int I>
void art::Hash< I >::swap ( Hash< I > &  rhs)

Definition at line 180 of file Hash.h.

References art::detail::fixup(), and art::Hash< I >::hash_.

Referenced by art::swap().

181  {
183  hash_.swap(rhs.hash_);
185  }
std::string hash_
Definition: Hash.h:65
void fixup(std::string &hash)
Definition: Hash.cc:12

Member Data Documentation


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