Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 Member Functions

void fixup ()
 

Private Attributes

std::string hash_ {}
 

Detailed Description

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

Definition at line 32 of file Hash.h.

Member Typedef Documentation

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

Definition at line 34 of file Hash.h.

Constructor & Destructor Documentation

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

Definition at line 78 of file Hash.h.

79  {
80  fixup();
81  }
void fixup()
Definition: Hash.h:208
template<int I>
art::Hash< I >::Hash ( std::string const &  s)
explicit

Definition at line 84 of file Hash.h.

84  : hash_{s}
85  {
86  fixup();
87  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66
static QCString * s
Definition: config.cpp:1042
template<int I>
art::Hash< I >::Hash ( Hash< I > const &  rhs)

Definition at line 90 of file Hash.h.

90  : hash_{rhs.hash_}
91  {
92  fixup();
93  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66
template<int I>
art::Hash< I >::Hash ( Hash< I > &&  rhs)

Definition at line 96 of file Hash.h.

96  : hash_{std::move(rhs.hash_)}
97  {
98  fixup();
99  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66
def move(depos, offset)
Definition: depos.py:107

Member Function Documentation

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

Definition at line 72 of file Hash.h.

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

Definition at line 197 of file Hash.h.

198  {
199  if (isCompactForm()) {
200  return hash_;
201  }
202  Hash<I> tMe(*this);
203  return tMe.compactForm();
204  }
std::string hash_
Definition: Hash.h:66
bool isCompactForm() const noexcept
Definition: Hash.h:231
template<int I>
void art::Hash< I >::fixup ( )
private

Definition at line 208 of file Hash.h.

209  {
210  if (hash_.size() == 16) {
211  // Already in compact form.
212  return;
213  }
214  if (hash_.size() == 0) {
216  return;
217  }
218  if (hash_.size() == 32) {
219  cet::MD5Result md5;
221  hash_ = md5.compactForm();
222  return;
223  }
225  << "art::Hash<> instance with data in illegal state:\n"
226  << hash_ << "\nPlease report this to the core framework developers";
227  }
std::string const & InvalidHash()
Definition: Hash.cc:7
void fromHexifiedString(std::string const &s)
Definition: MD5Digest.cc:78
std::string hash_
Definition: Hash.h:66
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string compactForm() const
Definition: MD5Digest.cc:68
template<int I>
bool art::Hash< I >::isCompactForm ( ) const
noexcept

Definition at line 231 of file Hash.h.

232  {
233  return hash_.size() == 16;
234  }
std::string hash_
Definition: Hash.h:66
template<int I>
bool art::Hash< I >::isValid ( ) const

Definition at line 123 of file Hash.h.

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

Definition at line 166 of file Hash.h.

167  {
168  if (isCompactForm() == rhs.isCompactForm()) {
169  return hash_ != rhs.hash_;
170  }
171  // Force both into compact form.
172  return Hash<I>{*this} != Hash<I>{rhs};
173  }
std::string hash_
Definition: Hash.h:66
bool isCompactForm() const noexcept
Definition: Hash.h:231
template<int I>
bool art::Hash< I >::operator< ( Hash< I > const &  rhs) const

Definition at line 133 of file Hash.h.

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

Definition at line 103 of file Hash.h.

104  {
105  if (this != &rhs) {
106  hash_ = rhs.hash_;
107  fixup();
108  }
109  return *this;
110  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66
template<int I>
Hash< I > & art::Hash< I >::operator= ( Hash< I > &&  rhs)

Definition at line 114 of file Hash.h.

115  {
116  hash_ = std::move(rhs.hash_);
117  fixup();
118  return *this;
119  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66
def move(depos, offset)
Definition: depos.py:107
template<int I>
bool art::Hash< I >::operator== ( Hash< I > const &  rhs) const

Definition at line 155 of file Hash.h.

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

Definition at line 144 of file Hash.h.

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

Definition at line 177 of file Hash.h.

178  {
179  Hash<I> tMe{*this};
181  cet::copy_all(tMe.hash_, temp.bytes);
182  os << temp.toString();
183  return os;
184  }
std::string toString() const
Definition: MD5Digest.cc:45
unsigned char bytes[16]
Definition: MD5Digest.h:24
auto copy_all(FwdCont &, FwdIter)
template<int I>
void art::Hash< I >::swap ( Hash< I > &  rhs)

Definition at line 188 of file Hash.h.

189  {
190  fixup();
191  hash_.swap(rhs.hash_);
192  fixup();
193  }
void fixup()
Definition: Hash.h:208
std::string hash_
Definition: Hash.h:66

Member Data Documentation

template<int I>
std::string art::Hash< I >::hash_ {}
private

Definition at line 66 of file Hash.h.


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