Go to the documentation of this file.
41 #ifndef HashPtrTable_H
42 #define HashPtrTable_H
55 template<
class T,
class Key,
class Hash>
class HashPtrTable;
57 template<
class T,
class Key,
class Hash>
65 template<
class T,
class Key=word,
class Hash=Foam::Hash<Key>>
128 inline const T*
get(
const Key&
key)
const;
201 template<
class... Args>
206 template<
class... Args>
211 inline bool insert(
const Key&,
T*) =
delete;
226 inline bool insert(
const Key&
key, std::unique_ptr<T>&& ptr);
229 inline bool set(
const Key&
key,
T* ptr);
238 inline bool set(
const Key&
key, std::unique_ptr<T>&& ptr);
bool erase(iterator &iter)
Forward iterator with non-const access.
autoPtr< T > remove(iterator &iter)
Remove entry specified by given iterator.
~HashPtrTable()
Destructor.
Forward iterator with const access.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Istream & operator>>(Istream &, directionInfo &)
autoPtr< T > release(iterator &iter)
Release ownership of the pointer and replace with a nullptr.
HashPtrTable< T, Key, Hash > this_type
The template instance used for this table.
A helper class when constructing from an Istream or dictionary.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
void clear()
Clear all entries from table and delete any allocated pointers.
bool set(const Key &key, T *ptr)
Assign a new entry, overwriting existing entries.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
HashPtrTable()=default
Default construct with default table capacity.
bool insert(const Key &, T *)=delete
void write(Ostream &os) const
Invoke write() on each non-null entry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
HashTable< T *, Key, Hash > parent_type
The template instance used for the parent HashTable.
OBJstream os(runTime.globalPath()/outputName)
void operator=(const this_type &rhs)
Copy assignment.
A HashTable similar to std::unordered_map.
bool emplace_set(const Key &key, Args &&... args)
Emplace set an entry, overwriting any existing entries.
typename parent_type::const_iterator const_iterator
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
const T * get(const Key &key) const
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Foam::argList args(argc, argv)
typename parent_type::iterator iterator
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.