New storage class and its iterator (Laurent)
[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 #include "AliMUON1DMapIterator.h"
19 #include "AliMpExMap.h"
20 #include "AliLog.h"
21 #include "AliMpIntPair.h"
22 #include "AliMUONObjectPair.h"
23 #include "AliMpExMap.h"
24
25 /// \class AliMUON1DMapIterator
26 /// Implementation of AliMUONVDataIterator for 1Dmaps
27 /// 
28 /// A simple implementation of VDataIterator for 1Dmaps.
29 ///
30 /// \author Laurent Aphecetche
31
32 /// \cond CLASSIMP
33 ClassImp(AliMUON1DMapIterator)
34 /// \endcond
35
36 //_____________________________________________________________________________
37 AliMUON1DMapIterator::AliMUON1DMapIterator(AliMpExMap& theMap)
38 : AliMUONVDataIterator(), 
39 fIter(theMap.GetIterator()),
40 fCurrentI(-1)
41 {
42   /// default ctor
43   Reset();
44 }
45
46 //_____________________________________________________________________________
47 AliMUON1DMapIterator::~AliMUON1DMapIterator()
48 {
49   /// dtor
50 }
51
52 //_____________________________________________________________________________
53 TObject*
54 AliMUON1DMapIterator::Next()
55 {
56   ///  
57
58   Long_t key, value;
59   Bool_t ok = fIter.Next(key,value);
60   if (!ok) return 0x0;
61   Int_t i = (Int_t)(key & 0xFFFF);
62   TObject* o = reinterpret_cast<TObject*>(value);
63   
64   return new AliMUONObjectPair(new AliMpIntPair(i,0),o,
65                                kTRUE, /* owner of intpair */
66                                kFALSE /* but not of o */);
67 }
68
69 //_____________________________________________________________________________
70 void
71 AliMUON1DMapIterator::Reset()
72 {
73   /// rewind the iterator
74   fIter.Reset();
75 }
76
77 //_____________________________________________________________________________
78 Bool_t
79 AliMUON1DMapIterator::Remove()
80 {
81   /// to be implemented if needed
82   AliInfo("Not supported yet");
83   return kFALSE;
84 }