153         for (iter._b = 0; iter._b < 
_numBuckets; iter._b++) {
 
  155             if (*iter._e) 
return iter;
 
  169         for (iter._b = 0; iter._b < 
_numBuckets; iter._b++) {
 
  171             if (*iter._e) 
return iter;
 
  192     bool erase(
const char* key);
 
  237     int hash(
const char* key, 
int& keylen)
 const 
  241         const char* cp = key;
 
  243         while ((c = *cp++)) hashval = hashval * 33 + c;
 
  244         keylen = int(cp-key)-1;
 
  249     Entry** 
locate(
const char* key, 
int& keylen, 
int& hashval)
 const 
  251         hashval = 
hash(key, keylen);
 
  254             if ((*e)->_hashval == hashval && (*e)->_keylen == keylen &&
 
  255                 streq(key, (*e)->_u._key, keylen)) 
 
  264     static inline bool streq(
const char* s1, 
const char* s2, 
int len)
 
  267         if (((intptr_t)s1 & 3) == 0) {  
 
  270                 if (*(
int*)s1 != *(
int*)s2) 
return 0;
 
  275         while (len--) 
if (*s1++ != *s2++) 
return 0;
 
  313         _d(iter._d), _e(iter._e), _b(iter._b) {}
 
  316         { _e = iter.
_e; _d = iter.
_d; _b = iter.
_b; 
return *
this; }   
 
  324     inline operator bool() { 
return _e != 0; }
 
  328         { 
return iter.
_e == _e; }
 
  331         { 
return iter.
_e != _e; }
 
  334         { 
return iter.
_e == _e; }
 
  337         { 
return iter.
_e != _e; }
 
  348         if (_e) 
return (*_e)->_val;
 
  349         else   return _defaultVal;
 
  384         _d(iter._d), _e(iter._e), _b(iter._b) {}
 
  387         _d(iter._d), _e(iter._e), _b(iter._b) {}
 
  390         { _e = iter.
_e; _d = iter.
_d; _b = iter.
_b; 
return *
this; }
 
  393         { _e = iter.
_e; _d = iter.
_d; _b = iter.
_b; 
return *
this; }
 
  401     inline operator bool() { 
return _e != 0; }
 
  405         { 
return iter.
_e == _e; }
 
  408         { 
return iter.
_e != _e; }
 
  411         { 
return iter.
_e == _e; }
 
  414         { 
return iter.
_e != _e; }
 
  425         if (_e) 
return (*_e)->_val;
 
  426         else   return _defaultVal;
 
  451                 if (*
_e) 
return *
this;
 
  467             for (_b++; _b < _d->_numBuckets; _b++) {
 
  468                 _e = &_d->_buckets[_b];
 
  469                 if (*_e) 
return *
this;
 
  504     if (e) 
return (*e)->_val.second;
 
  512     void* ebuf = malloc( 
sizeof(
Entry) + (keylen) * 
sizeof(
char) );
 
  517     ne->
_next = *slot; *slot = ne;
 
  522     memcpy(ne->
_u.
_key, key, keylen);
 
  523     ne->
_u.
_key[keylen] = 
'\0';
 
  543                 e->
_next = *slot; *slot = e;
 
  549         _numBuckets = newsize;
 
  558     if (!iter) 
return false;
 
  569     if (!eptr) 
return iter;
 
int _numEntries
The number of entries in the dictionary. 
static bool streq(const char *s1, const char *s2, int len)
Used for string compares, much faster then strcmp. 
iterator(Entry **e, const PtexDict *d, int b)
Constructor Helper for inline creation. 
T second
Reference to the data. 
PtexDict()
Default contructor initializes the dictionary. 
Entry ** _e
pointer to entry in table this iterator refs 
const_iterator end() const 
Const access to the end of the list. 
bool operator==(const const_iterator &iter) const 
For comparing equality of const_iterators. 
bool operator==(const iterator &iter) const 
For comparing equality of iterators. 
bool erase(const char *key)
Will remove an entry. It will return TRUE if an entry was found. 
Entry * _next
Pointer to the next element in the structure. 
iterator end()
Returns an iterator referencing the end of the table. 
const_iterator begin() const 
Const access to the beginning of the list. 
virtual ~PtexDict()
clears the entries in the dictionary 
iterator(const iterator &iter)
Proper copy constructor implementation. 
value_type & operator*() const 
Operator for obtaining the value that the iterator references. 
const_iterator()
Default Constructor. 
union PtexDict::Entry::@0 _u
const value_type * operator->() const 
Pointer reference operator. 
void clear()
clear will remove all entries from the dictionary. O(n) 
value_type * operator->() const 
Pointer reference operator. 
iterator begin()
Returns an iterator referencing the beginning of the table. 
bool operator!=(const iterator &iter) const 
For comparing inequality of iterators. 
char _key[1]
1 is dummy length - actual size will be allocated 
value_type(key_type f, const T &s)
Creation constructor. 
bool operator==(const const_iterator &iter) const 
For comparing equality of iterators. 
value_type & getValue() const 
simple helper function for retrieving the value from the Entry 
int _numBuckets
The number of buckets in use. 
Entry()
Default constructor initiaizes val with the defaul value. 
int hash(const char *key, int &keylen) const 
Returns the integer hash index for the key and length of the key. 
static value_type _defaultVal
Default value. 
This internal structure is used to store the dictionary elements. 
value_type _val
The stored value of the hash table. 
int size() const 
Returns the number of entries in the dictionary. O(1) time to call. 
int _b
bucket number this references 
const char * key_type
This is the lookup type. 
if(WIN32) add_definitions(/DPTEX_EXPORTS) endif(WIN32) set(SRCS PtexCache.cpp PtexFilters.cpp PtexHalf.cpp PtexReader.cpp PtexSeparableFilter.cpp PtexSeparableKernel.cpp PtexTriangleFilter.cpp PtexTriangleKernel.cpp PtexUtils.cpp PtexWriter.cpp) add_library(Ptex_static STATIC $
int _pad
for integer align of _key, for fast compares 
iterator()
Default Constructor. 
const_iterator & operator=(iterator &iter)
Proper assignment operator for iterator. 
const value_type & operator*() const 
Operator for obtaining the value that the const_iterator references. 
iterator find(const char *key)
Locates an entry, without creating a new one. 
iterator & operator++(int)
For advancing the iterator to the next element. 
bool operator!=(const iterator &iter) const 
For comparing inequality of iterators. 
value_type()
Default constructor references default_value, with a 0 for first. 
bool operator!=(const const_iterator &iter) const 
For comparing inequality of iterators. 
bool operator!=(const const_iterator &iter) const 
For comparing inequality of iterators. 
iterator & operator=(const iterator &iter)
Proper assignment operator. 
const_iterator(const const_iterator &iter)
Proper copy constructor implementation for const_iterator. 
Internal class used to provide a return value for the value type. 
int _keylen
cached length of key 
T mapped_type
The data type stored. 
A string-keyed dictionary template, using a hash table. 
const_iterator & operator++(int)
For advancing the iterator to the next element. 
Entry & operator=(const Entry &)
Assignment operator prohibited by design. 
void grow()
Used to increase the size of the table if necessary. 
int _hashval
cached hashval of key 
friend class const_iterator
const_iterator(const iterator &iter)
Conversion constructor for iterator. 
int _b
bucket number this references 
const PtexDict * _d
dictionary back reference 
const_iterator & operator=(const const_iterator &iter)
Proper assignment operator for const_iterator. 
PtexDict & operator=(const PtexDict &)
Assignment operator prohibited by design. 
Entry ** _buckets
The pointer to the bucket structure. 
Internal class used to provide iteration through the dictionary. 
Entry ** _e
pointer to entry in table this iterator refs 
bool operator==(const iterator &iter) const 
For comparing equality of iterators. 
const value_type & getValue() const 
simple helper function for retrieving the value from the Entry 
T & operator[](const char *key)
Locates an entry, creating a new one if necessary. 
friend class iterator
forward declared class 
Entry ** locate(const char *key, int &keylen, int &hashval) const 
Returns a pointer to the desired entry, based on the key. 
const key_type first
Reference to the key type. 
static value_type _defaultVal
Default value. 
const PtexDict * _d
dictionary back reference 
Internal class used to provide iteration through the dictionary. 
const_iterator(Entry **e, const PtexDict *d, int b)
Constructor Helper for inline creation. 
int _bucketMask
The mask for the buckets.