| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2002 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 27 | //                                                                          // | 
|---|
| 28 | // MIter                                                                    // | 
|---|
| 29 | //                                                                          // | 
|---|
| 30 | // This is the original MIter, but returns a MParContainer instead of a     // | 
|---|
| 31 | // TObject.                                                                 // | 
|---|
| 32 | //                                                                          // | 
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 34 | #include "MIter.h" | 
|---|
| 35 |  | 
|---|
| 36 | ClassImp(MIter); | 
|---|
| 37 |  | 
|---|
| 38 | //______________________________________________________________________________ | 
|---|
| 39 | MIter::MIter(const MIter &iter) | 
|---|
| 40 | { | 
|---|
| 41 | // Copy a MIter. This involves allocating a new MIterator of the right | 
|---|
| 42 | // sub class and assigning it with the original. | 
|---|
| 43 |  | 
|---|
| 44 | if (iter.fIterator) { | 
|---|
| 45 | fIterator = iter.GetCollection()->MakeIterator(); | 
|---|
| 46 | fIterator->operator=(*iter.fIterator); | 
|---|
| 47 | } else | 
|---|
| 48 | fIterator = 0; | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | //______________________________________________________________________________ | 
|---|
| 52 | MIter &MIter::operator=(const MIter &rhs) | 
|---|
| 53 | { | 
|---|
| 54 | // Assigning an MIter to another. This involves allocatiing a new MIterator | 
|---|
| 55 | // of the right sub class and assigning it with the original. | 
|---|
| 56 |  | 
|---|
| 57 | if (this != &rhs) { | 
|---|
| 58 | if (rhs.fIterator) { | 
|---|
| 59 | delete fIterator; | 
|---|
| 60 | fIterator = rhs.GetCollection()->MakeIterator(); | 
|---|
| 61 | fIterator->operator=(*rhs.fIterator); | 
|---|
| 62 | } | 
|---|
| 63 | } | 
|---|
| 64 | return *this; | 
|---|
| 65 | } | 
|---|