FreeFOAM The Cross-Platform CFD Toolkit
HashSet< Key, Hash > Class Template Reference

A HashTable with keys but without contents. More...

#include <OpenFOAM/HashSet.H>


Detailed Description

template<class Key = word, class Hash = string::hash>
class Foam::HashSet< Key, Hash >

A HashTable with keys but without contents.

Definition at line 58 of file HashSet.H.

+ Inheritance diagram for HashSet< Key, Hash >:
+ Collaboration diagram for HashSet< Key, Hash >:

List of all members.

Public Types

typedef HashTable< nil, Key,
Hash >::iterator 
iterator
typedef HashTable< nil, Key,
Hash >::const_iterator 
const_iterator
- Public Types inherited from HashTable< nil, Key, Hash >
typedef nil value_type
 Type of values the HashTable contains.
typedef nilreference
 Type that can be used for storing into HashTable::value_type.
typedef const nilconst_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

 HashSet (const label size=128)
 Construct given initial size.
 HashSet (Istream &is)
 Construct from Istream.
 HashSet (const UList< Key > &lst)
 Construct from UList of Key.
 HashSet (const HashSet< Key, Hash > &hs)
 Construct as copy.
 HashSet (const Xfer< HashSet< Key, Hash > > &hs)
 Construct by transferring the parameter contents.
 HashSet (const Xfer< HashTable< nil, Key, Hash > > &hs)
 Construct by transferring the parameter contents.
template<class AnyType , class AnyHash >
 HashSet (const HashTable< AnyType, Key, AnyHash > &)
 Construct from the keys of another HashTable,.
bool insert (const Key &key)
 Insert a new entry.
bool set (const Key &key)
 Same as insert (cannot overwrite nil content)
bool operator[] (const Key &) const
 Return true if the entry exists, same as found()
bool operator== (const HashSet< Key, Hash > &) const
 Equality. Two hashtables are equal when their contents are equal.
bool operator!= (const HashSet< Key, Hash > &) const
 The opposite of the equality operation.
void operator|= (const HashSet< Key, Hash > &)
 Combine entries from HashSets.
void operator&= (const HashSet< Key, Hash > &)
 Only retain entries found in both HashSets.
void operator^= (const HashSet< Key, Hash > &)
 Only retain unique entries (xor)
void operator+= (const HashSet< Key, Hash > &rhs)
 Add entries listed in the given HashSet to this HashSet.
void operator-= (const HashSet< Key, Hash > &)
 Remove entries listed in the given HashSet from this HashSet.
- Public Member Functions inherited from HashTable< nil, Key, Hash >
bool set (const Key &, const nil &newElmt)
 Assign a new hashedEntry, overwriting existing entries.
 HashTable (const label size=128)
 Construct given initial table size.
 HashTable (Istream &, const label size=128)
 Construct from Istream.
 HashTable (const HashTable< nil, Key, Hash > &)
 Construct as copy.
 HashTable (const Xfer< HashTable< nil, 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.
List< Key > sortedToc () const
 Return the table of contents as a sorted list.
OstreamprintInfo (Ostream &) const
 Print information.
bool insert (const Key &, const nil &newElmt)
 Insert a new hashedEntry.
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.
label erase (const HashTable< AnyType, Key, AnyHash > &)
 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< nil, Key, Hash > &)
 Transfer the contents of the argument table into this table.
Xfer< HashTable< nil, Key, Hash > > xfer ()
 Transfer contents to the Xfer container.
niloperator[] (const Key &)
 Find and return an hashedEntry.
niloperator() (const Key &)
 Find and return an hashedEntry, create it null if not present.
void operator= (const HashTable< nil, Key, Hash > &)
 Assignment.
bool operator== (const HashTable< nil, Key, Hash > &) const
 Equality. Two hash tables are equal if all contents of first are.
bool operator!= (const HashTable< nil, Key, Hash > &) const
 The opposite of the equality operation. Takes linear time.
iterator begin ()
 iterator set to the begining of the HashTable
const_iterator begin () const
 const_iterator set to the beginning of the HashTable
const iterator & end ()
 iterator set to beyond the end of the HashTable
const const_iterator & end () const
 const_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

Member Typedef Documentation

typedef HashTable<nil, Key, Hash>::iterator iterator

Reimplemented from HashTable< nil, Key, Hash >.

Definition at line 65 of file HashSet.H.

Reimplemented from HashTable< nil, Key, Hash >.

Definition at line 66 of file HashSet.H.


Constructor & Destructor Documentation

HashSet ( const label  size = 128)
inline

Construct given initial size.

Definition at line 72 of file HashSet.H.

HashSet ( Istream is)
inline

Construct from Istream.

Definition at line 78 of file HashSet.H.

HashSet ( const UList< Key > &  lst)
inline

Construct from UList of Key.

Definition at line 84 of file HashSet.H.

HashSet ( const HashSet< Key, Hash > &  hs)
inline

Construct as copy.

Definition at line 95 of file HashSet.H.

HashSet ( const Xfer< HashSet< Key, Hash > > &  hs)
inline

Construct by transferring the parameter contents.

Definition at line 101 of file HashSet.H.

HashSet ( const Xfer< HashTable< nil, Key, Hash > > &  hs)
inline

Construct by transferring the parameter contents.

Definition at line 107 of file HashSet.H.

