|
|
|
ILList.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 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 Foam::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 friend functions and operators 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&); 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 //- Copy constructor with additional argument for clone 00098 template<class CloneArg> 00099 ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg) 00100 #ifdef __INTEL_COMPILER 00101 : 00102 UILList<LListBase, T>() 00103 { 00104 for 00105 ( 00106 typename UILList<LListBase, T>::const_iterator iter = 00107 lst.begin(); 00108 iter != lst.end(); 00109 ++iter 00110 ) 00111 { 00112 append(iter().clone(cloneArg).ptr()); 00113 } 00114 } 00115 #else 00116 ; 00117 #endif 00118 00119 //- Construct from Istream using given Istream constructor class 00120 template<class INew> 00121 ILList(Istream&, const INew&); 00122 00123 00124 // Destructor 00125 00126 ~ILList(); 00127 00128 00129 // Member Functions 00130 00131 // Edit 00132 00133 //- Remove the head element specified from the list and delete it 00134 bool eraseHead(); 00135 00136 //- Remove the specified element from the list and delete it 00137 bool erase(T* p); 00138 00139 //- Clear the contents of the list 00140 void clear(); 00141 00142 //- Transfer the contents of the argument into this List 00143 // and annull the argument list. 00144 void transfer(ILList<LListBase, T>&); 00145 00146 00147 // Member operators 00148 00149 void operator=(const ILList<LListBase, T>&); 00150 00151 00152 // Istream operator 00153 00154 //- Read List from Istream, discarding contents of existing List. 00155 friend Istream& operator>> <LListBase, T> 00156 ( 00157 Istream&, 00158 ILList<LListBase, T>& 00159 ); 00160 }; 00161 00162 00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00164 00165 } // End namespace Foam 00166 00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00168 00169 #ifdef NoRepository 00170 # include "ILList.C" 00171 #endif 00172 00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00174 00175 #endif 00176 00177 // ************************************************************************* // |