Public Member Functions | Private Member Functions | Private Attributes | Friends
hashedWordList Class Reference

A wordList with hashed indices for faster lookup by name. More...

Inheritance diagram for hashedWordList:
Inheritance graph
[legend]
Collaboration diagram for hashedWordList:
Collaboration graph
[legend]

Public Member Functions

 hashedWordList ()
 Construct null. More...
 
 hashedWordList (const hashedWordList &)
 Copy constructor. More...
 
 hashedWordList (const UList< word > &names)
 Construct from list of names. More...
 
 hashedWordList (const Xfer< List< word > > &names)
 Construct by transferring the parameter contents. More...
 
 hashedWordList (const label nNames, const char **names)
 Construct from number and list of names. More...
 
 hashedWordList (const char **names)
 Construct from a NULL-terminated list of names. More...
 
 hashedWordList (Istream &)
 Construct from Istream. More...
 
void clear ()
 Clear the list, i.e. set size to zero. More...
 
void append (const word &)
 Append an element at the end of the list. More...
 
bool contains (const word &) const
 Does the list contain the specified name. More...
 
void transfer (List< word > &)
 Transfer the contents of the argument List into this list. More...
 
void operator= (const UList< word > &names)
 Assignment operator from list of names. More...
 
void operator= (const hashedWordList &)
 Assignment operator. More...
 
const wordoperator[] (const label index) const
 Return name corresponding to specified index. More...
 
label operator[] (const word &) const
 Return index corresponding to specified name. More...
 
