casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List.h
Go to the documentation of this file.
1 //# List.h: Doubly linked list classes
2 //# Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_LIST_H
29 #define CASA_LIST_H
30 
31 #ifndef AIPS_USE_DEPRECATED
32 #error "List.h is deprecated; use -DBUILD_DEPRECATED=ON to use it"
33 #endif
34 
35 //# Includes
36 #include <casacore/casa/aips.h>
37 #include <casacore/casa/Utilities/Register.h>
42 
43 namespace casacore { //#Begin casa namespace
44 
45 // The function which throws an exception for advancing the internal
46 // cursor past the end of a list
51 
52 //# Forward Declarations
53 template<class t> class ListIter;
54 template<class t> class ConstListIter;
55 template<class t> class List;
56 
57 
58 //
59 // <summary>Linked list update notice</summary>
60 // <use visibility=local>
61 //
62 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
63 // </reviewed>
64 //
65 // <synopsis>
66 // This class is the notification which is passed between <src>List<t></src>
67 // and <src>ListIter<t></src> in order to keep cursors and container in sync.
68 // This is the mechanism which allows multiple iterators to view the same
69 // list and automatically update as the list is changed. See the
70 // <linkto class=Notice:description>Notice</linkto> class for more information.
71 // </synopsis>
72 //
73 template<class t> class ListNotice : public Notice {
74 friend class ConstListIter<t>;
75 friend class ListIter<t>;
76 friend class List<t>;
77 public:
79  //
80  // This function returns the Notice "type", which is retrieved
81  // from the "type registry". The registry information is maintained
82  // automatically by the Notice constructors. A form of run
83  // time type information, this function is mostly intended for advanced
84  // users.
85  //
86  uInt type() const;
87 
88  //
89  // This operator can be used to compare two
90  // ListNotices.
91  //
92  int operator==(const Notice &op) const;
93 
94 private:
100  int off;
101  int otherOff;
102 
103  //
104  // This is used to construct a list notice. The parameters are:
105  // <ul>
106  // <li> (m) what was done to the list
107  // <li> (oc) the old current position
108  // <li> (op) the old previous position
109  // <li> (nc) the new current position
110  // <li> (np) the new previous position
111  // <li> (of) current offset;
112  // <li> (nf) other offset (only used with SWAP mod)
113  // </ul>
114  //
115  ListNotice(modification m, Link<t> *oc,Link<t> *op,Link<t> *nc,Link<t> *np, int of, int nf=0) :
116  mod(m),oprev(op),ocur(oc),nprev(np),ncur(nc), off(of), otherOff(nf) {}
117 
118  //
119  // This constructor is used to initialize a notice for a deleted
120  // "List".
121  //
123  nprev(0),ncur(0),off(0),otherOff(0) {}
124 
125 };
126 
127 //
128 // <summary>Doubly linked list</summary>
129 // <use visibility=export>
130 //
131 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
132 // </reviewed>
133 //
134 // <synopsis>
135 // This class is a container which by itself has little functionality
136 // because the iteration functionality is contained in the iterator
137 // classes, <linkto class=ListIter>ListIter</linkto> and
138 // <linkto class=ConstListIter>ConstListIterr</linkto>. These iterator
139 // classes allow traversal, insertion into list, and removal from the list.
140 //
141 // This group of classes, List and iterators, was designed to allow
142 // multiple iterators to manipulate a list at the same time. However,
143 // if only one iterator is required the <a href=#simple_example>simple
144 // example</a> below shows how a simple list can be created and used
145 // without complication. The <a href=#complete_example>more complete
146 // example</a> below demonstrates all of the functionality of the List
147 // classes.
148 // </synopsis>
149 //
150 // <anchor name=simple_example>
151 // <example>
152 // <srcblock>
153 // #include <casacore/casa/Containers/List.h>
154 // #include <casacore/casa/Containers/ListIO.h>
155 //
156 // main() {
157 // // List, conceptual
158 // // cursor = "|"
159 // ListIter<int> list(new List<int>(),True); // |
160 // list.addRight(12); // | 12
161 // list.addRight(2); // | 2 12
162 // list.addRight(89); // | 89 2 12
163 // list++; // 89 | 2 12
164 // list.addRight(10); // 89 | 10 2 12
165 // list++; // 89 10 | 2 12
166 // list.addRight(8); // 89 10 | 8 2 12
167 // list--; // 89 | 10 8 2 12
168 // list.pos(0); // | 89 10 8 2 12
169 // list.pos(5); // 89 10 8 2 12 |
170 // list.pos(4); // 89 10 8 2 | 12
171 // list.step(3); // 89 | 10 8 2 12
172 // list.step(); // 89 10 | 8 2 12
173 // list.step(-4); // 89 10 8 2 | 12
174 // list.removeRight(); // 89 10 8 2 |
175 // cout << list << endl;
176 // return 0;
177 // }
178 // </srcblock>
179 // <em>The output from this example looks like:</em>
180 // <pre>
181 // len=4 pos=4 89 10 8 2
182 // </pre>
183 // </example>
184 // </anchor>
185 //
186 template<class t> class List : public NoticeSource
187 {
188 friend class ConstListIter<t>;
189 friend class ListIter<t>;
190 public:
191  //
192  // Creates an empty list.
193  //
194  List() : head(0), tail(0), length(0){}
195  //
196  // Copy Semantics
197  // <group>
198  List(const List<t> &other);
199  List(const List<t> *other);
200  List<t> &operator=(const List<t> &other);
201  List<t> &operator=(const List<t> *other);
202  // </group>
203 
204  //*display 4
205  //
206  // Destructs the list.
207  //
208  ~List();
209 
210  //
211  // Returns the length of the list.
212  //
213  uInt len() const {return length;}
214 
215  //
216  // List version
217  //
218  enum {ListVersion = 2};
219 
220 protected:
224 
225  //
226  // Updates the extreme pointers, head or tail
227  // under the appropriate conditions
228  //
229  // <group>
230  virtual void added(Link<t> *, Link<t> *);
231  virtual void removed(Link<t> *, Link<t> *, Link<t> *);
232  // </group>
233 };
234 
235 
236 //
237 // <summary>Doubly linked constant list iterator</summary>
238 //
239 // <synopsis>
240 // The <linkto class=List>List</linkto> class above only provides for
241 // the list framework. This is one of two classes which allow list
242 // iteration, insertion, and removal. This class <em>cannot</em> be
243 // used to modify a list, but rather, it can only be used to look at
244 // or observe a list. It provides <em>no</em> functions for modifying
245 // the list.
246 //
247 // All of the operations take place to the right of a conceptual cursor.
248 // The cursor starts out before the first element of the list and can
249 // be incremented past the last element of the list. Going further than
250 // the end of the list results in an exception.
251 //
252 // <example>
253 // In this example, assume that this function is called at the
254 // end of the <a href=#simple_example>example above</a>, i.e.
255 // assume that the line before the return,
256 // <a href=#simple_example>above</a>, is uncommented.
257 //
258 // <srcblock>
259 // void iterate(ListIter<int> &list) {
260 // // List, conceptual
261 // // cursor = "|"
262 // ConstListIter<int> li = list; // 89 10 8 2 |
263 // li--; // 89 10 8 | 2
264 // cout << li.getRight() << " "; // 89 10 8 | 2
265 // li--; // 89 10 | 8 2
266 // li.pos(0); // | 89 10 8 2
267 // li.pos(3); // 89 10 8 | 2
268 // li.pos(1); // 89 | 10 8 2
269 // li.step(); // 89 10 | 8 2
270 // li.pos(0); // | 89 10 8 2
271 // li.step(-3); // 89 10 | 8 2
272 // cout << li.getRight() << endl; // 89 10 | 8 2
273 // cout << li << endl; // 89 10 | 8 2
274 // }
275 // </srcblock>
276 // The output which this function, <src>iterate()</src>, would
277 // produce would look like:
278 // <pre>
279 // 2 8
280 // len=4 pos=2 89 10 8 2
281 // </pre>
282 //
283 // As shown above:
284 // <dl>
285 // <dt> <src>pos()</src>
286 // <dd> allows for arbitrary positioning of the cursor
287 // <dt> <src>step()</src>, <src>operator++()</src>, and <src>operator--()</src>
288 // <dd> allow for relative positioning
289 // <dt> <src>getRight()</src>
290 // <dd> fetches the next element in the list.
291 // </dl>
292 // In addition:
293 // <dl>
294 // <dt> <src>atStart()</src>, <src>atEnd()</src>, and <src>pos()</src>
295 // <dd> allow querying the position of the cursor
296 // <dt> <src>len()</src>
297 // <dd> returns the number of elements in the list.
298 // </dl>
299 // </example>
300 //
301 // <note role=tip> This class uses the <linkto class=Notice>Notice
302 // classes</linkto> to implement "dynamic" cursors so that
303 // multiple cursors are updated as elements are added and
304 // removed from the list.
305 // </note>
306 //
307 template<class t> class ConstListIter : public NoticeTarget
308 {
309 public:
310 
311  //
312  // This constructor creates a "ConstListIter" which tracks the
313  // "List<t>" parameter.
314  //
315  // <group>
316  ConstListIter(const List<t> *st);
318  cur(st.head), prev(0), curPos(0),
319  container_((List<t> *) (&st))
320  {}
321  // </group>
322 
323  //
324  // This constructor creates a "ConstListIter" which tracks the
325  // same list tracked by the "ConstListIter<t>" parameter.
326  //
327  // <group>
329  NoticeTarget((NoticeTarget &)other),
330  cur(other.cur), prev(other.prev), curPos(other.curPos),
331  container_(other.container_) {}
332 
333  ConstListIter(const ConstListIter<t> *other);
334  // </group>
335 
336 
337  //
338  // This is the default constructor. It allows one
339  // to create an initially invalid empty ConstListIter. The instantiated
340  // class will accept assignment and thus become valid later.
341  //
343  container_(0) {}
344 
345  //*display 4
346  //
347  // Destructor doesn\'t do anything special because
348  // all of the "real" information is in the "List<t>".
349  //
350  ~ConstListIter();
351 
352  //*display 4
353  //
354  // This function is the hook through which iterators
355  // are notified of important changes to the underlying
356  // list. For advanced users.
357  //
358  void notify(const Notice &);
359 
360  //
361  // This functions allows one to checked if the cursor
362  // is at an extreme list position. "atStart()" checks
363  // to see if the cursor is at the beginning of the list,
364  // and "atEnd()" checks to see if the cursor is at the
365  // end of the list.
366  //
367  // <group>
368  Bool atStart() const {
370  if (prev == 0) return True;
371  else return False;}
372 
373  Bool atEnd() const {
375  if (cur == 0) return True;
376  else return False;}
377  // </group>
378 
379  //
380  // This function is used to step the cursor forward through
381  // the list.
382  //
383  // <group>
384  void operator++() {
386  if (cur) {
387  curPos++;
388  prev = cur;
389  cur = (*cur).next();
390  } else throw_list_end_error();}
391 
392  inline void operator++(int) {
394  if (cur != 0) {
395  curPos++;
396  prev = cur;
397  cur = (*cur).next();
398  } else throw_list_end_error();}
399  // </group>
400 
401  //
402  // This function allow for stepping the cursor toward the
403  // front of the list.
404  //
405  // <group>
406  void operator--() {
407  if (prev) {
408  curPos--;
409  cur = prev;
410  prev = (*prev).prev();
411  } else throw_list_start_error();}
412 
413  void operator--(int) {
414  if (prev) {
415  curPos--;
416  cur = prev;
417  prev = (*prev).prev();
418  } else throw_list_start_error();}
419  // </group>
420 
421  //
422  // "pos()" without arguments returns the current postion
423  // of the cursor.
424  // "pos()" with an unsigned integer parameter
425  // moves the cursor to an absolute position.
426  //
427  // <group>
428  virtual uInt pos(uInt);
429 
430  uInt pos() const {
432  return curPos;}
433  // </group>
434 
435  //
436  // This function returns the number of elements in the list.
437  //
438  uInt len() const {
440  return (*container_).length;}
441 
442  //
443  // "step()" with no parameters advances the cursor forward
444  // one element.
445  // "step()" with a signed integer parameter moves the cursor
446  // (forward or backward) by a relative offset indicated by the
447  // parameter.
448  //
449  // <group>
450  inline uInt step(Int offset){
451  Int toffset;
453  //# Traps a negative offset because aparently some compilers
454  //# do not handle modulo of a negative number correctly.
455  toffset = offset < 0 && -offset > Int(curPos) ? -((- curPos - offset) % ((*container_).length + 1))
456  : (curPos + offset) % ((*container_).length + 1);
457  return(pos(toffset >= 0 ? toffset : (*container_).length + toffset + 1));}
458 
459  inline uInt step() {return(step(1));}
460  // </group>
461 
462  //
463  // Returns the element to the right of the cursor.
464  //
465  const t &getRight() const {
467  if (!cur) throw_list_end_error();
468  return((*cur).val());}
469 
470  //
471  // This assignment operator substitutes the "List<t>"
472  // tracked by this iterator to the "List<t>" passed as an argument.
473  //
474  // <group>
475  virtual ConstListIter<t> &operator=(const List<t> &other);
476  virtual ConstListIter<t> &operator=(const List<t> *other);
477  // </group>
478 
479  //
480  // This assignment operator substitutes the "List<t>"
481  // tracked by this iterator to the "List<t>" tracked by the
482  // passed "ConstListIter<t>" argument.
483  //
484  // <group>
485  virtual ConstListIter<t> &operator=(const ConstListIter<t> &other);
486  virtual ConstListIter<t> &operator=(const ConstListIter<t> *other);
487  // </group>
488 
489  //
490  // This function moves the cursor to the beginning of the list.
491  //
492  void toStart() {
494  cur = (*container_).head; prev = 0; curPos = 0;}
495 
496  //
497  // This function moves the cursor to the end of the list.
498  //
499  void toEnd() {
501  prev = (*container_).tail;
502  cur = 0;
503  curPos = (*container_).length;
504  }
505 
506  //
507  // Get the container over which we are iterating, could be null...
508  //
509  const List<t> *container() const {return container_;}
510 
511  // enum outside class because of compiler errors on HPUX
512  //enum {ConstListIterVersion = 1};
513 
514 protected:
515 
520 };
521 
522 //
523 // <summary>Doubly linked non-constant list iterator</summary>
524 //
525 // The <linkto class=List>List</linkto> class above only provides for
526 // the list framework. This is one of two classes which allow list
527 // iteration, insertion, and removal. This class <em>can</em> be
528 // used to modify a list. Unlike
529 // <linkto class=ConstListIter>ConstListIter</linkto>, this class can
530 // insert and remove elements from a list as well as look at
531 // or observe a list. <linkto class=ConstListIter>ConstListIter</linkto>
532 // should be used whenever the list is not modified.
533 //
534 // All of the operations take place to the right of a conceptual cursor.
535 // The cursor starts out before the first element of the list and can
536 // be incremented past the last element of the list. Going further than
537 // the end of the list results in an exception. All additions and deletions
538 // occur to the right of this conceptual cursor. In addition, this class
539 // uses the <linkto class=Notice>Notice</linkto> class to ensure that multiple
540 // iterators which are observing the same list are updated as the list
541 // changes. This is important when multiple iterators are used.
542 //
543 // <anchor name=complete_example>
544 // <example>
545 // <srcblock>
546 // #include <casacore/casa/Containers/List.h>
547 // #include <casacore/casa/Containers/ListIO.h>
548 //
549 // main() {
550 // // The conceptual cursors are:
551 // // | for one
552 // // ^ for two
553 // // _ for three
554 // ListIter<int> one(new List<int>,True);
555 // ListIter<int> three, two = one;
556 // one.addRight(12); // |^ 12
557 // one.addRight(2); // |^ 2 12
558 // one.addRight(89); // |^ 89 2 12
559 // cout << one.getRight() << " "
560 // << two.getRight() << endl;
561 // two.addRight(21); // |^ 21 89 2 12
562 // cout << one.getRight() << " "
563 // << two.getRight() << endl;
564 // one++; two++; two++; // 21 | 89 ^ 2 12
565 // three = one; // 21 |_ 89 ^ 2 12
566 // one.removeRight(); // 21 |^_ 2 12
567 // cout << one.getRight() << " "
568 // << two.getRight() << " "
569 // << three.getRight() << endl;
570 // three.addRight(17); // 21 |^_ 17 2 12
571 //
572 // cout << one.getRight() << " "
573 // << two.getRight() << " "
574 // << three.getRight() << endl;
575 //
576 // one.toEnd(); // 21 ^_ 17 2 12 |
577 // one.addRight(18); // 21 ^_ 17 2 12 | 18
578 // two.pos(3); // 21 _ 17 2 ^ 12 | 18
579 // three--; // _ 21 17 2 ^ 12 | 18
580 // two.step(); // _ 21 17 2 12 ^| 18
581 // one.step(4); // _ 21 17 | 2 12 ^ 18
582 // cout << "one: " << one << endl;
583 // cout << "two: " << two << endl;
584 // cout << "three: " << three << endl;
585 //
586 // return 0;
587 // }
588 // </srcblock>
589 // The output from this example would look like:
590 // <pre>
591 // 89 89
592 // 21 21
593 // 2 2 2
594 // 17 2 17
595 // one: len=5 pos=2 21 17 2 12 18
596 // two: len=5 pos=4 21 17 2 12 18
597 // three: len=5 pos=0 21 17 2 12 18
598 // </pre>
599 // </example>
600 // </anchor>
601 //
602 // <note role=tip> This class uses the "Notice" classes to implement "dynamic" cursors
603 // so that multiple cursors are updated as elements are added and
604 // removed from the list.
605 // </note>
606 //
607 template<class t> class ListIter : virtual public ConstListIter<t> {
608 public:
609 
610  //
611  // This constructor allows one to construct a ListIter and
612  // attach it to the List parameter. The own flag can be
613  // set to indicate that the List should be destroyed when
614  // the ListIter is deleted.
615  //
616  ListIter(List<t> *st, Bool OWN = False) : ConstListIter<t>(st), own(OWN){}
617 
618 
619  //
620  // This constructor allows one to construct a ListIter and
621  // attach it to the List parameter.
622  //
623  ListIter(List<t> &st);
624 
625  //
626  // These constructors allow for the creation of a ListIter from
627  // another ListIter. This will attach this ListIter to the List
628  // tracked by the ListIter parameter at the time of construction.
629  //
630  // <group>
631  ListIter(const ListIter<t> &other);
632  ListIter(const ListIter<t> *other) : ConstListIter<t>(other), own(False){}
633  // </group>
634 
635  //
636  // This is the default constructor. It allows one
637  // to create an initially invalid empty ListIter. The instantiated
638  // class will accept assignment and thus become valid later.
639  //
641 
642 
643  //
644  // This function adds the element to the right of the
645  // current cursor position.
646  //
647  void addRight(t e) {
649  Link<t> *c = this->cur;
650  Link<t> *p = this->prev;
651  this->cur = newLink(e,this->prev,this->cur);
652  // Allow container to update
653  (*this->container_).added(this->prev,this->cur);
654  ListNotice<t> state(ListNotice<t>::ADD,c,p,this->cur,this->prev,
655  this->curPos);
656  (*this->container_).notify(state);
657  }
658 
659  //
660  // This function removes the element to the right of the
661  // current cursor position.
662  //
663  void removeRight();
664 
665  //
666  // This function swaps the list section after the
667  // current position of the list with the right section
668  // of the list of another iterator. This can be
669  // particularly useful for "remembering" the position
670  // of a cursor in a list.
671  //
672  virtual void swapRight(ListIter<t> &);
673 
674 
675  //
676  // Returns the element to the right of the cursor.
677  //
678  // <group>
679  t &getRight() {
681  if (!this->cur) throw_list_end_error();
682  return((*this->cur).val());}
683 
684  const t &getRight() const { return(ConstListIter<t>::getRight());}
685  // </group>
686 
687  //
688  // This function changes the List
689  // which this ListIter tracks and specifies that the List
690  // should be deleted when this iterator is deleted.
691  //
692  virtual ListIter<t> &assign(List<t> *other,Bool OWN = False);
693 
694  //
695  // This assignment operator changes the List which this
696  // iterator tracks to the List parameter.
697  //
698  // <group>
699  virtual ListIter<t> &operator=(List<t> &other);
700 
701  virtual ListIter<t> &operator=(List<t> *other);
702  // </group>
703 
704  //
705  // These assignment operators allow one to change the List
706  // to which this iterator tracks to the List currently associated
707  // with the argument ListIter.
708  //
709  // <group>
710  virtual ListIter<t> &operator=(const ListIter<t> &other);
711 
712  virtual ListIter<t> &operator=(const ListIter<t> *other);
713  // </group>
714 
715  ~ListIter();
716 
717 //# **Seems to cause an internal compiler error on Sun's
718 //# **Cfront compiler. Remove when really need or compiler
719 //# **recovers from brain damage (Thu May 4 13:08:21 EDT 1995).
720 //#
721 //# enum {ListIterVersion = 1};
722 
723 protected:
724  //
725  // Indicates if this iterator "owns" the container it observes.
726  //
728 
729  //*display 1
730  //
731  // This function creates a new link. By separating link
732  // creation out into "newLink", the "addRight(t)"
733  // functionality can be performed in the base class.
734  //
735  virtual Link<t> *newLink(t &e, Link<t> *p=0, Link<t> *n=0);
736 
737 private:
738 
739  //*display 6
740  //
741  // These functions are for internal use. They ONLY throw an exception
742  // to prevent improper initialization of a constant OrderedMapIter.
743  //
744  // <group>
749  // </group>
750 };
751 
752 // enum outside class because of compiler errors on HPUX
754 
755 } //#End casa namespace
756 #ifndef CASACORE_NO_AUTO_TEMPLATES
757 #include <casacore/casa/Containers/List.tcc>
758 #endif //# CASACORE_NO_AUTO_TEMPLATES
759 #endif
t & getRight()
Returns the element to the right of the cursor.
Definition: List.h:679
virtual ListIter< t > & assign(List< t > *other, Bool OWN=False)
This function changes the List which this ListIter tracks and specifies that the List should be delet...
int Int
Definition: aipstype.h:50
ConstListIter(const ConstListIter< t > &other)
This constructor creates a &quot;ConstListIter&quot; which tracks the same list tracked by the &quot;ConstListIter&lt;t...
Definition: List.h:328
virtual Link< t > * newLink(t &e, Link< t > *p=0, Link< t > *n=0)
Bool atStart() const
This functions allows one to checked if the cursor is at an extreme list position.
Definition: List.h:368
abstract base class for notice receptors
Definition: Notice.h:150
ListIter(List< t > *st, Bool OWN=False)
This constructor allows one to construct a ListIter and attach it to the List parameter.
Definition: List.h:616
Link< t > * cur
enum outside class because of compiler errors on HPUX enum {ConstListIterVersion = 1}; ...
Definition: List.h:516
virtual void added(Link< t > *, Link< t > *)
Updates the extreme pointers, head or tail under the appropriate conditions.
void notify(const Notice &)
Hook through which NoticeTargets are notified (by NoticeSources).
void operator--()
This function allow for stepping the cursor toward the front of the list.
Definition: List.h:406
ListNotice(modification m, Link< t > *oc, Link< t > *op, Link< t > *nc, Link< t > *np, int of, int nf=0)
This is used to construct a list notice.
Definition: List.h:115
ListNotice()
This constructor is used to initialize a notice for a deleted &quot;List&quot;.
Definition: List.h:122
Bool atEnd() const
Definition: List.h:373
List()
Creates an empty list.
Definition: List.h:194
Doubly linked constant list iterator.
Definition: List.h:54
const List< t > * container() const
Get the container over which we are iterating, could be null...
Definition: List.h:509
Link< t > * oprev
Definition: List.h:96
List< t > & operator=(const List< t > &other)
List< t > * container_
Definition: List.h:519
void throw_list_init_error()
base class for notice originators
Definition: Notice.h:99
void throw_list_swapright_same_error()
uInt len() const
Returns the length of the list.
Definition: List.h:213
Link< t > * nprev
Definition: List.h:98
Doubly linked list.
Definition: List.h:55
virtual ListIter< t > & operator=(List< t > &other)
This assignment operator changes the List which this iterator tracks to the List parameter.
Link< t > * ncur
Definition: List.h:99
void toEnd()
This function moves the cursor to the end of the list.
Definition: List.h:499
virtual void removed(Link< t > *, Link< t > *, Link< t > *)
const t & getRight() const
Definition: List.h:684
uInt step(Int offset)
&quot;step()&quot; with no parameters advances the cursor forward one element.
Definition: List.h:450
uInt pos() const
Definition: List.h:430
modification mod
Definition: List.h:95
uInt length
Definition: List.h:223
Link< t > * tail
Definition: List.h:222
Link< t > * head
Definition: List.h:221
virtual void swapRight(ListIter< t > &)
This function swaps the list section after the current position of the list with the right section of...
int operator==(const Notice &op) const
This operator can be used to compare two ListNotices.
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
Definition: Assert.h:157
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
abstract base class for notices
Definition: Notice.h:62
~List()
display 4
Bool isValid() const
Returns a boolean value telling whether this NoticeTarget is still &quot;valid&quot;.
Definition: Notice.h:159
Linked list update notice.
Definition: List.h:73
ConstListIter()
This is the default constructor.
Definition: List.h:342
const Bool False
Definition: aipstype.h:44
void removeRight()
This function removes the element to the right of the current cursor position.
ConstListIter(const List< t > &st)
Definition: List.h:317
void addRight(t e)
This function adds the element to the right of the current cursor position.
Definition: List.h:647
void operator++()
This function is used to step the cursor forward through the list.
Definition: List.h:384
ListIter(const ListIter< t > *other)
Definition: List.h:632
uInt len() const
This function returns the number of elements in the list.
Definition: List.h:438
void operator++(int)
Definition: List.h:392
Link< t > * ocur
Definition: List.h:97
virtual ConstListIter< t > & operator=(const List< t > &other)
This assignment operator substitutes the &quot;List&lt;t&gt;&quot; tracked by this iterator to the &quot;List&lt;t&gt;&quot; passed a...
const Double e
e and functions thereof:
void throw_list_end_error()
The function which throws an exception for advancing the internal cursor past the end of a list...
Doubly linked non-constant list iterator The List class above only provides for the list framework...
Definition: List.h:53
const Double c
Fundamental physical constants (SI units):
uInt type() const
This function returns the Notice &quot;type&quot;, which is retrieved from the &quot;type registry&quot;.
const t & getRight() const
Returns the element to the right of the cursor.
Definition: List.h:465
Bool own
Indicates if this iterator &quot;owns&quot; the container it observes.
Definition: List.h:727
Link< t > * prev
Definition: List.h:517
Link< NoticeTarget * > *& head()
Definition: Notice.h:114
void toStart()
This function moves the cursor to the beginning of the list.
Definition: List.h:492
void operator--(int)
Definition: List.h:413
const Bool True
Definition: aipstype.h:43
unsigned int uInt
Definition: aipstype.h:51
void throw_list_start_error()
ListIter()
This is the default constructor.
Definition: List.h:640
Invalide iteration error class.
Definition: IterError.h:71