Drake
Drake C++ Documentation
DelegatingHasher Struct Reference

Detailed Description

An adapter that forwards the HashAlgorithm::operator(data, length) function concept into a runtime-provided std::function of the same signature.

This is useful for passing a concrete HashAlgorithm implementation through into non-templated code, such as with an Impl or Cell pattern.

#include <drake/common/hash.h>

Public Types

using Func = std::function< void(const void *, size_t)>
 A std::function whose signature matches HashAlgorithm::operator(). More...
 

Public Member Functions

 DelegatingHasher (Func func)
 Create a delegating hasher that calls the given func. More...
 
void operator() (const void *data, size_t length) noexcept
 Append [data, data + length) bytes into the wrapped algorithm. More...
 

Member Typedef Documentation

◆ Func

using Func = std::function<void(const void*, size_t)>

A std::function whose signature matches HashAlgorithm::operator().

Constructor & Destructor Documentation

◆ DelegatingHasher()

DelegatingHasher ( Func  func)
explicit

Create a delegating hasher that calls the given func.

Member Function Documentation

◆ operator()()

void operator() ( const void *  data,
size_t  length 
)
noexcept

Append [data, data + length) bytes into the wrapped algorithm.


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