HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hash.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/tf/tf.h"
#include "pxr/base/tf/api.h"
#include <cstring>
#include <string>
#include <map>
#include <memory>
#include <set>
#include <typeindex>
#include <type_traits>
#include <utility>
#include <vector>
+ Include dependency graph for hash.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Tf_SizedUnsignedInt< Size >
 
struct  Tf_SizedUnsignedInt< 1 >
 
struct  Tf_SizedUnsignedInt< 2 >
 
struct  Tf_SizedUnsignedInt< 4 >
 
struct  Tf_SizedUnsignedInt< 8 >
 
struct  TfCStrHashWrapper
 
class  Tf_HashStateAPI< Derived >
 
class  Tf_HashState
 
class  TfHash
 
struct  TfHashCharPtr
 A hash function object that hashes the address of a char pointer. More...
 
struct  TfHashCString
 A hash function object that hashes null-terminated c-string content. More...
 
struct  TfEqualCString
 A function object that compares two c-strings for equality. More...
 

Functions

template<class HashState , class T >
PXR_NAMESPACE_OPEN_SCOPE
std::enable_if_t
< std::is_integral< T >::value
TfHashAppend (HashState &h, T integral)
 
template<class HashState , class Enum >
std::enable_if_t< std::is_enum
< Enum >::value
TfHashAppend (HashState &h, Enum e)
 
template<class HashState , class T >
std::enable_if_t
< std::is_floating_point< T >
::value
TfHashAppend (HashState &h, T fp)
 
template<class HashState , class T , class U >
void TfHashAppend (HashState &h, std::pair< T, U > const &p)
 
template<class HashState , class T >
std::enable_if_t<!std::is_same
< std::remove_const_t< T >
, bool >::value
TfHashAppend (HashState &h, std::vector< T > const &vec)
 
template<class HashState >
void TfHashAppend (HashState &h, std::vector< bool > const &vec)
 
template<class HashState , class T , class Compare >
void TfHashAppend (HashState &h, std::set< T, Compare > const &elements)
 
template<class HashState , class Key , class Value , class Compare >
void TfHashAppend (HashState &h, std::map< Key, Value, Compare > const &elements)
 
template<class HashState >
void TfHashAppend (HashState &h, std::type_index const &type_index)
 
template<class HashState >
void TfHashAppend (HashState &h, const std::string &s)
 
template<class HashState , class T >
void TfHashAppend (HashState &h, const T *ptr)
 
template<class HashState , class T >
void TfHashAppend (HashState &h, const std::shared_ptr< T > &ptr)
 
template<class HashState , class T >
void TfHashAppend (HashState &h, const std::unique_ptr< T > &ptr)
 
template<class HashState >
void TfHashAppend (HashState &h, char const *ptr)=delete
 
template<class HashState >
void TfHashAppend (HashState &h, char *ptr)=delete
 
TfCStrHashWrapper TfHashAsCStr (char const *cstr)
 
template<class HashState >
void TfHashAppend (HashState &h, TfCStrHashWrapper hcstr)
 
template<class HashState , class T >
auto Tf_HashImpl (HashState &h, T &&obj, long) -> decltype(hash_value(std::forward< T >(obj)), void())
 
template<class HashState , class T >
auto Tf_HashImpl (HashState &h, T &&obj, int) -> decltype(TfHashAppend(h, std::forward< T >(obj)), void())
 

Function Documentation

template<class HashState , class T >
auto Tf_HashImpl ( HashState &  h,
T &&  obj,
long   
) -> decltype(hash_value(std::forward<T>(obj)), void())
inline

Definition at line 231 of file hash.h.

template<class HashState , class T >
auto Tf_HashImpl ( HashState &  h,
T &&  obj,
int   
) -> decltype(TfHashAppend(h, std::forward<T>(obj)), void())
inline

Definition at line 239 of file hash.h.

template<class HashState , class T >
PXR_NAMESPACE_OPEN_SCOPE std::enable_if_t<std::is_integral<T>::value> TfHashAppend ( HashState &  h,
integral 
)

Definition at line 49 of file hash.h.

template<class HashState , class Enum >
std::enable_if_t<std::is_enum<Enum>::value> TfHashAppend ( HashState &  h,
Enum  e 
)

Definition at line 65 of file hash.h.

template<class HashState , class T >
std::enable_if_t<std::is_floating_point<T>::value> TfHashAppend ( HashState &  h,
fp 
)

Definition at line 73 of file hash.h.

template<class HashState , class T , class U >
void TfHashAppend ( HashState &  h,
std::pair< T, U > const p 
)
inline

Definition at line 87 of file hash.h.

template<class HashState , class T >
std::enable_if_t<!std::is_same<std::remove_const_t<T>, bool>::value> TfHashAppend ( HashState &  h,
std::vector< T > const vec 
)
inline

Definition at line 96 of file hash.h.

template<class HashState >
void TfHashAppend ( HashState &  h,
std::vector< bool > const vec 
)
inline

Definition at line 104 of file hash.h.

template<class HashState , class T , class Compare >
void TfHashAppend ( HashState &  h,
std::set< T, Compare > const elements 
)
inline

Definition at line 114 of file hash.h.

template<class HashState , class Key , class Value , class Compare >
void TfHashAppend ( HashState &  h,
std::map< Key, Value, Compare > const elements 
)
inline

Definition at line 124 of file hash.h.

template<class HashState >
void TfHashAppend ( HashState &  h,
std::type_index const type_index 
)
inline

Definition at line 133 of file hash.h.

template<class HashState >
void TfHashAppend ( HashState &  h,
const std::string s 
)
inline

Definition at line 141 of file hash.h.

template<class HashState , class T >
void TfHashAppend ( HashState &  h,
const T *  ptr 
)
inline

Definition at line 150 of file hash.h.

template<class HashState , class T >
void TfHashAppend ( HashState &  h,
const std::shared_ptr< T > &  ptr 
)
inline

Definition at line 158 of file hash.h.

template<class HashState , class T >
void TfHashAppend ( HashState &  h,
const std::unique_ptr< T > &  ptr 
)
inline

Definition at line 166 of file hash.h.

template<class HashState >
void TfHashAppend ( HashState &  h,
char const ptr 
)
inlinedelete
template<class HashState >
void TfHashAppend ( HashState &  h,
char *  ptr 
)
inlinedelete
template<class HashState >
void TfHashAppend ( HashState &  h,
TfCStrHashWrapper  hcstr 
)
inline

Definition at line 203 of file hash.h.

TfCStrHashWrapper TfHashAsCStr ( char const cstr)
inline

Indicate that a char pointer is intended to be hashed as a C-style null terminated string. Use this to wrap a char pointer in a HashState::Append() call when implementing a TfHashAppend overload.

This structure provides a lightweight view on the char pointer passed to its constructor. It does not copy the data or participate in its lifetime. The passed char pointer must remain valid as long as this struct is used.

Definition at line 197 of file hash.h.