OpenFOAM/containers/LinkedLists: Replaced partially specialized template classes with C++11 template aliases
This feature of C++11 avoids complex code duplication simplifies code maintenance
This commit is contained in:
parent
0f6fb1c07a
commit
8e9a8373dd
9 changed files with 41 additions and 294 deletions
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::DLList
|
||||
|
||||
Description
|
||||
|
|
@ -39,42 +39,9 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DLList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class DLList
|
||||
:
|
||||
public LList<DLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
DLList()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
DLList(T a)
|
||||
:
|
||||
LList<DLListBase, T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
DLList(Istream& is)
|
||||
:
|
||||
LList<DLListBase, T>(is)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class T>
|
||||
using DLList = LList<DLListBase, T>;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::DLPtrList
|
||||
|
||||
Description
|
||||
|
|
@ -39,43 +39,9 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DLPtrList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class DLPtrList
|
||||
:
|
||||
public LPtrList<DLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
DLPtrList()
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
DLPtrList(Istream& is, const INew& inewt)
|
||||
:
|
||||
LPtrList<DLListBase, T>(is, inewt)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
DLPtrList(Istream& is)
|
||||
:
|
||||
LPtrList<DLListBase, T>(is)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class T>
|
||||
using DLPtrList = LPtrList<DLListBase, T>;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -58,21 +58,8 @@ public:
|
|||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
FIFOStack()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
FIFOStack(T a)
|
||||
:
|
||||
SLList<T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
FIFOStack(Istream& is)
|
||||
:
|
||||
SLList<T>(is)
|
||||
{}
|
||||
//- Inherit constructors from SLList
|
||||
using SLList<T>::SLList;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::IDLList
|
||||
|
||||
Description
|
||||
|
|
@ -39,56 +39,9 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IDLList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class IDLList
|
||||
:
|
||||
public ILList<DLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
IDLList()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
IDLList(const T& a)
|
||||
:
|
||||
ILList<DLListBase, T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
IDLList(Istream& is, const INew& inewt)
|
||||
:
|
||||
ILList<DLListBase, T>(is, inewt)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
IDLList(Istream& is)
|
||||
:
|
||||
ILList<DLListBase, T>(is)
|
||||
{}
|
||||
|
||||
//- Copy constructor with additional argument for clone
|
||||
template<class CloneArg>
|
||||
IDLList(const IDLList<T>& idll, const CloneArg& cloneArg)
|
||||
:
|
||||
ILList<DLListBase, T>(idll, cloneArg)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class T>
|
||||
using IDLList = ILList<DLListBase, T>;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::ISLList
|
||||
|
||||
Description
|
||||
|
|
@ -39,52 +39,8 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ISLList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class ISLList
|
||||
:
|
||||
public ILList<SLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
ISLList()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
ISLList(const T& a)
|
||||
:
|
||||
ILList<SLListBase, T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
ISLList(Istream& is, const INew& inewt)
|
||||
:
|
||||
ILList<SLListBase, T>(is, inewt)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
ISLList(Istream& is)
|
||||
:
|
||||
ILList<SLListBase, T>(is)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
template<class T>
|
||||
using ISLList = ILList<SLListBase, T>;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -58,21 +58,8 @@ public:
|
|||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
LIFOStack()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
LIFOStack(T a)
|
||||
:
|
||||
SLList<T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
LIFOStack(Istream& is)
|
||||
:
|
||||
SLList<T>(is)
|
||||
{}
|
||||
//- Inherit constructors from SLList
|
||||
using SLList<T>::SLList;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::SLPtrList
|
||||
|
||||
Description
|
||||
|
|
@ -39,49 +39,9 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SLPtrList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class SLPtrList
|
||||
:
|
||||
public LPtrList<SLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
SLPtrList()
|
||||
{}
|
||||
|
||||
//- Construct given initial T*
|
||||
SLPtrList(T* a)
|
||||
:
|
||||
LPtrList<SLListBase, T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
SLPtrList(Istream& is, const INew& inewt)
|
||||
:
|
||||
LPtrList<SLListBase, T>(is, inewt)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
SLPtrList(Istream& is)
|
||||
:
|
||||
LPtrList<SLListBase, T>(is)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class T>
|
||||
using SLPtrList = LPtrList<SLListBase, T>;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -21,7 +21,7 @@ License
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Alias
|
||||
Foam::UIDLList
|
||||
|
||||
Description
|
||||
|
|
@ -39,42 +39,9 @@ Description
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class UIDLList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class UIDLList
|
||||
:
|
||||
public UILList<DLListBase, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
UIDLList()
|
||||
{}
|
||||
|
||||
//- Construct given initial T
|
||||
UIDLList(T a)
|
||||
:
|
||||
UILList<DLListBase, T>(a)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
UIDLList(Istream& is)
|
||||
:
|
||||
UILList<DLListBase, T>(is)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class T>
|
||||
using UIDLList = UILList<DLListBase, T>;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,14 @@ namespace Foam
|
|||
|
||||
// Forward declaration of classes
|
||||
|
||||
template<class T> class SLPtrList;
|
||||
template<class T> class autoPtr;
|
||||
template<class T> class tmp;
|
||||
|
||||
class SLListBase;
|
||||
template<class LListBase, class T> class LPtrList;
|
||||
template<class T>
|
||||
using SLPtrList = LPtrList<SLListBase, T>;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class T> class PtrList;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue