Drake
DelegatingHasher Struct Reference

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

#include <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...
 

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.

Member Typedef Documentation

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

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

Constructor & Destructor Documentation

DelegatingHasher ( Func  func)
inlineexplicit

Create a delegating hasher that calls the given func.

Member Function Documentation

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

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


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