diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C index 99f31c94ea4b02d9788e79bef09dd66efaa652c0..565cac9493810d3b7cfead47a795897161318677 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C @@ -124,6 +124,14 @@ void Foam::ILList<LListBase, T>::clear() } +template<class LListBase, class T> +void Foam::ILList<LListBase, T>::transfer(ILList<LListBase, T>& lst) +{ + clear(); + LListBase::transfer(lst); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class LListBase, class T> diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H index 0eace95f67c456ef0bd7c19530741b0e06552bc2..401a8b60388100bb60273a2afe0490c8f22b0eb1 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H @@ -139,6 +139,10 @@ public: //- Clear the contents of the list void clear(); + //- Transfer the contents of the argument into this List + // and annull the argument list. + void transfer(ILList<LListBase, T>&); + // Member operators diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C index c2fdb1b82034f7fee56306bee07b0a4838ee3fda..1c93142b416245af36a84dfb12d6880ef3b0b111 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C @@ -65,6 +65,14 @@ void Foam::LList<LListBase, T>::clear() } +template<class LListBase, class T> +void Foam::LList<LListBase, T>::transfer(LList<LListBase, T>& lst) +{ + clear(); + LListBase::transfer(lst); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class LListBase, class T> diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H index fdb589d53c774126e991e2c49385eb33eeb82137..4c422f7ccb2ae01f59add91906f1f33bd49d2ccf 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H @@ -200,6 +200,9 @@ public: //- Delete contents of list void clear(); + //- Transfer the contents of the argument into this List + // and annull the argument list. + void transfer(LList<LListBase, T>&); // Member operators diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C index f958b183ecc577917e360c72c15a9394cea24bd9..935e68292c080d89d4203548ec0d17c479d50c8b 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C @@ -26,15 +26,10 @@ License #include "LPtrList.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class LListBase, class T> -LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst) +Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst) : LList<LListBase, T*>() { @@ -48,7 +43,7 @@ LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class LListBase, class T> -LPtrList<LListBase, T>::~LPtrList() +Foam::LPtrList<LListBase, T>::~LPtrList() { clear(); } @@ -56,9 +51,8 @@ LPtrList<LListBase, T>::~LPtrList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return and remove head template<class LListBase, class T> -bool LPtrList<LListBase, T>::eraseHead() +bool Foam::LPtrList<LListBase, T>::eraseHead() { T* tPtr; if ((tPtr = this->removeHead())) @@ -74,7 +68,7 @@ bool LPtrList<LListBase, T>::eraseHead() template<class LListBase, class T> -void LPtrList<LListBase, T>::clear() +void Foam::LPtrList<LListBase, T>::clear() { label oldSize = this->size(); for (label i=0; i<oldSize; i++) @@ -86,10 +80,18 @@ void LPtrList<LListBase, T>::clear() } +template<class LListBase, class T> +void Foam::LPtrList<LListBase, T>::transfer(LPtrList<LListBase, T>& lst) +{ + clear(); + LList<LListBase, T*>::transfer(lst); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class LListBase, class T> -void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst) +void Foam::LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst) { clear(); @@ -100,10 +102,6 @@ void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // #include "LPtrListIO.C" diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H index 601d26f87617ee3943e658d7be6e928d0972eaa1..fdb59ea27cd1cc553e5121ca8b543e07e588876d 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H @@ -149,12 +149,16 @@ public: // Edit - //- Remove the head element specified from the list and delete it + //- Remove the head element from the list and delete the pointer bool eraseHead(); - //- Remove the specified element from the list and delete it + //- Clear the contents of the list void clear(); + //- Transfer the contents of the argument into this List + // and annull the argument list. + void transfer(LPtrList<LListBase, T>&); + // Member operators