16 #ifndef __OMNETPP_CHASHER_H    17 #define __OMNETPP_CHASHER_H    22 #include "simkerneldefs.h"    24 #include "cexception.h"    42     void merge(uint32_t x) {
    44         uint32_t carry = (value & 0x80000000U) >> 31;
    45         value = ((value<<1)|carry) ^ x;
    48     void merge2(uint64_t x) {
    50         merge((uint32_t)(x>>32));
    57     cHasher() {ASSERT(
sizeof(uint32_t)==4); ASSERT(
sizeof(
double)==8); value = 0;}
    61     void reset() {value = 0;}
    62     void add(
const char *p, 
size_t length);
    63     void add(
char d)           {merge((uint32_t)d);}
    64     void add(
short d)          {merge((uint32_t)d);}
    65     void add(
int d)            {merge((uint32_t)d);}
    66     void add(
long d)           {int64_t tmp=d; merge2((uint64_t)tmp);}
    67     void add(
long long d)      {merge2((uint64_t)d);}
    68     void add(
unsigned char d)  {merge((uint32_t)d);}
    69     void add(
unsigned short d) {merge((uint32_t)d);}
    70     void add(
unsigned int d)   {merge((uint32_t)d);}
    71     void add(
unsigned long d)  {uint64_t tmp=d; merge2(tmp);}
    72     void add(
unsigned long long d)  {merge2(d);}
    74     void add(
double d)         {
union _ {
double d; uint64_t i;}; merge2(((
union _ *)&d)->i);}
    75     void add(
const char *s)    {
if (s) add(s, strlen(s)+1); 
else add(0);}
    90     uint32_t parse(
const char *hash) 
const;
    95     bool equals(
const char *hash) 
const;
   100     std::string str() 
const;
 uint32_t getHash() const 
Definition: chasher.h:83
 
Utility class to calculate the hash of some data. 
Definition: chasher.h:37
 
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:311
 
cHasher()
Definition: chasher.h:57
 
Definition: cabstracthistogram.h:21