CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Typedefs | Functions
edm::hash_detail Namespace Reference

Typedefs

typedef std::string value_type
 

Functions

value_type compactForm_ (value_type const &hash)
 
void fixup_ (value_type &hash)
 
bool isCompactForm_ (value_type const &hash)
 
bool isValid_ (value_type const &hash)
 
std::ostream & print_ (std::ostream &os, value_type const &hash)
 
size_t smallHash_ (value_type const &hash)
 
void throwIfIllFormed (value_type const &hash)
 
void toDigest_ (cms::Digest &digest, value_type const &hash)
 
void toString_ (std::string &result, value_type const &hash)
 

Typedef Documentation

typedef std::string edm::hash_detail::value_type

Definition at line 30 of file Hash.h.

Function Documentation

value_type edm::hash_detail::compactForm_ ( value_type const &  hash)

Definition at line 19 of file Hash.cc.

References fixup_(), cond::hash, isCompactForm_(), and groupFilesInBlocks::temp.

Referenced by edm::Hash< I >::compactForm(), and smallHash_().

19  {
20  if (isCompactForm_(hash)) {
21  return hash;
22  }
24  fixup_(temp);
25  return temp;
26  }
bool isCompactForm_(value_type const &hash)
Definition: Hash.cc:67
void edm::hash_detail::fixup_ ( value_type &  hash)

Definition at line 32 of file Hash.cc.

References cms::MD5Result::compactForm(), Exception, cms::MD5Result::fromHexifiedString(), edm::errors::LogicError, and groupFilesInBlocks::temp.

Referenced by compactForm_(), edm::Hash< I >::Hash(), edm::Hash< I >::operator=(), print_(), toDigest_(), and toString_().

32  {
33  switch (hash.size()) {
34  case 16: {
35  break;
36  }
37  case 32: {
40  hash = temp.compactForm();
41  break;
42  }
43  case 0: {
45  << "Empty edm::Hash<> instance:\n" << "\nPlease report this to the core framework developers";
46  }
47  default: {
49  << "edm::Hash<> instance with data in illegal state:\n"
50  << hash
51  << "\nPlease report this to the core framework developers";
52  }
53  }
54  }
void fromHexifiedString(std::string const &s)
Definition: Digest.cc:111
std::string compactForm() const
Definition: Digest.cc:102
bool edm::hash_detail::isCompactForm_ ( value_type const &  hash)

Definition at line 67 of file Hash.cc.

Referenced by compactForm_(), edm::Hash< EntryDescriptionType >::compareUsing(), edm::Hash< I >::isCompactForm(), and isValid_().

67  {
68  return 16 == hash.size();
69  }
bool edm::hash_detail::isValid_ ( value_type const &  hash)

Definition at line 72 of file Hash.cc.

References edm::detail::InvalidHash(), and isCompactForm_().

Referenced by edm::Hash< I >::isValid().

72  {
73  return isCompactForm_(hash) ? (hash != detail::InvalidHash()) : (!hash.empty());
74  }
bool isCompactForm_(value_type const &hash)
Definition: Hash.cc:67
std::ostream & edm::hash_detail::print_ ( std::ostream &  os,
value_type const &  hash 
)

Definition at line 106 of file Hash.cc.

References cms::MD5Result::bytes, edm::copy_all(), fixup_(), groupFilesInBlocks::temp, and cms::MD5Result::toString().

Referenced by EcalTPGAnalyzer::analyze(), EcalTPGAnalyzer::EcalTPGAnalyzer(), and edm::Hash< I >::print().

106  {
107  value_type temp1(hash);
108  fixup_(temp1);
110  copy_all(temp1, temp.bytes);
111  os << temp.toString();
112  return os;
113  }
unsigned char bytes[16]
Definition: Digest.h:21
std::string toString() const
Definition: Digest.cc:87
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24
size_t edm::hash_detail::smallHash_ ( value_type const &  hash)

Definition at line 57 of file Hash.cc.

References compactForm_(), and h.

Referenced by edm::Hash< I >::smallHash().

57  {
58  //NOTE: In future we could try to xor the first 8bytes into the second 8bytes of the string to make the hash
59  std::hash<std::string> h;
60  if (hash.size()==16) {
61  return h(hash);
62  }
63  return h(compactForm_(hash));
64  }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
value_type compactForm_(value_type const &hash)
Definition: Hash.cc:19
void edm::hash_detail::throwIfIllFormed ( value_type const &  hash)

Definition at line 77 of file Hash.cc.

References Exception, and edm::errors::LogicError.

77  {
78  // Fixup not needed here.
79  if (hash.size() % 2 == 1) {
81  << "Ill-formed Hash instance. "
82  << "Please report this to the core framework developers";
83  }
84  }
void edm::hash_detail::toDigest_ ( cms::Digest digest,
value_type const &  hash 
)

Definition at line 96 of file Hash.cc.

References cms::Digest::append(), cms::MD5Result::bytes, edm::copy_all(), fixup_(), groupFilesInBlocks::temp, and cms::MD5Result::toString().

Referenced by edm::Hash< I >::toDigest().

96  {
97  // FIXME: do we really need to go through a temporary value_type???
98  value_type temp1(hash);
99  fixup_(temp1);
101  copy_all(temp1, temp.bytes);
102  digest.append(temp.toString());
103  }
unsigned char bytes[16]
Definition: Digest.h:21
std::string toString() const
Definition: Digest.cc:87
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24
void append(std::string const &s)
Definition: Digest.cc:182
void edm::hash_detail::toString_ ( std::string &  result,
value_type const &  hash 
)

Definition at line 87 of file Hash.cc.

References cms::MD5Result::bytes, edm::copy_all(), fixup_(), groupFilesInBlocks::temp, and cms::MD5Result::toString().

Referenced by edm::Hash< I >::toString().

87  {
88  value_type temp1(hash);
89  fixup_(temp1);
91  copy_all(temp1, temp.bytes);
92  result += temp.toString();
93  }
unsigned char bytes[16]
Definition: Digest.h:21
tuple result
Definition: mps_fire.py:84
std::string toString() const
Definition: Digest.cc:87
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24