A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Hash::Function::Hash32 Class Reference

Template for creating a Hash::Implementation from a 32-bit hash function. More...

#include "hash-function.h"

+ Inheritance diagram for ns3::Hash::Function::Hash32:
+ Collaboration diagram for ns3::Hash::Function::Hash32:

Public Member Functions

 Hash32 (Hash32Function_ptr hp)
 Constructor from a 32-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.
 
- 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.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Attributes

Hash32Function_ptr m_fp
 The hash function.
 

Detailed Description

Template for creating a Hash::Implementation from a 32-bit hash function.

Definition at line 136 of file hash-function.h.

Constructor & Destructor Documentation

◆ Hash32()

ns3::Hash::Function::Hash32::Hash32 ( Hash32Function_ptr  hp)
inline

Constructor from a 32-bit hash function pointer.

Parameters
[in]hpFunction pointer to a 32-bit hash function.

Definition at line 144 of file hash-function.h.

Member Function Documentation

◆ clear()

void ns3::Hash::Function::Hash32::clear ( )
inlineoverridevirtual

Restore initial state.

Implements ns3::Hash::Implementation.

Definition at line 154 of file hash-function.h.

◆ GetHash32()

uint32_t ns3::Hash::Function::Hash32::GetHash32 ( const char *  buffer,
const std::size_t  size 
)
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.

Parameters
[in]bufferPointer to the beginning of the buffer.
[in]sizeLength of the buffer, in bytes.
Returns
32-bit hash of the buffer.

Implements ns3::Hash::Implementation.

Definition at line 149 of file hash-function.h.

References m_fp.

Member Data Documentation

◆ m_fp

Hash32Function_ptr ns3::Hash::Function::Hash32::m_fp
private

The hash function.

Definition at line 159 of file hash-function.h.

Referenced by GetHash32().


The documentation for this class was generated from the following file: