CMS 3D CMS Logo

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

◆ value_type

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

Definition at line 30 of file Hash.h.

Function Documentation

◆ compactForm_()

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

Definition at line 18 of file Hash.cc.

18  {
19  if (isCompactForm_(hash)) {
20  return hash;
21  }
23  fixup_(temp);
24  return temp;
25  }

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

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

◆ fixup_()

void edm::hash_detail::fixup_ ( value_type hash)

Definition at line 30 of file Hash.cc.

30  {
31  switch (hash.size()) {
32  case 16: {
33  break;
34  }
35  case 32: {
37  temp.fromHexifiedString(hash);
38  hash = temp.compactForm();
39  break;
40  }
41  case 0: {
42  throw Exception(errors::LogicError) << "Empty edm::Hash<> instance:\n"
43  << "\nPlease report this to the core framework developers";
44  }
45  default: {
46  throw Exception(errors::LogicError) << "edm::Hash<> instance with data in illegal state:\n"
47  << hash << "\nPlease report this to the core framework developers";
48  }
49  }
50  }

References Exception, cond::hash, edm::errors::LogicError, and groupFilesInBlocks::temp.

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

◆ isCompactForm_()

bool edm::hash_detail::isCompactForm_ ( value_type const &  hash)

Definition at line 61 of file Hash.cc.

61 { return 16 == hash.size(); }

References cond::hash.

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

◆ isValid_()

bool edm::hash_detail::isValid_ ( value_type const &  hash)

Definition at line 63 of file Hash.cc.

63  {
64  return isCompactForm_(hash) ? (hash != detail::InvalidHash()) : (!hash.empty());
65  }

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

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

◆ print_()

std::ostream & edm::hash_detail::print_ ( std::ostream &  os,
value_type const &  hash 
)

Definition at line 92 of file Hash.cc.

92  {
93  value_type temp1(hash);
94  fixup_(temp1);
96  copy_all(temp1, temp.bytes);
97  os << temp.toString();
98  return os;
99  }

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

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

◆ smallHash_()

size_t edm::hash_detail::smallHash_ ( value_type const &  hash)

Definition at line 52 of file Hash.cc.

52  {
53  //NOTE: In future we could try to xor the first 8bytes into the second 8bytes of the string to make the hash
54  std::hash<std::string> h;
55  if (hash.size() == 16) {
56  return h(hash);
57  }
58  return h(compactForm_(hash));
59  }

References compactForm_(), h, and cond::hash.

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

◆ throwIfIllFormed()

void edm::hash_detail::throwIfIllFormed ( value_type const &  hash)

Definition at line 67 of file Hash.cc.

67  {
68  // Fixup not needed here.
69  if (hash.size() % 2 == 1) {
70  throw Exception(errors::LogicError) << "Ill-formed Hash instance. "
71  << "Please report this to the core framework developers";
72  }
73  }

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

◆ toDigest_()

void edm::hash_detail::toDigest_ ( cms::Digest digest,
value_type const &  hash 
)

Definition at line 83 of file Hash.cc.

83  {
84  // FIXME: do we really need to go through a temporary value_type???
85  value_type temp1(hash);
86  fixup_(temp1);
88  copy_all(temp1, temp.bytes);
89  digest.append(temp.toString());
90  }

References cms::Digest::append(), edm::copy_all(), fixup_(), cond::hash, and groupFilesInBlocks::temp.

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

◆ toString_()

void edm::hash_detail::toString_ ( std::string &  result,
value_type const &  hash 
)

Definition at line 75 of file Hash.cc.

75  {
76  value_type temp1(hash);
77  fixup_(temp1);
79  copy_all(temp1, temp.bytes);
80  result += temp.toString();
81  }

References edm::copy_all(), fixup_(), cond::hash, mps_fire::result, and groupFilesInBlocks::temp.

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

cms::Digest::append
void append(std::string const &s)
Definition: Digest.cc:161
edm::copy_all
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
edm::errors::LogicError
Definition: EDMException.h:37
cond::hash
Definition: Time.h:19
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
edm::hash_detail::fixup_
void fixup_(value_type &hash)
Definition: Hash.cc:30
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
cms::MD5Result
Definition: Digest.h:11
edm::hash_detail::compactForm_
value_type compactForm_(value_type const &hash)
Definition: Hash.cc:18
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
Exception
Definition: hltDiff.cc:246
mps_fire.result
result
Definition: mps_fire.py:311
edm::hash_detail::isCompactForm_
bool isCompactForm_(value_type const &hash)
Definition: Hash.cc:61
edm::detail::InvalidHash
std::string const & InvalidHash()
Definition: Hash.cc:11