Ptex

Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PtexHashMap< Key, Value > Class Template Reference

`#include <PtexHashMap.h>`

## Classes
struct | TableHeader
class | Entry

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

## Private Member Functions
| PtexHashMap (const PtexHashMap &)
void | operator= (const PtexHashMap &)
void | initContents ()
void | deleteContents ()
void * | allocTable (int32_t numEntries, size_t &memsize)
void | unlockTable (void *table)
void * | lockTableAndGrowIfNeeded (size_t &newMemUsed)
void * | grow (void *oldTable, size_t &newMemUsed)

## Static Private Member Functions
static void | getTable (const void *table, const TableHeader *&header, const Entry *&entries)
static void | getTable (void *table, TableHeader *&header, Entry *&entries)

## Private Attributes
void * | _table
Mutex | _lock
std::vector< void * > | _oldTables

## Detailed Description

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

Definition at line 132 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 177 of file PtexHashMap.h.

## ◆ ~PtexHashMap()

template<typename Key, typename Value>

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

Definition at line 182 of file PtexHashMap.h.

## Member Function Documentation

## ◆ allocTable()

template<typename Key, typename Value>

void * PtexHashMap< Key, Value >::allocTable | ( | int32_t | numEntries,
|  | size_t & | memsize )
| inline private

Definition at line 263 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::grow(), and PtexHashMap< StringKey, PtexCachedReader * >::initContents().

## ◆ clear()

template<typename Key, typename Value>

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

Definition at line 187 of file PtexHashMap.h.

## ◆ deleteContents()

template<typename Key, typename Value>

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

Definition at line 159 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::clear(), and PtexHashMap< StringKey, PtexCachedReader * >::~PtexHashMap().

## ◆ foreach()

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

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

Definition at line 251 of file PtexHashMap.h.

## ◆ get()

template<typename Key, typename Value>

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

Definition at line 197 of file PtexHashMap.h.

## ◆ getTable() [1/2]

template<typename Key, typename Value>

void PtexHashMap< Key, Value >::getTable | ( | const void * | table,
|  | const TableHeader *& | header,
|  | const Entry *& | entries )
| inline static private

Definition at line 279 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::deleteContents(), PtexHashMap< StringKey, PtexCachedReader * >::foreach(), PtexHashMap< StringKey, PtexCachedReader * >::get(), PtexHashMap< StringKey, PtexCachedReader * >::grow(), PtexHashMap< StringKey, PtexCachedReader * >::lockTableAndGrowIfNeeded(), and PtexHashMap< StringKey, PtexCachedReader * >::tryInsert().

## ◆ getTable() [2/2]

template<typename Key, typename Value>

void PtexHashMap< Key, Value >::getTable | ( | void * | table,
|  | TableHeader *& | header,
|  | Entry *& | entries )
| inline static private

Definition at line 285 of file PtexHashMap.h.

## ◆ grow()

template<typename Key, typename Value>

void * PtexHashMap< Key, Value >::grow | ( | void * | oldTable,
|  | size_t & | newMemUsed )
| inline private

Definition at line 311 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::lockTableAndGrowIfNeeded().

## ◆ initContents()

template<typename Key, typename Value>

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

Definition at line 153 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::clear(), and PtexHashMap< StringKey, PtexCachedReader * >::PtexHashMap().

## ◆ lockTableAndGrowIfNeeded()

template<typename Key, typename Value>

void * PtexHashMap< Key, Value >::lockTableAndGrowIfNeeded | ( | size_t & | newMemUsed | ) |
| inline private

Definition at line 297 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::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 193 of file PtexHashMap.h.

## ◆ tryInsert()

template<typename Key, typename Value>

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

Definition at line 220 of file PtexHashMap.h.

## ◆ unlockTable()

template<typename Key, typename Value>

void PtexHashMap< Key, Value >::unlockTable | ( | void * | table | ) |
| inline private

Definition at line 291 of file PtexHashMap.h.

Referenced by PtexHashMap< StringKey, PtexCachedReader * >::tryInsert().

## Member Data Documentation

## ◆ _lock

template<typename Key, typename Value>

Mutex PtexHashMap< Key, Value >::_lock
| private

Definition at line 341 of file PtexHashMap.h.

## ◆ _oldTables

template<typename Key, typename Value>

std::vector<void*> PtexHashMap< Key, Value >::_oldTables
| private

Definition at line 342 of file PtexHashMap.h.

## ◆ _table

template<typename Key, typename Value>

void* PtexHashMap< Key, Value >::_table
| private

Definition at line 340 of file PtexHashMap.h.

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

- PtexHashMap.h