diff --git a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C index 7ca213778eac349f3c719e441f3b4919bb9daef9..e9626ae2ed38f050720b401082826402954c2df3 100644 --- a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C +++ b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C @@ -75,7 +75,7 @@ Foam::HashPtrTable<T, Key, Hash>::~HashPtrTable() template<class T, class Key, class Hash> Foam::autoPtr<T> Foam::HashPtrTable<T, Key, Hash>::remove(iterator& iter) { - if (iter.found()) + if (iter.good()) { autoPtr<T> aptr(iter.object()); this->parent_type::erase(iter); @@ -97,7 +97,7 @@ Foam::autoPtr<T> Foam::HashPtrTable<T, Key, Hash>::remove(const Key& key) template<class T, class Key, class Hash> bool Foam::HashPtrTable<T, Key, Hash>::erase(iterator& iter) { - if (iter.found()) + if (iter.good()) { T* ptr = iter.object(); diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 323d5450f03ff226c32127ddbac6f30770e0320b..8b6f4ae10aa4c224ccd85b52a5839d03a92488fe 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,7 +95,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward declarations template<class T> class List; template<class T> class UList; @@ -678,6 +678,10 @@ protected: // Member Functions + //- True if iterator points to an entry + // This can be used directly instead of comparing to end() + inline bool good() const; + //- True if iterator points to an entry // This can be used directly instead of comparing to end() inline bool found() const; diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIterI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIterI.H index 93132e2bc178fb5e5b6730f903a59f3ea925087e..c693df431c7062ce26d61b7dbaccb3254369bb22 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIterI.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIterI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,6 +107,15 @@ Foam::HashTable<T, Key, Hash>::Iterator<Const>::increment() } +template<class T, class Key, class Hash> +template<bool Const> +inline bool +Foam::HashTable<T, Key, Hash>::Iterator<Const>::good() const +{ + return entry_; +} + + template<class T, class Key, class Hash> template<bool Const> inline bool diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index c538e147e211aad97d6b65045955a59b7119c30f..4bb2825e415d02212cb1aa143440bf593c45dd46 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,7 +45,7 @@ SourceFiles #include "label.H" #include "uLabel.H" -#include <utility> +#include "stdFoam.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -237,7 +237,15 @@ public: inline link* get_node() const; //- Pointing at a valid storage node - inline bool found() const; + inline bool good() const; + + //- Deprecated(2019-01) Pointing at a valid storage node + // \deprecated(2019-01) - use good() method + inline bool found() const + FOAM_DEPRECATED_FOR(2019-01, "good() method") + { + return this->good(); + } //- Move backward through list inline void prev(); @@ -283,7 +291,15 @@ public: inline const link* get_node() const; //- Pointing at a valid storage node - inline bool found() const; + inline bool good() const; + + //- Deprecated(2019-01) Pointing at a valid storage node + // \deprecated(2019-01) - use good() method + inline bool found() const + FOAM_DEPRECATED_FOR(2019-01, "good() method") + { + return this->good(); + } //- Move backward through list inline void prev(); diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H index 6f072108218ec851018abef9c414a16d44025708..af3e2b6150f3d584a37587e8cee619809e3cc6f4 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -245,7 +245,7 @@ Foam::DLListBase::iterator::get_node() const } -inline bool Foam::DLListBase::iterator::found() const +inline bool Foam::DLListBase::iterator::good() const { return (node_ != nullptr); } @@ -351,7 +351,7 @@ Foam::DLListBase::const_iterator::get_node() const } -inline bool Foam::DLListBase::const_iterator::found() const +inline bool Foam::DLListBase::const_iterator::good() const { return (node_ != nullptr); } diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H index 7b364137ba7fd6f6f86462bd703cbab4cbc444f3..b79afb0adb7d3f43eccd45f41de6d84867498d4e 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,7 +45,7 @@ SourceFiles #include "label.H" #include "uLabel.H" -#include <utility> +#include "stdFoam.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -213,7 +213,15 @@ public: inline link* get_node() const; //- Pointing at a valid storage node - inline bool found() const; + inline bool good() const; + + //- Deprecated(2019-01) Pointing at a valid storage node + // \deprecated(2019-01) - use good() method + inline bool found() const + FOAM_DEPRECATED_FOR(2019-01, "good() method") + { + return this->good(); + } //- Cannot move backward through list inline void prev() = delete; @@ -257,7 +265,15 @@ public: inline const link* get_node() const; //- Pointing at a valid storage node - inline bool found() const; + inline bool good() const; + + //- Deprecated(2019-01) Pointing at a valid storage node + // \deprecated(2019-01) - use good() method + inline bool found() const + FOAM_DEPRECATED_FOR(2019-01, "good() method") + { + return this->good(); + } //- Cannot move backward through list inline void prev() = delete; diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H index be940f3ab2f51528cddad30c17d4bbcd2d7d4967..b4d46b3d41014748b66edc7b57d4af7e03d70d80 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -189,7 +189,7 @@ Foam::SLListBase::iterator::get_node() const } -inline bool Foam::SLListBase::iterator::found() const +inline bool Foam::SLListBase::iterator::good() const { return (node_ != nullptr); } @@ -288,7 +288,7 @@ Foam::SLListBase::const_iterator::get_node() const } -inline bool Foam::SLListBase::const_iterator::found() const +inline bool Foam::SLListBase::const_iterator::good() const { return (node_ != nullptr); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index e5f79faebe916725593e73ca741afe5acf05f5b0..30e6c687cf3fdd4e36169b27a35b6ea028be9b5c 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -192,6 +192,12 @@ public: {} + //- True if entry was found + inline bool good() const + { + return eptr_; + } + //- True if entry was found inline bool found() const { diff --git a/src/OpenFOAM/db/dictionary/dictionarySearch.C b/src/OpenFOAM/db/dictionary/dictionarySearch.C index 18057745a0fed7a3619f4cc187a14d5d34c0075c..28895987365e00d6e90162207518cdd0db505d3a 100644 --- a/src/OpenFOAM/db/dictionary/dictionarySearch.C +++ b/src/OpenFOAM/db/dictionary/dictionarySearch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,7 @@ namespace ReIterator& reIter ) { - while (wcIter.found()) + while (wcIter.good()) { if (