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 "/cvmfs/nova.opensciencegrid.org/externals/canvas/v3_09_01/source/canvas/Persistency/Provenance/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 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 80 of file Hash.h.

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

Definition at line 86 of file Hash.h.

References art::Hash< I >::fixup().

86  : hash_{s}
87  {
88  fixup();
89  }
void fixup()
Definition: Hash.h:211
const XML_Char * s
Definition: expat.h:262
std::string hash_
Definition: Hash.h:68
template<int I>
art::Hash< I >::Hash ( Hash< I > const &  rhs)

Definition at line 92 of file Hash.h.

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

92  : hash_{rhs.hash_}
93  {
94  fixup();
95  }
void fixup()
Definition: Hash.h:211
std::string hash_
Definition: Hash.h:68
template<int I>
art::Hash< I >::Hash ( Hash< I > &&  rhs)

Definition at line 98 of file Hash.h.

References art::Hash< I >::fixup().

98  : hash_{std::move(rhs.hash_)}
99  {
100  fixup();
101  }
void fixup()
Definition: Hash.h:211
std::string hash_
Definition: Hash.h:68

Member Function Documentation

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

Definition at line 74 of file Hash.h.

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

Definition at line 200 of file Hash.h.

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

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

201  {
202  if (isCompactForm()) {
203  return hash_;
204  }
205  Hash<I> tMe(*this);
206  return tMe.compactForm();
207  }
std::string hash_
Definition: Hash.h:68
bool isCompactForm() const noexcept
Definition: Hash.h:234
template<int I>
void art::Hash< I >::fixup ( )
private

Definition at line 211 of file Hash.h.

References cet::MD5Result::compactForm(), cet::MD5Result::fromHexifiedString(), art::Hash< I >::hash_, art::detail::InvalidHash(), and art::errors::LogicError.

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

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

Definition at line 125 of file Hash.h.

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

126  {
127  if (isCompactForm()) {
128  auto ret = hash_ != art::detail::InvalidHash();
129  return ret;
130  }
131  return !hash_.empty();
132  }
std::string const & InvalidHash()
std::string hash_
Definition: Hash.h:68
bool isCompactForm() const noexcept
Definition: Hash.h:234
template<int I>
bool art::Hash< I >::operator!= ( Hash< I > const &  rhs) const

Definition at line 169 of file Hash.h.

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

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

Definition at line 136 of file Hash.h.

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

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

Definition at line 105 of file Hash.h.

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

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

Definition at line 116 of file Hash.h.

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

117  {
118  hash_ = std::move(rhs.hash_);
119  fixup();
120  return *this;
121  }
void fixup()
Definition: Hash.h:211
std::string hash_
Definition: Hash.h:68
template<int I>
bool art::Hash< I >::operator== ( Hash< I > const &  rhs) const

Definition at line 158 of file Hash.h.

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

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

Definition at line 147 of file Hash.h.

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

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

Definition at line 180 of file Hash.h.

References cet::MD5Result::bytes, cet::copy_all(), APDHVSetting::temp, and cet::MD5Result::toString().

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

Definition at line 191 of file Hash.h.

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

Referenced by art::swap().

192  {
193  fixup();
194  hash_.swap(rhs.hash_);
195  fixup();
196  }
void fixup()
Definition: Hash.h:211
std::string hash_
Definition: Hash.h:68

Member Data Documentation

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

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