HashSet ( const HashTable< AnyType, Key, AnyHash > &  h)

Construct from the keys of another HashTable,.

the type of values held is arbitrary.

Definition at line 36 of file HashSet.C.

References HashTable< T, Key, Hash >::cbegin(), HashTable< T, Key, Hash >::cend(), and insert().


Member Function Documentation

bool insert ( const Key &  key)
inline

Insert a new entry.

Definition at line 123 of file HashSet.H.

Referenced by meshRefinement::baffleAndSplitMesh(), cellToFaceStencil::calcFaceStencil(), primitiveMeshGeometry::checkCellDeterminant(), polyMeshGeometry::checkCellDeterminant(), primitiveMesh::checkCellDeterminant(), primitiveMesh::checkCellsZipUp(), primitiveMesh::checkCellVolumes(), primitiveMesh::checkClosedCells(), primitiveMesh::checkEdgeAlignment(), primitiveMesh::checkEdgeLength(), primitiveMeshGeometry::checkFaceAngles(), polyMeshGeometry::checkFaceAngles(), primitiveMesh::checkFaceAngles(), primitiveMeshGeometry::checkFaceArea(), polyMeshGeometry::checkFaceArea(), primitiveMesh::checkFaceAreas(), primitiveMeshGeometry::checkFaceDotProduct(), primitiveMesh::checkFaceFlatness(), primitiveMesh::checkFaceOrthogonality(), primitiveMeshGeometry::checkFacePyramids(), polyMeshGeometry::checkFacePyramids(), primitiveMesh::checkFacePyramids(), primitiveMeshGeometry::checkFaceSkewness(), polyMeshGeometry::checkFaceSkewness(), primitiveMesh::checkFaceSkewness(), primitiveMeshGeometry::checkFaceTwist(), polyMeshGeometry::checkFaceTwist(), primitiveMesh::checkFaceVertices(), primitiveMeshGeometry::checkFaceWeights(), polyMeshGeometry::checkFaceWeights(), PatchTools::checkOrientation(), PrimitivePatch< Face, FaceList, PointField, PointType >::checkPointManifold(), primitiveMesh::checkPointNearness(), primitiveMesh::checkPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::checkTopology(), polyMeshGeometry::checkTriangleTwist(), primitiveMesh::checkUpperTriangular(), polyMeshGeometry::checkVolRatio(), meshRefinement::createBaffles(), geomCellLooper::cut(), treeLeaf< Type >::findBox(), meshRefinement::getDuplicateFaces(), combineFaces::getMergeSets(), surfaceSets::getSurfaceSets(), triSurfaceTools::getVertexVertices(), HashSet< word >::HashSet(), HashSet< word >::insert(), cellToCellStencil::insertFaceCells(), cellToFaceStencil::insertFaceCells(), meshRefinement::mergeEdges(), polyBoundaryMesh::patchSet(), Foam::polyMeshZipUpCells(), NASsurfaceFormat< Face >::read(), motionSmoother::scaleMesh(), mapDistribute::schedule(), HashSet< word >::set(), TimeActivatedExplicitSource< Type >::setCellSet(), removePoints::setRefinement(), explicitSource::setSelectedCellsFromPoints(), surfaceIntersection::surfaceIntersection(), pointSet::sync(), and STARCD::writeSurface().

bool set ( const Key &  key)
inline

Same as insert (cannot overwrite nil content)

Definition at line 129 of file HashSet.H.

bool operator[] ( const Key &  key) const
inline

Return true if the entry exists, same as found()

Reimplemented from HashTable< nil, Key, Hash >.

Definition at line 58 of file HashSet.C.

bool operator== ( const HashSet< Key, Hash > &  rhs) const

Equality. Two hashtables are equal when their contents are equal.

Independent of table size or order.

Definition at line 65 of file HashSet.C.

References HashTable< nil, Key, Hash >::cbegin(), HashTable< nil, Key, Hash >::cend(), and HashTable< nil, Key, Hash >::found().

bool operator!= ( const HashSet< Key, Hash > &  rhs) const

The opposite of the equality operation.

Definition at line 90 of file HashSet.C.

References Foam::operator==().

void operator|= ( const HashSet< Key, Hash > &  rhs)

Combine entries from HashSets.

Definition at line 97 of file HashSet.C.

References HashTable< nil, Key, Hash >::cbegin(), HashTable< nil, Key, Hash >::cend(), and insert().

Referenced by HashSet< word >::operator+=().

void operator&= ( const HashSet< Key, Hash > &  rhs)

Only retain entries found in both HashSets.

Definition at line 108 of file HashSet.C.

References HashTable< nil, Key, Hash >::found().

void operator^= ( const HashSet< Key, Hash > &  rhs)

Only retain unique entries (xor)

Definition at line 122 of file HashSet.C.

References HashTable< nil, Key, Hash >::cbegin(), HashTable< nil, Key, Hash >::cend(), and insert().

void operator+= ( const HashSet< Key, Hash > &  rhs)
inline

Add entries listed in the given HashSet to this HashSet.

Definition at line 158 of file HashSet.H.

void operator-= ( const HashSet< Key, Hash > &  rhs)

Remove entries listed in the given HashSet from this HashSet.

Definition at line 141 of file HashSet.C.

References HashTable< nil, Key, Hash >::cbegin(), and HashTable< nil, Key, Hash >::cend().


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