mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: combine files, explicit constructors (Dictionary)
This commit is contained in:
@ -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<IDLListType, T>::sortedToc
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::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<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class INew>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is, iNew)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
#warning File removed - left for old dependency check only
|
||||
|
||||
@ -32,13 +32,10 @@ Description
|
||||
It is derived from DictionaryBase instantiated on a memory managed form of
|
||||
intrusive doubly-linked list of \<T\>.
|
||||
|
||||
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<DLPtrList<T>, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial table size
|
||||
PtrDictionary(const label size = 128);
|
||||
explicit PtrDictionary(const label size = 128)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(size)
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
PtrDictionary(const PtrDictionary& dict);
|
||||
PtrDictionary(const PtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
PtrDictionary(Istream& is, const INew& inew);
|
||||
PtrDictionary(Istream& is, const INew& inew)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is, inew)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
PtrDictionary(Istream& is);
|
||||
explicit PtrDictionary(Istream& is)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, 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
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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<PtrList<T>, 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<T> set(const label, const word& key, T*);
|
||||
autoPtr<T> set(const label i, const word& key, T* ptr);
|
||||
|
||||
//- Set element to autoPtr value provided and return old element
|
||||
autoPtr<T> set(const label, const word& key, autoPtr<T>&);
|
||||
autoPtr<T> set(const label i, const word& key, autoPtr<T>& aptr);
|
||||
|
||||
//- Set element to tmp value provided and return old element
|
||||
autoPtr<T> set(const label, const word& key, tmp<T>&);
|
||||
autoPtr<T> set(const label i, const word& key, tmp<T>& t);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "UPtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
#warning File removed - left for old dependency check only
|
||||
|
||||
@ -33,13 +33,10 @@ Description
|
||||
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||
form of intrusive doubly-linked list of \<T\>.
|
||||
|
||||
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<DLList<T*>, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial table size
|
||||
UPtrDictionary(const label size = 128);
|
||||
explicit UPtrDictionary(const label size = 128)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(size)
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
UPtrDictionary(const UPtrDictionary&);
|
||||
UPtrDictionary(const UPtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(dict)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@ -77,12 +79,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "UPtrDictionary.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user