Template for creating a Hash::Implementation from a 64-bit hash function. More...
#include "hash-function.h"
Public Member Functions | |
Hash64 (Hash64Function_ptr hp) | |
Constructor from a 64-bit hash function pointer. | |
void | clear () override |
Restore initial state. | |
uint32_t | GetHash32 (const char *buffer, const std::size_t size) override |
Compute 32-bit hash of a byte buffer. | |
uint64_t | GetHash64 (const char *buffer, const std::size_t size) override |
Compute 64-bit hash of a byte buffer. | |
Public Member Functions inherited from ns3::Hash::Implementation | |
Implementation () | |
Constructor. | |
virtual | ~Implementation () |
Destructor. | |
virtual void | clear ()=0 |
Restore initial state. | |
virtual uint32_t | GetHash32 (const char *buffer, const std::size_t size)=0 |
Compute 32-bit hash of a byte buffer. | |
virtual uint64_t | GetHash64 (const char *buffer, const std::size_t size) |
Compute 64-bit hash of a byte buffer. | |
Public Member Functions inherited from ns3::SimpleRefCount< Implementation > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Attributes | |
Hash64Function_ptr | m_fp |
The hash function. | |
Template for creating a Hash::Implementation from a 64-bit hash function.
Definition at line 168 of file hash-function.h.
|
inline |
Constructor from a 64-bit hash function pointer.
[in] | hp | Function pointer to a 64-bit hash function. |
Definition at line 176 of file hash-function.h.
|
inlineoverridevirtual |
Restore initial state.
Implements ns3::Hash::Implementation.
Definition at line 195 of file hash-function.h.
|
inlineoverridevirtual |
Compute 32-bit hash of a byte buffer.
Call clear() between calls to GetHash32() to reset the internal state and hash each buffer separately.
If you don't call clear() between calls to GetHash32, you can hash successive buffers. The final return value will be the cumulative hash across all calls.
[in] | buffer | Pointer to the beginning of the buffer. |
[in] | size | Length of the buffer, in bytes. |
Implements ns3::Hash::Implementation.
Definition at line 186 of file hash-function.h.
References GetHash64().
|
inlineoverridevirtual |
Compute 64-bit hash of a byte buffer.
Default implementation returns 32-bit hash, with a warning.
Call clear() between calls to GetHash64() to reset the internal state and hash each buffer separately.
If you don't call clear() between calls to GetHash64, you can hash successive buffers. The final return value will be the cumulative hash across all calls.
[in] | buffer | Pointer to the beginning of the buffer. |
[in] | size | Length of the buffer, in bytes. |
Reimplemented from ns3::Hash::Implementation.
Definition at line 181 of file hash-function.h.
References m_fp.
Referenced by GetHash32().
|
private |