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_06_01/source/canvas/Persistency/Provenance/Hash.h"

Public Types

typedef std::string value_type
 

Public Member Functions

 Hash ()
 
 Hash (value_type const &v)
 
 Hash (Hash< I > const &)
 
Hash< I > const & operator= (Hash< I > const &iRHS)
 
bool isValid () const
 
bool operator< (Hash< I > const &other) const
 
bool operator> (Hash< I > const &other) const
 
bool operator== (Hash< I > const &other) const
 
bool operator!= (Hash< I > const &other) const
 
std::ostream & print (std::ostream &os) const
 
void swap (Hash< I > &other)
 
value_type compactForm () const
 
bool isCompactForm () const
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void throwIfIllFormed () const
 
void fixup ()
 
template<typename Op >
bool compareUsing (Hash< I > const &iOther, Op op) const
 

Private Attributes

value_type hash_
 

Detailed Description

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

Definition at line 32 of file Hash.h.

Member Typedef Documentation

template<int I>
typedef std::string art::Hash< I >::value_type

Definition at line 34 of file Hash.h.

Constructor & Destructor Documentation

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

Definition at line 100 of file Hash.h.

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

100  : hash_()
101  {
102  fixup();
103  }
void fixup()
Definition: Hash.h:210
value_type hash_
Definition: Hash.h:91
template<int I>
art::Hash< I >::Hash ( value_type const &  v)
explicit
template<int I>
art::Hash< I >::Hash ( Hash< I > const &  iOther)
inline

Definition at line 112 of file Hash.h.

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

112  : hash_(iOther.hash_)
113  {
114  fixup();
115  }
void fixup()
Definition: Hash.h:210
value_type hash_
Definition: Hash.h:91

Member Function Documentation

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

Definition at line 64 of file Hash.h.

65  {
66  return 10;
67  }
template<int I>
Hash< I >::value_type art::Hash< I >::compactForm ( ) const
inline

Definition at line 184 of file Hash.h.

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

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

185  {
186  if (this->isCompactForm()) {
187  return hash_;
188  }
189  Hash<I> tMe(*this);
190  return tMe.compactForm();
191  }
bool isCompactForm() const
Definition: Hash.h:235
value_type hash_
Definition: Hash.h:91
template<int I>
template<typename Op >
bool art::Hash< I >::compareUsing ( Hash< I > const &  iOther,
Op  op 
) const
inlineprivate

Definition at line 81 of file Hash.h.

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

82  {
83  if (this->isCompactForm() == iOther.isCompactForm()) {
84  return op(this->hash_, iOther.hash_);
85  }
86  Hash<I> tMe(*this);
87  Hash<I> tOther(iOther);
88  return op(tMe.hash_, tOther.hash_);
89  }
bool isCompactForm() const
Definition: Hash.h:235
value_type hash_
Definition: Hash.h:91
template<int I>
void art::Hash< I >::fixup ( )
private

Definition at line 210 of file Hash.h.

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

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

211  {
212  switch (hash_.size()) {
213  case 0: {
215  }
216  case 16: {
217  break;
218  }
219  case 32: {
222  hash_ = temp.compactForm();
223  break;
224  }
225  default: {
227  << "art::Hash<> instance with data in illegal state:\n"
228  << hash_ << "\nPlease report this to the core framework developers";
229  }
230  }
231  }
std::string const & InvalidHash()
void fromHexifiedString(std::string const &s)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
value_type hash_
Definition: Hash.h:91
std::string compactForm() const
template<int I>
bool art::Hash< I >::isCompactForm ( ) const
inline

Definition at line 235 of file Hash.h.

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

Referenced by art::Hash< I >::compactForm(), art::Hash< ParentageType >::compareUsing(), and art::Hash< I >::isValid().

236  {
237  return 16 == hash_.size();
238  }
value_type hash_
Definition: Hash.h:91
template<int I>
bool art::Hash< I >::isValid ( ) const
inline

Definition at line 128 of file Hash.h.

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

129  {
130  return isCompactForm() ? (hash_ != art::detail::InvalidHash()) :
131  (hash_.size() != 0);
132  }
std::string const & InvalidHash()
bool isCompactForm() const
Definition: Hash.h:235
value_type hash_
Definition: Hash.h:91
template<int I>
bool art::Hash< I >::operator!= ( Hash< I > const &  other) const
inline

Definition at line 157 of file Hash.h.

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

158  {
159  return this->compareUsing(other, std::not_equal_to<std::string>());
160  }
bool compareUsing(Hash< I > const &iOther, Op op) const
Definition: Hash.h:81
template<int I>
bool art::Hash< I >::operator< ( Hash< I > const &  other) const
inline

Definition at line 136 of file Hash.h.

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

137  {
138  return this->compareUsing(other, std::less<std::string>());
139  }
bool compareUsing(Hash< I > const &iOther, Op op) const
Definition: Hash.h:81
template<int I>
Hash< I > const & art::Hash< I >::operator= ( Hash< I > const &  iRHS)
inline

Definition at line 119 of file Hash.h.

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

120  {
121  hash_ = iRHS.hash_;
122  fixup();
123  return *this;
124  }
void fixup()
Definition: Hash.h:210
value_type hash_
Definition: Hash.h:91
template<int I>
bool art::Hash< I >::operator== ( Hash< I > const &  other) const
inline

Definition at line 150 of file Hash.h.

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

151  {
152  return this->compareUsing(other, std::equal_to<std::string>());
153  }
bool compareUsing(Hash< I > const &iOther, Op op) const
Definition: Hash.h:81
template<int I>
bool art::Hash< I >::operator> ( Hash< I > const &  other) const
inline

Definition at line 143 of file Hash.h.

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

144  {
145  return this->compareUsing(other, std::greater<std::string>());
146  }
bool compareUsing(Hash< I > const &iOther, Op op) const
Definition: Hash.h:81
template<int I>
std::ostream & art::Hash< I >::print ( std::ostream &  os) const
inline

Definition at line 164 of file Hash.h.

References cet::MD5Result::bytes, cet::copy_all(), art::Hash< I >::hash_, APDHVSetting::temp, and cet::MD5Result::toString().

165  {
166  Hash<I> tMe(*this);
168  cet::copy_all(tMe.hash_, temp.bytes);
169  os << temp.toString();
170  return os;
171  }
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 > &  other)
inline

Definition at line 175 of file Hash.h.

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

Referenced by art::ProcessHistory::swap(), and art::swap().

176  {
177  fixup();
178  hash_.swap(other.hash_);
179  fixup();
180  }
void fixup()
Definition: Hash.h:210
value_type hash_
Definition: Hash.h:91
template<int I>
void art::Hash< I >::throwIfIllFormed ( ) const
inlineprivate

Definition at line 195 of file Hash.h.

References art::Hash< I >::hash_, and art::errors::LogicError.

196  {
197  // Fixup not needed here.
198  if (hash_.size() % 2 == 1) {
200  << "Ill-formed Hash instance. "
201  << "Please report this to the core framework developers";
202  }
203  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
value_type hash_
Definition: Hash.h:91

Member Data Documentation

template<int I>
value_type art::Hash< I >::hash_
private

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