]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUON1DMapIterator.cxx
Load pythia libraries.
[u/mrichter/AliRoot.git] / MUON / AliMUON1DMapIterator.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15
16 // $Id$
17
18 //-----------------------------------------------------------------------------
19 /// \class AliMUON1DMapIterator
20 /// Implementation of TIterator for 1Dmaps
21 /// 
22 /// A simple implementation of iterator for 1Dmaps.
23 ///
24 /// \author Laurent Aphecetche
25 //-----------------------------------------------------------------------------
26
27 #include "AliMUON1DMapIterator.h"
28 #include "AliMpExMap.h"
29
30 /// \cond CLASSIMP
31 ClassImp(AliMUON1DMapIterator)
32 /// \endcond
33
34 //_____________________________________________________________________________
35 AliMUON1DMapIterator::AliMUON1DMapIterator(const AliMpExMap& theMap)
36 : TIterator(), 
37   fkMap(&theMap),
38   fCurrentI(-1)
39 {
40   /// default ctor
41 }
42
43 //_____________________________________________________________________________
44 AliMUON1DMapIterator::AliMUON1DMapIterator(const AliMUON1DMapIterator& rhs)
45 : TIterator(rhs),
46   fkMap(rhs.fkMap),
47   fCurrentI(rhs.fCurrentI)        
48 {
49     /// copy ctor
50 }
51
52 //_____________________________________________________________________________
53 AliMUON1DMapIterator& 
54 AliMUON1DMapIterator::operator=(const AliMUON1DMapIterator& rhs)
55 {
56   /// assignment operator
57   if ( this != &rhs )
58   {
59     fkMap = rhs.fkMap;
60     fCurrentI = rhs.fCurrentI;
61   }
62   return *this;
63 }
64
65 //_____________________________________________________________________________
66 TIterator& 
67 AliMUON1DMapIterator::operator=(const TIterator& rhs)
68 {
69   /// overriden operator= (imposed by Root definition of TIterator::operator= ?)
70   
71   if ( this != &rhs && rhs.IsA() == AliMUON1DMapIterator::Class() )
72   {
73     const AliMUON1DMapIterator& rhs1 = static_cast<const AliMUON1DMapIterator&>(rhs);
74     fkMap = rhs1.fkMap;
75     fCurrentI = rhs1.fCurrentI;
76   }
77   return *this;
78 }
79
80
81 //_____________________________________________________________________________
82 AliMUON1DMapIterator::~AliMUON1DMapIterator()
83 {
84   /// dtor
85 }
86
87 //_____________________________________________________________________________
88 TObject*
89 AliMUON1DMapIterator::Next()
90 {
91   /// Return next object in iteration
92   return (++fCurrentI < fkMap->GetSize()) ? fkMap->GetObjectFast(fCurrentI) : 0x0;
93 }
94
95 //_____________________________________________________________________________
96 void
97 AliMUON1DMapIterator::Reset()
98 {
99   /// rewind the iterator
100   fCurrentI = -1;
101 }