00001 //# List.h: Doubly linked list classes 00002 //# Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef CASA_LIST_H 00029 #define CASA_LIST_H 00030 00031 00032 //# Includes 00033 #include <casacore/casa/aips.h> 00034 #include <casacore/casa/Utilities/Register.h> 00035 #include <casacore/casa/Utilities/Notice.h> 00036 #include <casacore/casa/Containers/Link.h> 00037 #include <casacore/casa/Utilities/Assert.h> 00038 #include <casacore/casa/Containers/IterError.h> 00039 00040 namespace casacore { //#Begin casa namespace 00041 00042 // The function which throws an exception for advancing the internal 00043 // cursor past the end of a list 00044 void throw_list_end_error(); 00045 void throw_list_init_error(); 00046 void throw_list_start_error(); 00047 void throw_list_swapright_same_error(); 00048 00049 //# Forward Declarations 00050 template<class t> class ListIter; 00051 template<class t> class ConstListIter; 00052 template<class t> class List; 00053 00054 00055 // 00056 // <summary>Linked list update notice</summary> 00057 // <use visibility=local> 00058 // 00059 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos=""> 00060 // </reviewed> 00061 // 00062 // <synopsis> 00063 // This class is the notification which is passed between <src>List<t></src> 00064 // and <src>ListIter<t></src> in order to keep cursors and container in sync. 00065 // This is the mechanism which allows multiple iterators to view the same 00066 // list and automatically update as the list is changed. See the 00067 // <linkto class=Notice:description>Notice</linkto> class for more information. 00068 // </synopsis> 00069 // 00070 template<class t> class ListNotice : public Notice { 00071 friend class ConstListIter<t>; 00072 friend class ListIter<t>; 00073 friend class List<t>; 00074 public: 00075 enum modification { DELETE, ADD, REMOVE, SWAP }; 00076 // 00077 // This function returns the Notice "type", which is retrieved 00078 // from the "type registry". The registry information is maintained 00079 // automatically by the Notice constructors. A form of run 00080 // time type information, this function is mostly intended for advanced 00081 // users. 00082 // 00083 uInt type() const; 00084 00085 // 00086 // This operator can be used to compare two 00087 // ListNotices. 00088 // 00089 int operator==(const Notice &op) const; 00090 00091 private: 00092 modification mod; 00093 Link<t> *oprev; 00094 Link<t> *ocur; 00095 Link<t> *nprev; 00096 Link<t> *ncur; 00097 int off; 00098 int otherOff; 00099 00100 // 00101 // This is used to construct a list notice. The parameters are: 00102 // <ul> 00103 // <li> (m) what was done to the list 00104 // <li> (oc) the old current position 00105 // <li> (op) the old previous position 00106 // <li> (nc) the new current position 00107 // <li> (np) the new previous position 00108 // <li> (of) current offset; 00109 // <li> (nf) other offset (only used with SWAP mod) 00110 // </ul> 00111 // 00112 ListNotice(modification m, Link<t> *oc,Link<t> *op,Link<t> *nc,Link<t> *np, int of, int nf=0) : 00113 mod(m),oprev(op),ocur(oc),nprev(np),ncur(nc), off(of), otherOff(nf) {} 00114 00115 // 00116 // This constructor is used to initialize a notice for a deleted 00117 // "List". 00118 // 00119 ListNotice() : mod(DELETE), oprev(0),ocur(0), 00120 nprev(0),ncur(0),off(0),otherOff(0) {} 00121 00122 }; 00123 00124 // 00125 // <summary>Doubly linked list</summary> 00126 // <use visibility=export> 00127 // 00128 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos=""> 00129 // </reviewed> 00130 // 00131 // <synopsis> 00132 // This class is a container which by itself has little functionality 00133 // because the iteration functionality is contained in the iterator 00134 // classes, <linkto class=ListIter>ListIter</linkto> and 00135 // <linkto class=ConstListIter>ConstListIterr</linkto>. These iterator 00136 // classes allow traversal, insertion into list, and removal from the list. 00137 // 00138 // This group of classes, List and iterators, was designed to allow 00139 // multiple iterators to manipulate a list at the same time. However, 00140 // if only one iterator is required the <a href=#simple_example>simple 00141 // example</a> below shows how a simple list can be created and used 00142 // without complication. The <a href=#complete_example>more complete 00143 // example</a> below demonstrates all of the functionality of the List 00144 // classes. 00145 // </synopsis> 00146 // 00147 // <anchor name=simple_example> 00148 // <example> 00149 // <srcblock> 00150 // #include <casacore/casa/Containers/List.h> 00151 // #include <casacore/casa/Containers/ListIO.h> 00152 // 00153 // main() { 00154 // // List, conceptual 00155 // // cursor = "|" 00156 // ListIter<int> list(new List<int>(),True); // | 00157 // list.addRight(12); // | 12 00158 // list.addRight(2); // | 2 12 00159 // list.addRight(89); // | 89 2 12 00160 // list++; // 89 | 2 12 00161 // list.addRight(10); // 89 | 10 2 12 00162 // list++; // 89 10 | 2 12 00163 // list.addRight(8); // 89 10 | 8 2 12 00164 // list--; // 89 | 10 8 2 12 00165 // list.pos(0); // | 89 10 8 2 12 00166 // list.pos(5); // 89 10 8 2 12 | 00167 // list.pos(4); // 89 10 8 2 | 12 00168 // list.step(3); // 89 | 10 8 2 12 00169 // list.step(); // 89 10 | 8 2 12 00170 // list.step(-4); // 89 10 8 2 | 12 00171 // list.removeRight(); // 89 10 8 2 | 00172 // cout << list << endl; 00173 // return 0; 00174 // } 00175 // </srcblock> 00176 // <em>The output from this example looks like:</em> 00177 // <pre> 00178 // len=4 pos=4 89 10 8 2 00179 // </pre> 00180 // </example> 00181 // </anchor> 00182 // 00183 template<class t> class List : public NoticeSource 00184 { 00185 friend class ConstListIter<t>; 00186 friend class ListIter<t>; 00187 public: 00188 // 00189 // Creates an empty list. 00190 // 00191 List() : head(0), tail(0), length(0){} 00192 // 00193 // Copy Semantics 00194 // <group> 00195 List(const List<t> &other); 00196 List(const List<t> *other); 00197 List<t> &operator=(const List<t> &other); 00198 List<t> &operator=(const List<t> *other); 00199 // </group> 00200 00201 //*display 4 00202 // 00203 // Destructs the list. 00204 // 00205 ~List(); 00206 00207 // 00208 // Returns the length of the list. 00209 // 00210 uInt len() const {return length;} 00211 00212 // 00213 // List version 00214 // 00215 enum {ListVersion = 2}; 00216 00217 protected: 00218 Link<t> *head; 00219 Link<t> *tail; 00220 uInt length; 00221 00222 // 00223 // Updates the extreme pointers, head or tail 00224 // under the appropriate conditions 00225 // 00226 // <group> 00227 virtual void added(Link<t> *, Link<t> *); 00228 virtual void removed(Link<t> *, Link<t> *, Link<t> *); 00229 // </group> 00230 }; 00231 00232 00233 // 00234 // <summary>Doubly linked constant list iterator</summary> 00235 // 00236 // <synopsis> 00237 // The <linkto class=List>List</linkto> class above only provides for 00238 // the list framework. This is one of two classes which allow list 00239 // iteration, insertion, and removal. This class <em>cannot</em> be 00240 // used to modify a list, but rather, it can only be used to look at 00241 // or observe a list. It provides <em>no</em> functions for modifying 00242 // the list. 00243 // 00244 // All of the operations take place to the right of a conceptual cursor. 00245 // The cursor starts out before the first element of the list and can 00246 // be incremented past the last element of the list. Going further than 00247 // the end of the list results in an exception. 00248 // 00249 // <example> 00250 // In this example, assume that this function is called at the 00251 // end of the <a href=#simple_example>example above</a>, i.e. 00252 // assume that the line before the return, 00253 // <a href=#simple_example>above</a>, is uncommented. 00254 // 00255 // <srcblock> 00256 // void iterate(ListIter<int> &list) { 00257 // // List, conceptual 00258 // // cursor = "|" 00259 // ConstListIter<int> li = list; // 89 10 8 2 | 00260 // li--; // 89 10 8 | 2 00261 // cout << li.getRight() << " "; // 89 10 8 | 2 00262 // li--; // 89 10 | 8 2 00263 // li.pos(0); // | 89 10 8 2 00264 // li.pos(3); // 89 10 8 | 2 00265 // li.pos(1); // 89 | 10 8 2 00266 // li.step(); // 89 10 | 8 2 00267 // li.pos(0); // | 89 10 8 2 00268 // li.step(-3); // 89 10 | 8 2 00269 // cout << li.getRight() << endl; // 89 10 | 8 2 00270 // cout << li << endl; // 89 10 | 8 2 00271 // } 00272 // </srcblock> 00273 // The output which this function, <src>iterate()</src>, would 00274 // produce would look like: 00275 // <pre> 00276 // 2 8 00277 // len=4 pos=2 89 10 8 2 00278 // </pre> 00279 // 00280 // As shown above: 00281 // <dl> 00282 // <dt> <src>pos()</src> 00283 // <dd> allows for arbitrary positioning of the cursor 00284 // <dt> <src>step()</src>, <src>operator++()</src>, and <src>operator--()</src> 00285 // <dd> allow for relative positioning 00286 // <dt> <src>getRight()</src> 00287 // <dd> fetches the next element in the list. 00288 // </dl> 00289 // In addition: 00290 // <dl> 00291 // <dt> <src>atStart()</src>, <src>atEnd()</src>, and <src>pos()</src> 00292 // <dd> allow querying the position of the cursor 00293 // <dt> <src>len()</src> 00294 // <dd> returns the number of elements in the list. 00295 // </dl> 00296 // </example> 00297 // 00298 // <note role=tip> This class uses the <linkto class=Notice>Notice 00299 // classes</linkto> to implement "dynamic" cursors so that 00300 // multiple cursors are updated as elements are added and 00301 // removed from the list. 00302 // </note> 00303 // 00304 template<class t> class ConstListIter : public NoticeTarget 00305 { 00306 public: 00307 00308 // 00309 // This constructor creates a "ConstListIter" which tracks the 00310 // "List<t>" parameter. 00311 // 00312 // <group> 00313 ConstListIter(const List<t> *st); 00314 ConstListIter(const List<t> &st) : NoticeTarget((NoticeSource &)st), 00315 cur(st.head), prev(0), curPos(0), 00316 container_((List<t> *) (&st)) 00317 {} 00318 // </group> 00319 00320 // 00321 // This constructor creates a "ConstListIter" which tracks the 00322 // same list tracked by the "ConstListIter<t>" parameter. 00323 // 00324 // <group> 00325 ConstListIter(const ConstListIter<t> &other) : 00326 NoticeTarget((NoticeTarget &)other), 00327 cur(other.cur), prev(other.prev), curPos(other.curPos), 00328 container_(other.container_) {} 00329 00330 ConstListIter(const ConstListIter<t> *other); 00331 // </group> 00332 00333 00334 // 00335 // This is the default constructor. It allows one 00336 // to create an initially invalid empty ConstListIter. The instantiated 00337 // class will accept assignment and thus become valid later. 00338 // 00339 ConstListIter() : NoticeTarget(),cur(0), prev(0), curPos(0), 00340 container_(0) {} 00341 00342 //*display 4 00343 // 00344 // Destructor doesn\'t do anything special because 00345 // all of the "real" information is in the "List<t>". 00346 // 00347 ~ConstListIter(); 00348 00349 //*display 4 00350 // 00351 // This function is the hook through which iterators 00352 // are notified of important changes to the underlying 00353 // list. For advanced users. 00354 // 00355 void notify(const Notice &); 00356 00357 // 00358 // This functions allows one to checked if the cursor 00359 // is at an extreme list position. "atStart()" checks 00360 // to see if the cursor is at the beginning of the list, 00361 // and "atEnd()" checks to see if the cursor is at the 00362 // end of the list. 00363 // 00364 // <group> 00365 Bool atStart() const { 00366 AlwaysAssert(isValid(),InvalidIterError); 00367 if (prev == 0) return True; 00368 else return False;} 00369 00370 Bool atEnd() const { 00371 AlwaysAssert(isValid(),InvalidIterError); 00372 if (cur == 0) return True; 00373 else return False;} 00374 // </group> 00375 00376 // 00377 // This function is used to step the cursor forward through 00378 // the list. 00379 // 00380 // <group> 00381 void operator++() { 00382 AlwaysAssert(isValid(),InvalidIterError); 00383 if (cur) { 00384 curPos++; 00385 prev = cur; 00386 cur = (*cur).next(); 00387 } else throw_list_end_error();} 00388 00389 inline void operator++(int) { 00390 AlwaysAssert(isValid(),InvalidIterError); 00391 if (cur != 0) { 00392 curPos++; 00393 prev = cur; 00394 cur = (*cur).next(); 00395 } else throw_list_end_error();} 00396 // </group> 00397 00398 // 00399 // This function allow for stepping the cursor toward the 00400 // front of the list. 00401 // 00402 // <group> 00403 void operator--() { 00404 if (prev) { 00405 curPos--; 00406 cur = prev; 00407 prev = (*prev).prev(); 00408 } else throw_list_start_error();} 00409 00410 void operator--(int) { 00411 if (prev) { 00412 curPos--; 00413 cur = prev; 00414 prev = (*prev).prev(); 00415 } else throw_list_start_error();} 00416 // </group> 00417 00418 // 00419 // "pos()" without arguments returns the current postion 00420 // of the cursor. 00421 // "pos()" with an unsigned integer parameter 00422 // moves the cursor to an absolute position. 00423 // 00424 // <group> 00425 virtual uInt pos(uInt); 00426 00427 uInt pos() const { 00428 AlwaysAssert(isValid(),InvalidIterError); 00429 return curPos;} 00430 // </group> 00431 00432 // 00433 // This function returns the number of elements in the list. 00434 // 00435 uInt len() const { 00436 AlwaysAssert(isValid(),InvalidIterError); 00437 return (*container_).length;} 00438 00439 // 00440 // "step()" with no parameters advances the cursor forward 00441 // one element. 00442 // "step()" with a signed integer parameter moves the cursor 00443 // (forward or backward) by a relative offset indicated by the 00444 // parameter. 00445 // 00446 // <group> 00447 inline uInt step(Int offset){ 00448 Int toffset; 00449 AlwaysAssert(isValid(),InvalidIterError); 00450 //# Traps a negative offset because aparently some compilers 00451 //# do not handle modulo of a negative number correctly. 00452 toffset = offset < 0 && -offset > Int(curPos) ? -((- curPos - offset) % ((*container_).length + 1)) 00453 : (curPos + offset) % ((*container_).length + 1); 00454 return(pos(toffset >= 0 ? toffset : (*container_).length + toffset + 1));} 00455 00456 inline uInt step() {return(step(1));} 00457 // </group> 00458 00459 // 00460 // Returns the element to the right of the cursor. 00461 // 00462 const t &getRight() const { 00463 AlwaysAssert(isValid(),InvalidIterError); 00464 if (!cur) throw_list_end_error(); 00465 return((*cur).val());} 00466 00467 // 00468 // This assignment operator substitutes the "List<t>" 00469 // tracked by this iterator to the "List<t>" passed as an argument. 00470 // 00471 // <group> 00472 virtual ConstListIter<t> &operator=(const List<t> &other); 00473 virtual ConstListIter<t> &operator=(const List<t> *other); 00474 // </group> 00475 00476 // 00477 // This assignment operator substitutes the "List<t>" 00478 // tracked by this iterator to the "List<t>" tracked by the 00479 // passed "ConstListIter<t>" argument. 00480 // 00481 // <group> 00482 virtual ConstListIter<t> &operator=(const ConstListIter<t> &other); 00483 virtual ConstListIter<t> &operator=(const ConstListIter<t> *other); 00484 // </group> 00485 00486 // 00487 // This function moves the cursor to the beginning of the list. 00488 // 00489 void toStart() { 00490 AlwaysAssert(isValid(),InvalidIterError); 00491 cur = (*container_).head; prev = 0; curPos = 0;} 00492 00493 // 00494 // This function moves the cursor to the end of the list. 00495 // 00496 void toEnd() { 00497 AlwaysAssert(isValid(),InvalidIterError); 00498 prev = (*container_).tail; 00499 cur = 0; 00500 curPos = (*container_).length; 00501 } 00502 00503 // 00504 // Get the container over which we are iterating, could be null... 00505 // 00506 const List<t> *container() const {return container_;} 00507 00508 // enum outside class because of compiler errors on HPUX 00509 //enum {ConstListIterVersion = 1}; 00510 00511 protected: 00512 00513 Link<t> *cur; 00514 Link<t> *prev; 00515 uInt curPos; 00516 List<t> *container_; 00517 }; 00518 00519 // 00520 // <summary>Doubly linked non-constant list iterator</summary> 00521 // 00522 // The <linkto class=List>List</linkto> class above only provides for 00523 // the list framework. This is one of two classes which allow list 00524 // iteration, insertion, and removal. This class <em>can</em> be 00525 // used to modify a list. Unlike 00526 // <linkto class=ConstListIter>ConstListIter</linkto>, this class can 00527 // insert and remove elements from a list as well as look at 00528 // or observe a list. <linkto class=ConstListIter>ConstListIter</linkto> 00529 // should be used whenever the list is not modified. 00530 // 00531 // All of the operations take place to the right of a conceptual cursor. 00532 // The cursor starts out before the first element of the list and can 00533 // be incremented past the last element of the list. Going further than 00534 // the end of the list results in an exception. All additions and deletions 00535 // occur to the right of this conceptual cursor. In addition, this class 00536 // uses the <linkto class=Notice>Notice</linkto> class to ensure that multiple 00537 // iterators which are observing the same list are updated as the list 00538 // changes. This is important when multiple iterators are used. 00539 // 00540 // <anchor name=complete_example> 00541 // <example> 00542 // <srcblock> 00543 // #include <casacore/casa/Containers/List.h> 00544 // #include <casacore/casa/Containers/ListIO.h> 00545 // 00546 // main() { 00547 // // The conceptual cursors are: 00548 // // | for one 00549 // // ^ for two 00550 // // _ for three 00551 // ListIter<int> one(new List<int>,True); 00552 // ListIter<int> three, two = one; 00553 // one.addRight(12); // |^ 12 00554 // one.addRight(2); // |^ 2 12 00555 // one.addRight(89); // |^ 89 2 12 00556 // cout << one.getRight() << " " 00557 // << two.getRight() << endl; 00558 // two.addRight(21); // |^ 21 89 2 12 00559 // cout << one.getRight() << " " 00560 // << two.getRight() << endl; 00561 // one++; two++; two++; // 21 | 89 ^ 2 12 00562 // three = one; // 21 |_ 89 ^ 2 12 00563 // one.removeRight(); // 21 |^_ 2 12 00564 // cout << one.getRight() << " " 00565 // << two.getRight() << " " 00566 // << three.getRight() << endl; 00567 // three.addRight(17); // 21 |^_ 17 2 12 00568 // 00569 // cout << one.getRight() << " " 00570 // << two.getRight() << " " 00571 // << three.getRight() << endl; 00572 // 00573 // one.toEnd(); // 21 ^_ 17 2 12 | 00574 // one.addRight(18); // 21 ^_ 17 2 12 | 18 00575 // two.pos(3); // 21 _ 17 2 ^ 12 | 18 00576 // three--; // _ 21 17 2 ^ 12 | 18 00577 // two.step(); // _ 21 17 2 12 ^| 18 00578 // one.step(4); // _ 21 17 | 2 12 ^ 18 00579 // cout << "one: " << one << endl; 00580 // cout << "two: " << two << endl; 00581 // cout << "three: " << three << endl; 00582 // 00583 // return 0; 00584 // } 00585 // </srcblock> 00586 // The output from this example would look like: 00587 // <pre> 00588 // 89 89 00589 // 21 21 00590 // 2 2 2 00591 // 17 2 17 00592 // one: len=5 pos=2 21 17 2 12 18 00593 // two: len=5 pos=4 21 17 2 12 18 00594 // three: len=5 pos=0 21 17 2 12 18 00595 // </pre> 00596 // </example> 00597 // </anchor> 00598 // 00599 // <note role=tip> This class uses the "Notice" classes to implement "dynamic" cursors 00600 // so that multiple cursors are updated as elements are added and 00601 // removed from the list. 00602 // </note> 00603 // 00604 template<class t> class ListIter : virtual public ConstListIter<t> { 00605 public: 00606 00607 // 00608 // This constructor allows one to construct a ListIter and 00609 // attach it to the List parameter. The own flag can be 00610 // set to indicate that the List should be destroyed when 00611 // the ListIter is deleted. 00612 // 00613 ListIter(List<t> *st, Bool OWN = False) : ConstListIter<t>(st), own(OWN){} 00614 00615 00616 // 00617 // This constructor allows one to construct a ListIter and 00618 // attach it to the List parameter. 00619 // 00620 ListIter(List<t> &st); 00621 00622 // 00623 // These constructors allow for the creation of a ListIter from 00624 // another ListIter. This will attach this ListIter to the List 00625 // tracked by the ListIter parameter at the time of construction. 00626 // 00627 // <group> 00628 ListIter(const ListIter<t> &other); 00629 ListIter(const ListIter<t> *other) : ConstListIter<t>(other), own(False){} 00630 // </group> 00631 00632 // 00633 // This is the default constructor. It allows one 00634 // to create an initially invalid empty ListIter. The instantiated 00635 // class will accept assignment and thus become valid later. 00636 // 00637 ListIter() : ConstListIter<t>(), own(False){} 00638 00639 00640 // 00641 // This function adds the element to the right of the 00642 // current cursor position. 00643 // 00644 void addRight(t e) { 00645 AlwaysAssert(this->isValid(),InvalidIterError); 00646 Link<t> *c = this->cur; 00647 Link<t> *p = this->prev; 00648 this->cur = newLink(e,this->prev,this->cur); 00649 // Allow container to update 00650 (*this->container_).added(this->prev,this->cur); 00651 ListNotice<t> state(ListNotice<t>::ADD,c,p,this->cur,this->prev, 00652 this->curPos); 00653 (*this->container_).notify(state); 00654 } 00655 00656 // 00657 // This function removes the element to the right of the 00658 // current cursor position. 00659 // 00660 void removeRight(); 00661 00662 // 00663 // This function swaps the list section after the 00664 // current position of the list with the right section 00665 // of the list of another iterator. This can be 00666 // particularly useful for "remembering" the position 00667 // of a cursor in a list. 00668 // 00669 virtual void swapRight(ListIter<t> &); 00670 00671 00672 // 00673 // Returns the element to the right of the cursor. 00674 // 00675 // <group> 00676 t &getRight() { 00677 AlwaysAssert(this->isValid(),InvalidIterError); 00678 if (!this->cur) throw_list_end_error(); 00679 return((*this->cur).val());} 00680 00681 const t &getRight() const { return(ConstListIter<t>::getRight());} 00682 // </group> 00683 00684 // 00685 // This function changes the List 00686 // which this ListIter tracks and specifies that the List 00687 // should be deleted when this iterator is deleted. 00688 // 00689 virtual ListIter<t> &assign(List<t> *other,Bool OWN = False); 00690 00691 // 00692 // This assignment operator changes the List which this 00693 // iterator tracks to the List parameter. 00694 // 00695 // <group> 00696 virtual ListIter<t> &operator=(List<t> &other); 00697 00698 virtual ListIter<t> &operator=(List<t> *other); 00699 // </group> 00700 00701 // 00702 // These assignment operators allow one to change the List 00703 // to which this iterator tracks to the List currently associated 00704 // with the argument ListIter. 00705 // 00706 // <group> 00707 virtual ListIter<t> &operator=(const ListIter<t> &other); 00708 00709 virtual ListIter<t> &operator=(const ListIter<t> *other); 00710 // </group> 00711 00712 ~ListIter(); 00713 00714 //# **Seems to cause an internal compiler error on Sun's 00715 //# **Cfront compiler. Remove when really need or compiler 00716 //# **recovers from brain damage (Thu May 4 13:08:21 EDT 1995). 00717 //# 00718 //# enum {ListIterVersion = 1}; 00719 00720 protected: 00721 // 00722 // Indicates if this iterator "owns" the container it observes. 00723 // 00724 Bool own; 00725 00726 //*display 1 00727 // 00728 // This function creates a new link. By separating link 00729 // creation out into "newLink", the "addRight(t)" 00730 // functionality can be performed in the base class. 00731 // 00732 virtual Link<t> *newLink(t &e, Link<t> *p=0, Link<t> *n=0); 00733 00734 private: 00735 00736 //*display 6 00737 // 00738 // These functions are for internal use. They ONLY throw an exception 00739 // to prevent improper initialization of a constant OrderedMapIter. 00740 // 00741 // <group> 00742 ConstListIter<t> &operator=(const List<t> &); 00743 ConstListIter<t> &operator=(const List<t> *); 00744 ConstListIter<t> &operator=(const ConstListIter<t> &); 00745 ConstListIter<t> &operator=(const ConstListIter<t> *); 00746 // </group> 00747 }; 00748 00749 // enum outside class because of compiler errors on HPUX 00750 enum {ConstListIterVersion = 1}; 00751 00752 } //#End casa namespace 00753 #ifndef CASACORE_NO_AUTO_TEMPLATES 00754 #include <casacore/casa/Containers/List.tcc> 00755 #endif //# CASACORE_NO_AUTO_TEMPLATES 00756 #endif