HashTable< T, Key, Hash > Class Template ReferenceAn STL-conforming hash table.
More...
List of all members.
|
Classes |
| class | const_iterator |
| | An STL-conforming const_iterator. More...
|
| struct | hashedEntry |
| class | iterator |
| | An STL-conforming iterator. More...
|
Public Types |
| typedef T | value_type |
| | Type of values the HashTable contains.
|
| typedef T & | reference |
| | Type that can be used for storing into HashTable::value_type.
|
| typedef const T & | const_reference |
| | Type that can be used for storing into constant.
|
| typedef label | size_type |
| | The type that can represent the size of a HashTable.
|
Public Member Functions |
| | HashTable (const label size=128) |
| | Construct given initial table size.
|
| | HashTable (Istream &, const label size=128) |
| | Construct from Istream.
|
| | HashTable (const HashTable< T, Key, Hash > &) |
| | Construct as copy.
|
| | HashTable (const Xfer< HashTable< T, Key, Hash > > &) |
| | Construct by transferring the parameter contents.
|
| | ~HashTable () |
| label | size () const |
| | Return number of elements in table.
|
| bool | empty () const |
| | Return true if the hash table is empty.
|
| bool | found (const Key &) const |
| | Return true if hashedEntry is found in table.
|
| iterator | find (const Key &) |
| | Find and return an iterator set at the hashedEntry.
|
| const_iterator | find (const Key &) const |
| | Find and return an const_iterator set at the hashedEntry.
|
| List< Key > | toc () const |
| | Return the table of contents.
|
| Ostream & | printInfo (Ostream &) const |
| | Print information.
|
| bool | insert (const Key &, const T &newElmt) |
| | Insert a new hashedEntry.
|
| bool | set (const Key &, const T &newElmt) |
| | Assign a new hashedEntry, overwriting existing entries.
|
| bool | erase (const iterator &) |
| | Erase an hashedEntry specified by given iterator.
|
| bool | erase (const Key &) |
| | Erase an hashedEntry specified by given key if in table.
|
| label | erase (const UList< Key > &) |
| | Remove entries given by the listed keys from this HashTable.
|
| template<class AnyType > |
| label | erase (const HashTable< AnyType, Key, Hash > &) |
| | Remove entries given by the given keys from this HashTable.
|
| void | resize (const label newSize) |
| | Resize the hash table for efficiency.
|
| void | clear () |
| | Clear all entries from table.
|
| void | clearStorage () |
| | Clear the table entries and the table itself.
|
| void | transfer (HashTable< T, Key, Hash > &) |
| | Transfer the contents of the argument table into this table.
|
| Xfer< HashTable< T, Key, Hash > > | xfer () |
| | Transfer contents to the Xfer container.
|
| T & | operator[] (const Key &) |
| | Find and return an hashedEntry.
|
| const T & | operator[] (const Key &) const |
| | Find and return an hashedEntry.
|
| T & | operator() (const Key &) |
| | Find and return an hashedEntry, create it null if not present.
|
| void | operator= (const HashTable< T, Key, Hash > &) |
| | Assignment.
|
| bool | operator== (const HashTable< T, Key, Hash > &) const |
| | Equality. Two hash tables are equal if all contents of first are.
|
| bool | operator!= (const HashTable< T, Key, Hash > &) const |
| | The opposite of the equality operation. Takes linear time.
|
| iterator | begin () |
| | iterator set to the begining of the HashTable
|
| const iterator & | end () |
| | iterator set to beyond the end of the HashTable
|
| const_iterator | cbegin () const |
| | const_iterator set to the beginning of the HashTable
|
| const const_iterator & | cend () const |
| | const_iterator set to beyond the end of the HashTable
|
| const_iterator | begin () const |
| | const_iterator set to the beginning of the HashTable
|
| const const_iterator & | end () const |
| | const_iterator set to beyond the end of the HashTable
|
Friends |
| class | HashPtrTable |
| | Declare friendship with the HashPtrTable class.
|
| class | iterator |
| class | const_iterator |
| Istream & | operator>> (Istream &, HashTable< T, Key, Hash > &) |
| Ostream & | operator (Ostream &, const HashTable< T, Key, Hash > &) |
Detailed Description
template<class T, class Key = word, class Hash = string::hash>
class Foam::HashTable< T, Key, Hash >
An STL-conforming hash table.
- Note:
- Hashing index collisions are handled via chaining using a singly-linked list with the colliding entry being added to the head of the linked list. Thus copying the hash table (or indeed even resizing it) will often result in a different hash order. Use a sorted table-of-contents when the hash order is important.
- Source files
-
Definition at line 79 of file HashTable.H.
Member Typedef Documentation
Constructor & Destructor Documentation
Construct given initial table size.
Definition at line 54 of file HashTable.C.
Member Function Documentation
Return number of elements in table.
Reimplemented in Cloud< ParticleType >, triSurfaceMesh, surfMesh, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 50 of file HashTableI.H.
| bool empty |
( |
|
) |
const [inline] |
Return true if the hash table is empty.
Definition at line 57 of file HashTableI.H.
| bool found |
( |
const Key & |
key |
) |
const [inline] |
Return the table of contents.
Definition at line 227 of file HashTable.C.
| bool insert |
( |
const Key & |
key, |
|
|
const T & |
newElmt | |
|
) |
| | [inline] |
Insert a new hashedEntry.
Definition at line 65 of file HashTableI.H.
Referenced by DictionaryBase< IDLListType, T >::append(), enrichedPatch::calcEnrichedFaces(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::handler(), HashTable< T, Key, Hash >::HashTable(), Foam::parseNASCoord(), STARCD::readBoundary(), DictionaryBase< IDLListType, T >::remove(), boundaryCutter::updateMesh(), and meshReader::warnDuplicates().
| bool set |
( |
const Key & |
key, |
|
|
const T & |
newElmt | |
|
) |
| | [inline] |
Assign a new hashedEntry, overwriting existing entries.
Definition at line 76 of file HashTableI.H.
| bool erase |
( |
const iterator & |
cit |
) |
[inline] |
| bool erase |
( |
const Key & |
key |
) |
[inline] |
Erase an hashedEntry specified by given key if in table.
Definition at line 410 of file HashTable.C.
Remove entries given by the listed keys from this HashTable.
Return the number of elements removed
Definition at line 426 of file HashTable.C.
Remove entries given by the given keys from this HashTable.
Return the number of elements removed. The parameter HashTable needs the same type of keys, but but the type of values held is arbitrary.
Definition at line 449 of file HashTable.C.
| void resize |
( |
const label |
newSize |
) |
[inline] |
Clear all entries from table.
Reimplemented in Cloud< ParticleType >, DsmcCloud< ParcelType >, HashPtrTable< T, Key, Hash >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, Cloud< BasicReactingParcel< ThermoType > >, DsmcCloud< dsmcParcel >, HashPtrTable< tensorField >, HashPtrTable< symmTensorField >, HashPtrTable< OFstream >, HashPtrTable< IOobject >, HashPtrTable< gasThermoPhysics >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, HashPtrTable< ThermoType >, and HashPtrTable< vectorField >.
Definition at line 510 of file HashTable.C.
Referenced by functionObjectList::on(), dictionary::transfer(), HashTable< T, Key, Hash >::transfer(), and DictionaryBase< IDLListType, T >::transfer().
| void clearStorage |
( |
|
) |
[inline] |
Clear the table entries and the table itself.
Equivalent to clear() followed by resize(0)
Definition at line 534 of file HashTable.C.
| T & operator[] |
( |
const Key & |
key |
) |
[inline] |
| const T & operator[] |
( |
const Key & |
key |
) |
const [inline] |
Find and return an hashedEntry.
Reimplemented in HashSet< Key, Hash >, NamedEnum< Enum, nEnum >, HashSet< label, Hash< label > >, NamedEnum< typeOfMatch, 2 >, NamedEnum< sampleMode, 3 >, NamedEnum< algorithm, 3 >, NamedEnum< faceAction, 2 >, NamedEnum< pointAction, 2 >, NamedEnum< setAction, 7 >, NamedEnum< vector::components, 3 >, NamedEnum< cellAction, 1 >, NamedEnum< faceAction, 1 >, NamedEnum< pointAction, 1 >, NamedEnum< modeType, 2 >, NamedEnum< distributionType, 3 >, NamedEnum< baseType, 2 >, NamedEnum< volumeType, 2 >, NamedEnum< cellAction, 2 >, NamedEnum< stopAtControls, 4 >, NamedEnum< outputControls, 2 >, NamedEnum< transformType, 3 >, NamedEnum< phaseType, 4 >, NamedEnum< commsTypes, 3 >, NamedEnum< direction, 2 >, NamedEnum< refineMode, 3 >, NamedEnum< projectMode, 3 >, NamedEnum< writeControls, 5 >, NamedEnum< faceAction, 4 >, and NamedEnum< directionType, 3 >.
Definition at line 113 of file HashTableI.H.
| T & operator() |
( |
const Key & |
key |
) |
[inline] |
Find and return an hashedEntry, create it null if not present.
Definition at line 130 of file HashTableI.H.
| void operator= |
( |
const HashTable< T, Key, Hash > & |
rhs |
) |
[inline] |
| bool operator== |
( |
const HashTable< T, Key, Hash > & |
rhs |
) |
const [inline] |
Equality. Two hash tables are equal if all contents of first are.
also in second and vice versa. So does not depend on table size or order!
Definition at line 600 of file HashTable.C.
References insert().
| bool operator!= |
( |
const HashTable< T, Key, Hash > & |
rhs |
) |
const [inline] |
The opposite of the equality operation. Takes linear time.
Definition at line 631 of file HashTable.C.
iterator set to the begining of the HashTable
Reimplemented in Cloud< ParticleType >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 302 of file HashTableI.H.
Referenced by Foam::kShellIntegration(), Foam::mapClouds(), Foam::MapConsistentVolFields(), Foam::MapGeometricFields(), Foam::MapVolFields(), fvMeshDistribute::printFieldInfo(), and Foam::UnMapped().
iterator set to beyond the end of the HashTable
Reimplemented in Cloud< ParticleType >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 336 of file HashTableI.H.
References HashTable< T, Key, Hash >::iterator.
Referenced by enrichedPatch::calcEnrichedFaces(), STLASCIILexer::lex(), Foam::mapClouds(), Foam::MapConsistentVolFields(), Foam::MapGeometricFields(), Foam::MapVolFields(), Foam::parseNASCoord(), fvMeshDistribute::printFieldInfo(), STARCD::readBoundary(), Foam::UnMapped(), and meshReader::warnDuplicates().
const_iterator set to the beginning of the HashTable
Reimplemented in Cloud< ParticleType >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 483 of file HashTableI.H.
Referenced by HashTable< T, Key, Hash >::end(), and HashSet< Key, Hash >::HashSet().
const_iterator set to beyond the end of the HashTable
Reimplemented in Cloud< ParticleType >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 517 of file HashTableI.H.
References HashTable< T, Key, Hash >::const_iterator.
Referenced by HashSet< Key, Hash >::HashSet().
const_iterator set to the beginning of the HashTable
Reimplemented in Cloud< ParticleType >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 525 of file HashTableI.H.
const_iterator set to beyond the end of the HashTable
Reimplemented in Cloud< ParticleType >, Time, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, and Cloud< BasicReactingParcel< ThermoType > >.
Definition at line 533 of file HashTableI.H.
References HashTable< T, Key, Hash >::cbegin().
Friends And Related Function Documentation
Reimplemented in Cloud< ParticleType >, HashPtrTable< T, Key, Hash >, HashSet< Key, Hash >, Map< T >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, Cloud< BasicReactingParcel< ThermoType > >, HashPtrTable< tensorField >, HashPtrTable< symmTensorField >, HashPtrTable< OFstream >, HashPtrTable< IOobject >, HashPtrTable< gasThermoPhysics >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, HashPtrTable< ThermoType >, HashPtrTable< vectorField >, HashSet< label, Hash< label > >, Map< splitCell * >, Map< T >, Map< label >, Map< dictionary >, Map< Pair< edge > >, Map< point >, Map< edge >, and Map< labelList >.
Definition at line 146 of file HashTable.H.
Referenced by HashTable< T, Key, Hash >::end().
Reimplemented in Cloud< ParticleType >, HashPtrTable< T, Key, Hash >, HashSet< Key, Hash >, Map< T >, Cloud< BasicReactingMultiphaseParcel< ThermoType > >, Cloud< basicThermoParcel >, Cloud< molecule >, Cloud< CoalParcel< ThermoType > >, Cloud< trackedParticle >, Cloud< basicKinematicParcel >, Cloud< ParcelType >, Cloud< parcel >, Cloud< solidParticle >, Cloud< dsmcParcel >, Cloud< indexedParticle >, Cloud< passiveParticle >, Cloud< BasicReactingParcel< ThermoType > >, HashPtrTable< tensorField >, HashPtrTable< symmTensorField >, HashPtrTable< OFstream >, HashPtrTable< IOobject >, HashPtrTable< gasThermoPhysics >, HashPtrTable< curve >, HashPtrTable< sphericalTensorField >, HashPtrTable< scalarField >, HashPtrTable< T, label, Hash< label > >, HashPtrTable< ReactionThermo >, HashPtrTable< ThermoType >, HashPtrTable< vectorField >, HashSet< label, Hash< label > >, Map< splitCell * >, Map< T >, Map< label >, Map< dictionary >, Map< Pair< edge > >, Map< point >, Map< edge >, and Map< labelList >.
Definition at line 149 of file HashTable.H.
Referenced by HashTable< T, Key, Hash >::cend().
The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd
|