PtexHashMap< Key, Value > Class Template Reference

`#include <PtexHashMap.h>`

## Classes

class | Entry

## Public Member Functions

| PtexHashMap ()
| ~PtexHashMap ()
void | clear ()
uint32_t | size () const
Value | get (Key &key)
Value | tryInsert (Key &key, Value value, size_t &newMemUsed)
template<typename Fn >
void | foreach (Fn &fn)

## Private Member Functions

| PtexHashMap (const PtexHashMap &)
void | operator= (const PtexHashMap &)
void | initContents ()
void | deleteContents ()
Entry * | getEntries ()
Entry * | lockEntries ()
void | unlockEntries (Entry *entries)
Entry * | lockEntriesAndGrowIfNeeded (size_t &newMemUsed)
Entry * | grow (Entry *oldEntries, size_t &newMemUsed)

## Private Attributes

Entry *volatile | _entries
uint32_t volatile | _numEntries
uint32_t volatile | _size
std::vector< Entry * > | _oldEntries

## Detailed Description

template<typename Key, typename Value>
class PtexHashMap< Key, Value >

Definition at line 151 of file PtexHashMap.h.

## Constructor & Destructor Documentation

## PtexHashMap() [1/2]

template<typename Key , typename Value >

PtexHashMap< Key, Value >::PtexHashMap | ( | const PtexHashMap< Key, Value > & |  | ) |

private

## PtexHashMap() [2/2]

template<typename Key , typename Value >

PtexHashMap< Key, Value >::PtexHashMap | ( |  | ) |

inline

Definition at line 185 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::initContents().

## ~PtexHashMap()

template<typename Key , typename Value >

PtexHashMap< Key, Value >::~PtexHashMap | ( |  | ) |

inline

Definition at line 190 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::deleteContents().

## Member Function Documentation

## clear()

template<typename Key , typename Value >

void PtexHashMap< Key, Value >::clear | ( |  | ) |

inline

Definition at line 195 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::deleteContents(), and PtexHashMap< Key, Value >::initContents().

Referenced by PtexReader::prune().

## deleteContents()

template<typename Key , typename Value >

void PtexHashMap< Key, Value >::deleteContents | ( |  | ) |

inlineprivate

Definition at line 172 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_entries, PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::_oldEntries, and PtexHashMap< Key, Value >::Entry::value.

Referenced by PtexHashMap< Key, Value >::clear(), and PtexHashMap< Key, Value >::~PtexHashMap().

## foreach()

template<typename Key , typename Value >
template<typename Fn >

void PtexHashMap< Key, Value >::foreach | ( | Fn & | fn | ) |

inline

Definition at line 252 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::getEntries(), and PtexHashMap< Key, Value >::Entry::value.

Referenced by PtexReaderCache::purgeAll().

## get()

template<typename Key , typename Value >

Value PtexHashMap< Key, Value >::get | ( | Key & | key | ) |

inline

Definition at line 203 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::getEntries(), PtexHashMap< Key, Value >::Entry::key, and PtexHashMap< Key, Value >::Entry::value.

Referenced by PtexReaderCache::get(), PtexReader::getData(), and PtexReaderCache::purge().

## getEntries()

template<typename Key , typename Value >

Entry * PtexHashMap< Key, Value >::getEntries | ( |  | ) |

inlineprivate

Definition at line 262 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_entries.

Referenced by PtexHashMap< Key, Value >::foreach(), and PtexHashMap< Key, Value >::get().

## grow()

template<typename Key , typename Value >

Entry * PtexHashMap< Key, Value >::grow | ( | Entry * | oldEntries,
|  | size_t & | newMemUsed
| ) |  |

inlineprivate

Definition at line 294 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::_oldEntries, PtexHashMap< Key, Value >::Entry::key, and PtexHashMap< Key, Value >::Entry::value.

Referenced by PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded().

## initContents()

template<typename Key , typename Value >

void PtexHashMap< Key, Value >::initContents | ( |  | ) |

inlineprivate

