diff --git a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C index 7ca213778e..e9626ae2ed 100644 --- a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C +++ b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C @@ -75,7 +75,7 @@ Foam::HashPtrTable::~HashPtrTable() template Foam::autoPtr Foam::HashPtrTable::remove(iterator& iter) { - if (iter.found()) + if (iter.good()) { autoPtr aptr(iter.object()); this->parent_type::erase(iter); @@ -97,7 +97,7 @@ Foam::autoPtr Foam::HashPtrTable::remove(const Key& key) template bool Foam::HashPtrTable::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 323d5450f0..8b6f4ae10a 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 List; template 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 93132e2bc1..c693df431c 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::Iterator::increment() } +template +template +inline bool +Foam::HashTable::Iterator::good() const +{ + return entry_; +} + + template template inline bool diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index c538e147e2..4bb2825e41 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 +#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 6f07210821..af3e2b6150 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 7b364137ba..b79afb0adb 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 +#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 be940f3ab2..b4d46b3d41 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 e5f79faebe..30e6c687cf 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 18057745a0..2889598736 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 (