- Public Member Functions inherited from List< word >
label size () const
 Return the number of elements in the UList. More...
 
 List ()
 Null constructor. More...
 
 List (const label)
 Construct with given size. More...
 
 List (const label, const T &)
 Construct with given size and value for all elements. More...
 
 List (const List< T > &)
 Copy constructor. More...
 
 List (const Xfer< List< T > > &)
 Construct by transferring the parameter contents. More...
 
 List (List< T > &, bool reUse)
 Construct as copy or re-use as specified. More...
 
 List (const UList< T > &, const labelUList &mapAddressing)
 Construct as subset. More...
 
 List (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 List (const FixedList< T, Size > &)
 Construct as copy of FixedList<T, Size> More...
 
 List (const PtrList< T > &)
 Construct as copy of PtrList<T> More...
 
 List (const SLList< T > &)
 Construct as copy of SLList<T> More...
 
 List (const UIndirectList< T > &)
 Construct as copy of UIndirectList<T> More...
 
 List (const BiIndirectList< T > &)
 Construct as copy of BiIndirectList<T> More...
 
 List (Istream &)
 Construct from Istream. More...
 
 List (const label s)
 
 List (const label s, const T &a)
 
 List (const List< T > &a)
 
 List (const Xfer< List< T > > &lst)
 
 List (List< T > &a, bool reUse)
 
 List (const UList< T > &a, const labelUList &map)
 
 List (const PtrList< T > &lst)
 
 List (const SLList< T > &lst)
 
 List (const UIndirectList< T > &lst)
 
 List (const BiIndirectList< T > &lst)
 
 List ()
 
 List (Istream &is)
 
autoPtr< List< T > > clone () const
 Clone. More...
 
 ~List ()
 Destructor. More...
 
void resize (const label)
 Alias for setSize(const label) More...
 
void resize (const label, const T &)
 Alias for setSize(const label, const T&) More...
 
void setSize (const label)
 Reset size of List. More...
 
void setSize (const label, const T &)
 Reset size of List and value for new elements. More...
 
void clear ()
 Clear the list, i.e. set size to zero. More...
 
void append (const T &)
 Append an element at the end of the list. More...
 
void append (const UList< T > &)
 Append a List at the end of this list. More...
 
void append (const UIndirectList< T > &)
 Append a UIndirectList at the end of this list. More...
 
void transfer (List< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (SortableList< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (List< T > &a)
 
void transfer (SortableList< T > &a)
 
Xfer< List< T > > xfer ()
 Transfer contents to the Xfer container. More...
 
TnewElmt (const label)
 Return subscript-checked element of UList. More...
 
void operator= (const UList< T > &)
 Assignment from UList operator. Takes linear time. More...
 
void operator= (const List< T > &)
 Assignment operator. Takes linear time. More...
 
void operator= (const SLList< T > &)
 Assignment from SLList operator. Takes linear time. More...
 
void operator= (const UIndirectList< T > &)
 Assignment from UIndirectList operator. Takes linear time. More...
 
void operator= (const BiIndirectList< T > &)
 Assignment from BiIndirectList operator. Takes linear time. More...
 
void operator= (const T &)
 Assignment of all entries to the given value. More...
 

Private Member Functions

void rehash ()
 Rebuild the hash of indices. More...
 

Private Attributes

HashTable< label, wordindices_
 

Friends

Istreamoperator>> (Istream &, hashedWordList &)
 
Ostreamoperator<< (Ostream &, const hashedWordList &)
 

Additional Inherited Members

- Public Types inherited from List< word >
typedef SubList< TsubList
 Declare type of subList. More...
 
- Static Public Member Functions inherited from List< word >
static const List< T > & null ()
 Return a null List. More...
 
- Protected Member Functions inherited from List< word >
void size (const label)
 Override size to be inconsistent with allocated storage. More...
 

Detailed Description

A wordList with hashed indices for faster lookup by name.

Source files

Definition at line 57 of file hashedWordList.H.

Constructor & Destructor Documentation

◆ hashedWordList() [1/7]

Construct null.

Definition at line 42 of file hashedWordList.C.

◆ hashedWordList() [2/7]

hashedWordList ( const hashedWordList names)

Copy constructor.

Definition at line 56 of file hashedWordList.C.

References hashedWordList::rehash().

Here is the call graph for this function:

◆ hashedWordList() [3/7]

hashedWordList ( const UList< word > &  names)

Construct from list of names.

Definition at line 48 of file hashedWordList.C.

References hashedWordList::rehash().

Here is the call graph for this function:

◆ hashedWordList() [4/7]

hashedWordList ( const Xfer< List< word > > &  names)

Construct by transferring the parameter contents.

Definition at line 64 of file hashedWordList.C.

References hashedWordList::rehash().

Here is the call graph for this function:

◆ hashedWordList() [5/7]

hashedWordList ( const label  nNames,
const char **  names 
)

Construct from number and list of names.

Definition at line 73 of file hashedWordList.C.

References forAll.

◆ hashedWordList() [6/7]

hashedWordList ( const char **  names)

Construct from a NULL-terminated list of names.

Definition at line 90 of file hashedWordList.C.

References forAll, and List::setSize().

Here is the call graph for this function:

◆ hashedWordList() [7/7]

Construct from Istream.

Definition at line 111 of file hashedWordList.C.

Member Function Documentation

◆ rehash()

void rehash ( )
private

Rebuild the hash of indices.

Definition at line 30 of file hashedWordList.C.

References forAll, and hashedWordList::indices_.

Referenced by hashedWordList::hashedWordList(), and Foam::operator>>().

Here is the caller graph for this function:

◆ clear()

void clear ( )

Clear the list, i.e. set size to zero.

Definition at line 119 of file hashedWordList.C.

References List::clear().

Here is the call graph for this function:

◆ append()

void append ( const word name)

Append an element at the end of the list.

Definition at line 126 of file hashedWordList.C.

References List::append(), and Foam::name().

Here is the call graph for this function:

◆ contains()

bool contains ( const word name) const
inline

Does the list contain the specified name.

Definition at line 28 of file hashedWordListI.H.

References hashedWordList::indices_, and Foam::name().

Referenced by Reaction::specieCoeffs::specieCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transfer()

void transfer ( List< word > &  lst)

Transfer the contents of the argument List into this list.

and annul the argument list.

Definition at line 134 of file hashedWordList.C.

References List::transfer().

Referenced by foamChemistryReader< ThermoType >::setSpecies().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

void operator= ( const UList< word > &  names)
inline

Assignment operator from list of names.

Definition at line 36 of file hashedWordListI.H.

References List::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

void operator= ( const hashedWordList lst)
inline

Assignment operator.

Definition at line 43 of file hashedWordListI.H.

◆ operator[]() [1/2]

const Foam::word & operator[] ( const label  index) const
inline

Return name corresponding to specified index.

Definition at line 50 of file hashedWordListI.H.

◆ operator[]() [2/2]

Foam::label operator[] ( const word name) const
inline

Return index corresponding to specified name.

Definition at line 59 of file hashedWordListI.H.

References Foam::name().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
hashedWordList  
)
friend

◆ operator<<

Ostream& operator<< ( Ostream ,
const hashedWordList  
)
friend

Field Documentation

◆ indices_

HashTable<label, word> indices_
private

Definition at line 63 of file hashedWordList.H.

Referenced by hashedWordList::contains(), and hashedWordList::rehash().


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