![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 ILList 00027 00028 Description 00029 Template class for intrusive linked lists. 00030 00031 SourceFiles 00032 ILList.C 00033 ILListIO.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef ILList_H 00038 #define ILList_H 00039 00040 #include "UILList.H" 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 class Istream; 00048 class Ostream; 00049 00050 // * * * * * * Forward declaration of template friend fuctions * * * * * * * // 00051 00052 template<class LListBase, class T> class ILList; 00053 00054 template<class LListBase, class T> Istream& operator>> 00055 ( 00056 Istream&, 00057 ILList<LListBase, T>& 00058 ); 00059 00060 00061 /*---------------------------------------------------------------------------*\ 00062 Class ILList Declaration 00063 \*---------------------------------------------------------------------------*/ 00064 00065 template<class LListBase, class T> 00066 class ILList 00067 : 00068 public UILList<LListBase, T> 00069 { 00070 // Private member functions 00071 00072 //- Read from Istream using given Istream constructor class 00073 template<class INew> 00074 void read(Istream&, const INew& inewt); 00075 00076 00077 public: 00078 00079 // Constructors 00080 00081 //- Null construct 00082 ILList() 00083 {} 00084 00085 //- Construct given initial T 00086 ILList(T* a) 00087 : 00088 UILList<LListBase, T>(a) 00089 {} 00090 00091 //- Construct from Istream 00092 ILList(Istream&); 00093 00094 //- Construct as copy 00095 ILList(const ILList<LListBase, T>&); 00096 00097 //- Construct from Istream using given Istream constructor class 00098 template<class INew> 00099 ILList(Istream&, const INew& inewt); 00100 00101 00102 // Destructor 00103 00104 ~ILList(); 00105 00106 00107 // Member Functions 00108 00109 // Edit 00110 00111 //- Remove the head element specified from the list and delete it 00112 bool eraseHead(); 00113 00114 //- Remove the specified element from the list and delete it 00115 bool erase(T* p); 00116 00117 //- Clear the contents of the list 00118 void clear(); 00119 00120 00121 // Member operators 00122 00123 void operator=(const ILList<LListBase, T>&); 00124 00125 00126 // Istream operator 00127 00128 //- Read List from Istream, discarding contents of existing List. 00129 friend Istream& operator>> <LListBase, T> 00130 ( 00131 Istream&, 00132 ILList<LListBase, T>& 00133 ); 00134 }; 00135 00136 00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00138 00139 } // End namespace Foam 00140 00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00142 00143 #ifdef NoRepository 00144 # include "ILList.C" 00145 #endif 00146 00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00148 00149 #endif 00150 00151 // ************************************************************************* //