net_instaweb::SymbolTable< CharTransform > Class Template Reference

#include "symbol_table.h"

List of all members.

Classes

struct  Compare

Public Member Functions

void Clear ()
Atom Intern (const StringPiece &src)
 Remember a string in the table, returning it as an Atom.
size_t string_bytes_allocated () const

Detailed Description

template<class CharTransform>
class net_instaweb::SymbolTable< CharTransform >

Implements a generic symbol table, allowing for case-sensitive and case insensitive versions. The elements of SymbolTables are Atoms. Atoms are created by Interning strings.

Atoms are cheap and are passed around by value, not by reference or pointer. Atoms can be compared to one another via ==. A const char* can be extracted from an Atom via ==.

Atoms are memory-managed by the symbol table from which they came. When the symbol table is destroyed, so are all the Atoms that were interned in it.

Care should be taken not to attempt to compare Atoms created from multiple symbol tables.

Todo:
TODO(jmarantz): Symbol tables are not currently thread-safe. We should consider whether it's worth making them thread-safe, or whether it's better to use separate symbol tables in each thread.

Member Function Documentation

template<class CharTransform>
void net_instaweb::SymbolTable< CharTransform >::Clear (  ) 

Remove all symbols in the table, invalidating any Atoms that were previously Interned.

template<class CharTransform>
size_t net_instaweb::SymbolTable< CharTransform >::string_bytes_allocated (  )  const [inline]

Returns the number of bytes allocated on behalf of the data, excluding any overhead added by the symbol table.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:20 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3