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.

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

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

18  {
19  if (isCompactForm_(hash)) {
20  return hash;
21  }
23  fixup_(temp);
24  return temp;
25  }
bool isCompactForm_(value_type const &hash)
Definition: Hash.cc:61
void fixup_(value_type &hash)
Definition: Hash.cc:30

◆ fixup_()

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

Definition at line 30 of file Hash.cc.

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_().

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  }

◆ isCompactForm_()

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

Definition at line 61 of file Hash.cc.

References cond::hash.

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

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

◆ isValid_()

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

Definition at line 63 of file Hash.cc.

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

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

63  {
64  return isCompactForm_(hash) ? (hash != detail::InvalidHash()) : (!hash.empty());
65  }
bool isCompactForm_(value_type const &hash)
Definition: Hash.cc:61
std::string const & InvalidHash()
Definition: Hash.cc:11

◆ print_()

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

Definition at line 92 of file Hash.cc.

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

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

92  {
93  value_type temp1(hash);
94  fixup_(temp1);
96  copy_all(temp1, temp.bytes);
97  os << temp.toString();
98  return os;
99  }
void fixup_(value_type &hash)
Definition: Hash.cc:30
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20

◆ smallHash_()

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

Definition at line 52 of file Hash.cc.

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

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

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  }
value_type compactForm_(value_type const &hash)
Definition: Hash.cc:18
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ throwIfIllFormed()

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

Definition at line 67 of file Hash.cc.

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

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  }

◆ toDigest_()

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

Definition at line 83 of file Hash.cc.

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

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

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  }
void fixup_(value_type &hash)
Definition: Hash.cc:30
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20
void append(std::string const &s)
Definition: Digest.cc:161

◆ toString_()

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

Definition at line 75 of file Hash.cc.

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

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

75  {
76  value_type temp1(hash);
77  fixup_(temp1);
79  copy_all(temp1, temp.bytes);
80  result += temp.toString();
81  }
void fixup_(value_type &hash)
Definition: Hash.cc:30
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:20