A wordList with hashed named lookup, which can be faster in some situations than using the normal list find/found methods. More...
Public Member Functions | |
hashedWordList ()=default | |
Default construct an empty list. More... | |
hashedWordList (const hashedWordList &list) | |
Copy construct. More... | |
hashedWordList (hashedWordList &&list) | |
Move construct. More... | |
hashedWordList (const wordUList &list) | |
Copy construct from list of words. More... | |
hashedWordList (const wordUList &list, bool unique) | |
Copy construct from list of words, eliminating duplicates. More... | |
hashedWordList (wordList &&list, bool unique=false) | |
Move construct from list of words, optionally eliminating duplicates. More... | |
hashedWordList (std::initializer_list< word > list) | |
Construct from an initializer list. More... | |
template<class AnyType , class AnyHash > | |
hashedWordList (const HashTable< AnyType, word, AnyHash > &tbl) | |
Construct from the word keys of any HashTable, sorting immediately. More... | |
hashedWordList (const label len, const char **array, bool unique=false) | |
Construct from number and list of words,. More... | |
hashedWordList (const char **array, bool unique=false) | |
hashedWordList (Istream &is) | |
Construct from Istream. More... | |
void | clear () |
Clear the list, i.e. set size to zero. More... | |
void | append (const word &name, bool unique=false) |
bool | found (const word &name) const |
Search hashed values for the specified name. More... | |
const HashTable< label > & | lookup () const |
Return the hash of words/indices for inspection. More... | |
void | swap (hashedWordList &list) |
Swap contents. More... | |
void | transfer (hashedWordList &list) |
void | transfer (wordList &list, bool unique=false) |
void | rehash () const |
Rebuild the lookup hash indices. More... | |
void | rehash (bool unique) |
Rebuild the lookup hash indices, or make unique entries first. More... | |
void | uniq () |
void | sort () |
Sort the list and rehash the indices. More... | |
const word & | operator[] (const label index) const |
Return name corresponding to specified index. More... | |
label | operator[] (const word &name) const |
Return index corresponding to specified name, or -1 on failure. More... | |
bool | operator() (const word &name) const |
Check hashed values for the specified name - same as found. More... | |
void | operator= (const hashedWordList &list) |
Copy assignment. Rehashes the indices. More... | |
void | operator= (const wordUList &list) |
Copy assignment from list of words. Rehashes the indices. More... | |
void | operator= (std::initializer_list< word > list) |
Copy assignment from initializer list. Rehashes the indices. More... | |
void | operator= (hashedWordList &&list) |
Move assignment operator. More... | |
void | operator= (wordList &&list) |
Move assignment from list of words. Rehashes the indices. More... | |
bool | contains (const word &name) const |
Deprecated(2019-01) Is the specified name found in the list? More... | |
![]() | |
constexpr | List () noexcept |
Default construct. More... | |
List (const label len) | |
Construct with given size. More... | |
List (const label len, const word &val) | |
Construct with given size and value for all elements. More... | |
List (const label len, const Foam::zero) | |
Construct with given size initializing all elements to zero. More... | |
List (const Foam::one, const word &val) | |
Construct with length=1, copying the value as the only content. More... | |
List (const Foam::one, word &&val) | |
Construct with length=1, moving the value as the only content. More... | |
List (const Foam::one, const Foam::zero) | |
Construct with length=1, initializing content to zero. More... | |
List (const List< word > &a) | |
Copy construct from list. More... | |
List (const UList< word > &a) | |
Copy construct contents from list. More... | |
List (List< word > &a, bool reuse) | |
Construct as copy or re-use as specified. More... | |
List (const UList< word > &list, const labelUList &indices) | |
Copy construct subset of list. More... | |
List (const UList< word > &list, const FixedList< label, N > &indices) | |
Copy construct subset of list. More... | |
List (const FixedList< word, N > &list) | |
Construct as copy of FixedList<T, N> More... | |
List (const PtrList< word > &list) | |
Construct as copy of PtrList<T> More... | |
List (const SLList< word > &list) | |
Construct as copy of SLList<T> More... | |
List (const IndirectListBase< word, Addr > &list) | |
Construct as copy of IndirectList contents. More... | |
List (std::initializer_list< word > list) | |
Construct from an initializer list. More... | |
List (List< word > &&list) | |
Move construct from List. More... | |
List (DynamicList< word, SizeMin > &&list) | |
Move construct from DynamicList. More... | |
List (SortableList< word > &&list) | |
Move construct from SortableList. More... | |
List (SLList< word > &&list) | |
Move construct from SLList. More... | |
List (Istream &is) | |
Construct from Istream. More... | |
autoPtr< List< word > > | clone () const |
Clone. More... | |
~List () | |
Destructor. More... | |
void | clear () |
Clear the list, i.e. set size to zero. More... | |
void | resize (const label len) |
Adjust allocated size of list. More... | |
void | resize (const label len, const word &val) |
Adjust allocated size of list and set val for new elements. More... | |
void | resize (const label newLen) |
void | resize_nocopy (const label len) |
Adjust allocated size of list without necessarily. More... | |
void | setSize (const label n) |
Alias for resize() More... | |
void | setSize (const label n, const word &val) |
Alias for resize() More... | |
void | append (const word &val) |
Append an element at the end of the list. More... | |
void | append (word &&val) |
Move append an element at the end of the list. More... | |
void | append (const UList< word > &list) |
Append a List to the end of this list. More... | |
void | append (const IndirectListBase< word, Addr > &list) |
Append IndirectList contents at the end of this list. More... | |
label | appendUniq (const word &val) |
Append an element if not already in the list. More... | |
void | transfer (List< word > &list) |
void | transfer (DynamicList< word, SizeMin > &list) |
void | transfer (SortableList< word > &list) |
word & | newElmt (const label i) |
void | operator= (const UList< word > &a) |
Assignment to UList operator. Takes linear time. More... | |
void | operator= (const List< word > &list) |
Assignment operator. Takes linear time. More... | |
void | operator= (const SLList< word > &list) |
Assignment to SLList operator. Takes linear time. More... | |
void | operator= (const IndirectListBase< word, Addr > &list) |
Assignment from IndirectList. Takes linear time. More... | |
void | operator= (const FixedList< word, N > &list) |
Copy assignment from FixedList. More... | |
void | operator= (std::initializer_list< word > list) |
Assignment to an initializer list. More... | |
void | operator= (const word &val) |
Assignment of all entries to the given value. More... | |
void | operator= (const Foam::zero) |
Assignment of all entries to zero. More... | |
void | operator= (List< word > &&list) |
Move assignment. Takes constant time. More... | |
void | operator= (DynamicList< word, SizeMin > &&list) |
Move assignment. Takes constant time. More... | |
void | operator= (SortableList< word > &&list) |
Move assignment. Takes constant time. More... | |
void | operator= (SLList< word > &&list) |
Move assignment. Takes constant time. More... | |
Istream & | readList (Istream &is) |
Read List from Istream, discarding contents of existing List. More... | |
Istream & | readList (Istream &is) |
Istream & | readList (Istream &is) |
void | shallowCopy (const UList< word > &)=delete |
No shallowCopy permitted. More... | |
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type | set (const label i, bool val=true) |
A bitSet::set() method for a list of bool. More... | |
Additional Inherited Members | |
![]() | |
typedef SubList< word > | subList |
Declare type of subList. More... | |
![]() | |
static const List< word > & | null () |
Return a null List. More... | |
A wordList with hashed named lookup, which can be faster in some situations than using the normal list find/found methods.
Definition at line 54 of file hashedWordList.H.
|
default |
Default construct an empty list.
|
inline |
Copy construct.
Definition at line 30 of file hashedWordListI.H.
|
inline |
Move construct.
Definition at line 36 of file hashedWordListI.H.
|
inlineexplicit |
Copy construct from list of words.
Definition at line 43 of file hashedWordListI.H.
|
inline |
Copy construct from list of words, eliminating duplicates.
Definition at line 49 of file hashedWordListI.H.
References hashedWordList::rehash().
|
inline |
Move construct from list of words, optionally eliminating duplicates.
Definition at line 57 of file hashedWordListI.H.
References hashedWordList::rehash().
|
inline |
Construct from an initializer list.
Definition at line 65 of file hashedWordListI.H.
References hashedWordList::rehash().
|
inlineexplicit |
Construct from the word keys of any HashTable, sorting immediately.
This also handles a wordHashSet, which is derived from a HashTable. The result is similar to a HashTable::sortedToc.
Definition at line 75 of file hashedWordListI.H.
References HashTable< T, Key, Hash >::cbegin(), HashTable< T, Key, Hash >::cend(), Foam::BitOps::count(), and Foam::sort().
hashedWordList | ( | const label | len, |
const char ** | array, | ||
bool | unique = false |
||
) |
Construct from number and list of words,.
optionally eliminating duplicates
Definition at line 34 of file hashedWordList.C.
hashedWordList | ( | const char ** | array, |
bool | unique = false |
||
) |
Construct from a nullptr-terminated list of words, optionally eliminating duplicates
Definition at line 51 of file hashedWordList.C.
|
inline |
Construct from Istream.
Definition at line 93 of file hashedWordListI.H.
|
inline |
Clear the list, i.e. set size to zero.
Definition at line 101 of file hashedWordListI.H.
References List< word >::clear().
Append an element at the end of the list, optionally avoid append if it would be a duplicate entry
Definition at line 108 of file hashedWordListI.H.
References List< word >::append(), and Foam::name().
Search hashed values for the specified name.
Definition at line 141 of file hashedWordListI.H.
References Foam::name().
Referenced by hashedWordList::contains().
|
inline |
Return the hash of words/indices for inspection.
Definition at line 119 of file hashedWordListI.H.
|
inline |
Swap contents.
Definition at line 147 of file hashedWordListI.H.
|
inline |
Transfer contents of the argument into this list and annul the argument list, optionally eliminating duplicates
Definition at line 159 of file hashedWordListI.H.
References List< word >::transfer().
Transfer the contents of the argument List into this list and annul the argument list, optionally eliminating duplicates
Definition at line 166 of file hashedWordListI.H.
References List< word >::transfer().
void rehash | ( | ) | const |
Rebuild the lookup hash indices.
Definition at line 59 of file hashedWordList.C.
References UList< T >::size().
Referenced by hashedWordList::hashedWordList(), and Foam::operator>>().
|
inline |
Rebuild the lookup hash indices, or make unique entries first.
Definition at line 173 of file hashedWordListI.H.
void uniq | ( | ) |
Adjust the list (if needed) to eliminate duplicate entries, and rehash the indices
Definition at line 73 of file hashedWordList.C.
References Foam::BitOps::count(), and List< T >::resize().
|
inline |
Sort the list and rehash the indices.
Definition at line 186 of file hashedWordListI.H.
References Foam::sort().
|
inline |
Return name corresponding to specified index.
Fatal for out of range values.
Definition at line 196 of file hashedWordListI.H.
|
inline |
Return index corresponding to specified name, or -1 on failure.
Definition at line 204 of file hashedWordListI.H.
References Foam::name().
Check hashed values for the specified name - same as found.
Can be used as a unary predicate.
Definition at line 210 of file hashedWordListI.H.
References Foam::name().
|
inline |
Copy assignment. Rehashes the indices.
Definition at line 216 of file hashedWordListI.H.
References List< word >::operator=().
|
inline |
Copy assignment from list of words. Rehashes the indices.
Definition at line 223 of file hashedWordListI.H.
References List< word >::operator=().
|
inline |
Copy assignment from initializer list. Rehashes the indices.
Definition at line 230 of file hashedWordListI.H.
References List< word >::operator=().
|
inline |
Move assignment operator.
Definition at line 237 of file hashedWordListI.H.
References List< word >::transfer().
|
inline |
Move assignment from list of words. Rehashes the indices.
Definition at line 244 of file hashedWordListI.H.
References List< word >::transfer().
Deprecated(2019-01) Is the specified name found in the list?
Definition at line 186 of file hashedWordList.H.
References hashedWordList::found().