Definition at line 165 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_entries, PtexHashMap< Key, Value >::_numEntries, and PtexHashMap< Key, Value >::_size.

Referenced by PtexHashMap< Key, Value >::clear(), and PtexHashMap< Key, Value >::PtexHashMap().

## lockEntries()

template<typename Key , typename Value >

Entry * PtexHashMap< Key, Value >::lockEntries | ( |  | ) |

inlineprivate

Definition at line 270 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_entries, and AtomicCompareAndSwap().

Referenced by PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded().

## lockEntriesAndGrowIfNeeded()

template<typename Key , typename Value >

Entry * PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded | ( | size_t & | newMemUsed | ) |

inlineprivate

Definition at line 285 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::_size, PtexHashMap< Key, Value >::grow(), and PtexHashMap< Key, Value >::lockEntries().

Referenced by PtexHashMap< Key, Value >::tryInsert().

## operator=()

template<typename Key , typename Value >

void PtexHashMap< Key, Value >::operator= | ( | const PtexHashMap< Key, Value > & |  | ) |

private

## size()

template<typename Key , typename Value >

uint32_t PtexHashMap< Key, Value >::size | ( |  | ) | const

inline

Definition at line 201 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_size.

Referenced by PtexReaderCache::getStats().

## tryInsert()

template<typename Key , typename Value >

Value PtexHashMap< Key, Value >::tryInsert | ( | Key & | key,
|  | Value | value,
|  | size_t & | newMemUsed
| ) |  |

inline

Definition at line 224 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_numEntries, PtexHashMap< Key, Value >::_size, PtexHashMap< Key, Value >::Entry::key, PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded(), PtexMemoryFence(), PtexHashMap< Key, Value >::unlockEntries(), and PtexHashMap< Key, Value >::Entry::value.

Referenced by PtexReaderCache::get(), and PtexReader::getData().

## unlockEntries()

template<typename Key , typename Value >

void PtexHashMap< Key, Value >::unlockEntries | ( | Entry * | entries | ) |

inlineprivate

Definition at line 280 of file PtexHashMap.h.

References PtexHashMap< Key, Value >::_entries, and AtomicStore().

Referenced by PtexHashMap< Key, Value >::tryInsert().

## Member Data Documentation

## _entries

template<typename Key , typename Value >

Entry* volatile PtexHashMap< Key, Value >::_entries

private

Definition at line 318 of file PtexHashMap.h.

Referenced by PtexHashMap< Key, Value >::deleteContents(), PtexHashMap< Key, Value >::getEntries(), PtexHashMap< Key, Value >::initContents(), PtexHashMap< Key, Value >::lockEntries(), and PtexHashMap< Key, Value >::unlockEntries().

## _numEntries

template<typename Key , typename Value >

uint32_t volatile PtexHashMap< Key, Value >::_numEntries

private

Definition at line 319 of file PtexHashMap.h.

Referenced by PtexHashMap< Key, Value >::deleteContents(), PtexHashMap< Key, Value >::foreach(), PtexHashMap< Key, Value >::get(), PtexHashMap< Key, Value >::grow(), PtexHashMap< Key, Value >::initContents(), PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded(), and PtexHashMap< Key, Value >::tryInsert().

## _oldEntries

template<typename Key , typename Value >

std::vector<Entry*> PtexHashMap< Key, Value >::_oldEntries

private

Definition at line 321 of file PtexHashMap.h.

Referenced by PtexHashMap< Key, Value >::deleteContents(), and PtexHashMap< Key, Value >::grow().

## _size

template<typename Key , typename Value >

uint32_t volatile PtexHashMap< Key, Value >::_size

private

Definition at line 320 of file PtexHashMap.h.

Referenced by PtexHashMap< Key, Value >::initContents(), PtexHashMap< Key, Value >::lockEntriesAndGrowIfNeeded(), PtexHashMap< Key, Value >::size(), and PtexHashMap< Key, Value >::tryInsert().

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

- PtexHashMap.h