diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C index 65f516a8c7..5fe3d84c73 100644 --- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C +++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -185,20 +185,20 @@ Foam::wordList Foam::DictionaryBase::sortedToc template -void Foam::DictionaryBase::insert(const word& keyword, T* tPtr) +void Foam::DictionaryBase::prepend(const word& keyword, T* ptr) { // NOTE: we should probably check that HashTable::insert actually worked - hashedTs_.insert(keyword, tPtr); - IDLListType::insert(tPtr); + hashedTs_.insert(keyword, ptr); + IDLListType::prepend(ptr); } template -void Foam::DictionaryBase::append(const word& keyword, T* tPtr) +void Foam::DictionaryBase::append(const word& keyword, T* ptr) { // NOTE: we should probably check that HashTable::insert actually worked - hashedTs_.insert(keyword, tPtr); - IDLListType::append(tPtr); + hashedTs_.insert(keyword, ptr); + IDLListType::append(ptr); } diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H index 927c9ae5c0..f98f286c51 100644 --- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H +++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,8 +48,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef DictionaryBase_H -#define DictionaryBase_H +#ifndef Foam_DictionaryBase_H +#define Foam_DictionaryBase_H #include "HashTable.H" #include "wordList.H" @@ -141,11 +141,11 @@ public: // Editing - //- Add at head of dictionary - void insert(const word& keyword, T*); + //- Add to front of dictionary + void prepend(const word& keyword, T* ptr); - //- Add at tail of dictionary - void append(const word& keyword, T*); + //- Add to back of dictionary + void append(const word& keyword, T* ptr); //- Remove and return entry specified by keyword. // Return nullptr if the keyword was not found. @@ -189,7 +189,6 @@ public: // Housekeeping //- Deprecated(2020-03) use cfind() - // // \deprecated(2020-03) - use cfind() method FOAM_DEPRECATED_FOR(2020-03, "cfind() method") const T* lookupPtr(const word& keyword) const @@ -198,13 +197,18 @@ public: } //- Deprecated(2020-03) use find() - // // \deprecated(2020-03) - use find() method FOAM_DEPRECATED_FOR(2020-03, "find() method") T* lookupPtr(const word& keyword) { return this->find(keyword); } + + //- Add to front of dictionary + void insert(const word& keyword, T* ptr) + { + this->prepend(keyword, ptr); + } }; diff --git a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C index 609562ef5d..7cec1b4541 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C +++ b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C @@ -1,61 +1 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2013 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "PtrDictionary.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::PtrDictionary::PtrDictionary(const label size) -: - DictionaryBase, T>(size) -{} - - -template -Foam::PtrDictionary::PtrDictionary(const PtrDictionary& dict) -: - DictionaryBase, T>(dict) -{} - - -template -template -Foam::PtrDictionary::PtrDictionary(Istream& is, const INew& iNew) -: - DictionaryBase, T>(is, iNew) -{} - - -template -Foam::PtrDictionary::PtrDictionary(Istream& is) -: - DictionaryBase, T>(is) -{} - - -// ************************************************************************* // +#warning File removed - left for old dependency check only diff --git a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H index 0fbf8f4244..4581c1c231 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H +++ b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H @@ -32,13 +32,10 @@ Description It is derived from DictionaryBase instantiated on a memory managed form of intrusive doubly-linked list of \. -SourceFiles - PtrDictionary.C - \*---------------------------------------------------------------------------*/ -#ifndef PtrDictionary_H -#define PtrDictionary_H +#ifndef Foam_PtrDictionary_H +#define Foam_PtrDictionary_H #include "DictionaryBase.H" #include "DLPtrList.H" @@ -57,26 +54,37 @@ class PtrDictionary : public DictionaryBase, T> { - public: // Constructors //- Construct given initial table size - PtrDictionary(const label size = 128); + explicit PtrDictionary(const label size = 128) + : + DictionaryBase, T>(size) + {} //- Copy construct - PtrDictionary(const PtrDictionary& dict); + PtrDictionary(const PtrDictionary& dict) + : + DictionaryBase, T>(dict) + {} //- Construct from Istream using given Istream constructor class template - PtrDictionary(Istream& is, const INew& inew); + PtrDictionary(Istream& is, const INew& inew) + : + DictionaryBase, T>(is, inew) + {} //- Construct from Istream - PtrDictionary(Istream& is); + explicit PtrDictionary(Istream& is) + : + DictionaryBase, T>(is) + {} - // Member operators + // Member Operators //- Find and return entry const T& operator[](const word& key) const @@ -96,14 +104,6 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "PtrDictionary.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H index 00ff3ee45b..a221dd6a2d 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H +++ b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef PtrListDictionary_H -#define PtrListDictionary_H +#ifndef Foam_PtrListDictionary_H +#define Foam_PtrListDictionary_H #include "DictionaryBase.H" #include "PtrList.H" @@ -57,13 +57,12 @@ class PtrListDictionary : public DictionaryBase, T> { - public: // Constructors //- Construct given initial list size - PtrListDictionary(const label size); + explicit PtrListDictionary(const label size); //- Copy construct PtrListDictionary(const PtrListDictionary& dict); @@ -73,19 +72,19 @@ public: PtrListDictionary(Istream& is, const INew& inew); //- Construct from Istream - PtrListDictionary(Istream& is); + explicit PtrListDictionary(Istream& is); // Member functions //- Set element to pointer provided and return old element - autoPtr set(const label, const word& key, T*); + autoPtr set(const label i, const word& key, T* ptr); //- Set element to autoPtr value provided and return old element - autoPtr set(const label, const word& key, autoPtr&); + autoPtr set(const label i, const word& key, autoPtr& aptr); //- Set element to tmp value provided and return old element - autoPtr set(const label, const word& key, tmp&); + autoPtr set(const label i, const word& key, tmp& t); // Member operators diff --git a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C index 0652eedc48..7cec1b4541 100644 --- a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C +++ b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C @@ -1,48 +1 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2013 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "UPtrDictionary.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::UPtrDictionary::UPtrDictionary(const label size) -: - DictionaryBase, T>(size) -{} - - -template -Foam::UPtrDictionary::UPtrDictionary(const UPtrDictionary& dict) -: - DictionaryBase, T>(dict) -{} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// ************************************************************************* // +#warning File removed - left for old dependency check only diff --git a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H index 8702e8b852..1ff0b8bde4 100644 --- a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H +++ b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H @@ -33,13 +33,10 @@ Description It is derived from DictionaryBase instantiated on a non-memory managed form of intrusive doubly-linked list of \. -SourceFiles - UPtrDictionary.C - \*---------------------------------------------------------------------------*/ -#ifndef UPtrDictionary_H -#define UPtrDictionary_H +#ifndef Foam_UPtrDictionary_H +#define Foam_UPtrDictionary_H #include "DictionaryBase.H" #include "DLList.H" @@ -58,16 +55,21 @@ class UPtrDictionary : public DictionaryBase, T> { - public: // Constructors //- Construct given initial table size - UPtrDictionary(const label size = 128); + explicit UPtrDictionary(const label size = 128) + : + DictionaryBase, T>(size) + {} //- Copy construct - UPtrDictionary(const UPtrDictionary&); + UPtrDictionary(const UPtrDictionary& dict) + : + DictionaryBase, T>(dict) + {} }; @@ -77,12 +79,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository - #include "UPtrDictionary.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* //