From b2d7439b86f54869c2bed8bc09dde34973df1cec Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 25 Nov 2009 14:47:48 +0100 Subject: [PATCH] Lists get first() and last() member functions - this builds on Mattijs' commit 968f0bbd57b85 but with a first() as well. - Added both to FixedList, IndirectList, UIndirectList and *PtrList and since they can certainly be useful there. Did not add to BiIndirectList, since I'm not sure what it should mean there. Did not add to PackedList, since it's not clear how useful they'd be yet in these contexts (and I'm not sure how it would interact with the iterator proxy implementation). - Note: STL defines front() and back() for these methods. --- .../DictionaryBase/DictionaryBase.H | 2 +- .../HashTables/HashTable/HashTable.H | 4 +- .../StaticHashTable/StaticHashTable.H | 2 +- .../LinkedLists/accessTypes/ILList/ILList.H | 2 +- .../LinkedLists/accessTypes/LList/LList.H | 2 +- .../accessTypes/LPtrList/LPtrList.H | 2 +- .../linkTypes/DLListBase/DLListBase.H | 2 +- .../linkTypes/SLListBase/SLListBase.H | 2 +- .../Lists/BiIndirectList/BiIndirectList.H | 9 ++++- .../Lists/CompactListList/CompactListList.H | 2 +- .../containers/Lists/FixedList/FixedList.H | 12 ++++++ .../containers/Lists/FixedList/FixedListI.H | 28 ++++++++++++++ .../Lists/IndirectList/IndirectList.H | 22 ++++++++++- .../Lists/IndirectList/IndirectListI.H | 28 ++++++++++++++ src/OpenFOAM/containers/Lists/List/List.C | 6 +-- src/OpenFOAM/containers/Lists/List/List.H | 6 +-- .../containers/Lists/PackedList/PackedList.H | 2 +- .../containers/Lists/PtrList/PtrList.H | 23 +++++++++--- .../containers/Lists/PtrList/PtrListI.H | 37 ++++++++++++++++--- .../Lists/UIndirectList/UIndirectList.H | 19 +++++++++- .../Lists/UIndirectList/UIndirectListI.H | 28 ++++++++++++++ src/OpenFOAM/containers/Lists/UList/UList.H | 20 ++++++---- src/OpenFOAM/containers/Lists/UList/UListI.H | 14 +++++++ .../containers/Lists/UPtrList/UPtrList.C | 2 - .../containers/Lists/UPtrList/UPtrList.H | 24 +++++++++--- .../containers/Lists/UPtrList/UPtrListI.H | 36 ++++++++++++++++-- 26 files changed, 284 insertions(+), 52 deletions(-) diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H index b802403106..42bfbacb27 100644 --- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H +++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H @@ -144,7 +144,7 @@ public: void clear(); //- Transfer the contents of the argument into this DictionaryBase - // and annull the argument. + // and annul the argument. void transfer(DictionaryBase&); // Member operators diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index a945859880..492d6a9e0f 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -287,7 +287,7 @@ public: void shrink(); //- Transfer the contents of the argument table into this table - // and annull the argument table. + // and annul the argument table. void transfer(HashTable&); //- Transfer contents to the Xfer container @@ -463,7 +463,7 @@ public: inline iterator operator++(int); }; - //- iterator set to the begining of the HashTable + //- iterator set to the beginning of the HashTable inline iterator begin(); diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H index 09edf50c46..9806a138e0 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H @@ -247,7 +247,7 @@ public: void clearStorage(); //- Transfer the contents of the argument table into this table - // and annull the argument table. + // and annul the argument table. void transfer(StaticHashTable&); //- Transfer contents to the Xfer container diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H index 20635fa53f..759d0c5dbe 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H @@ -140,7 +140,7 @@ public: void clear(); //- Transfer the contents of the argument into this List - // and annull the argument list. + // and annul the argument list. void transfer(ILList&); diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H index 0905f5543c..a5e99a63e4 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H @@ -202,7 +202,7 @@ public: void clear(); //- Transfer the contents of the argument into this List - // and annull the argument list. + // and annul the argument list. void transfer(LList&); // Member operators diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H index 333d916a65..c2e0250acd 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H @@ -156,7 +156,7 @@ public: void clear(); //- Transfer the contents of the argument into this List - // and annull the argument list. + // and annul the argument list. void transfer(LPtrList&); diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index 848b797b2e..beb3c625da 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -172,7 +172,7 @@ public: inline void clear(); //- Transfer the contents of the argument into this List - // and annull the argument list. + // and annul the argument list. inline void transfer(DLListBase&); // STL iterator diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H index b5c957a537..b2958c9e55 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H @@ -157,7 +157,7 @@ public: inline void clear(); //- Transfer the contents of the argument into this List - // and annull the argument list. + // and annul the argument list. inline void transfer(SLListBase&); // STL iterator diff --git a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H index 5afd48d0f3..1f761d9caf 100644 --- a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H +++ b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class BiIndirectList Declaration + Class BiIndirectList Declaration \*---------------------------------------------------------------------------*/ template @@ -82,11 +82,16 @@ public: // Access + //- Return the number of elements in the list inline label size() const; - inline bool empty() const; + + //- Return true if the list is empty (ie, size() is zero). + inline bool empty() const; inline const UList& posList() const; inline const UList& negList() const; + + //- Return the list addressing inline const List