ROOT logo
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  *
**************************************************************************/

// $Id$

//-----------------------------------------------------------------------------
/// \class AliMUONClusterStoreV2Iterator
///
/// Implementation of TIterator for AliMUONClusterStoreV2
///
/// \author Philippe Pillot, Subatech
///
//-----------------------------------------------------------------------------

#include "AliMUONClusterStoreV2Iterator.h"
#include "AliMUONClusterStoreV2.h"

#include "AliMpExMapIterator.h"
#include "AliMpExMap.h"

#include "AliLog.h"

/// \cond CLASSIMP
ClassImp(AliMUONClusterStoreV2Iterator)
/// \endcond

//_____________________________________________________________________________
AliMUONClusterStoreV2Iterator::AliMUONClusterStoreV2Iterator(const AliMUONClusterStoreV2* store,
                                                             Int_t firstChamberId, Int_t lastChamberId)
: TIterator(),
  fkStore(store),
  fFirstChamberId(firstChamberId),
  fLastChamberId(lastChamberId),
  fCurrentChamberId(-1),
  fChamberIterator(0x0)
{
  /// Constructor for partial iteration
  if (fFirstChamberId > fLastChamberId) {
    fLastChamberId = fFirstChamberId;
    fFirstChamberId = lastChamberId;
  }
  Reset();
}

//_____________________________________________________________________________
AliMUONClusterStoreV2Iterator& 
AliMUONClusterStoreV2Iterator::operator=(const TIterator& /*iter*/)
{
  // Overriden operator= (imposed by Root's definition of TIterator::operator= ?)

  AliFatalGeneral("AliMUONClusterStoreV2Iterator::operator=","reimplement me");
  return *this;
}

//_____________________________________________________________________________
AliMUONClusterStoreV2Iterator::~AliMUONClusterStoreV2Iterator()
{
  /// Destructor
  delete fChamberIterator;
}

//_____________________________________________________________________________
TObject* AliMUONClusterStoreV2Iterator::NextInCurrentChamber() const
{
  /// Return the value corresponding to theKey in iterator iter
  
  return fChamberIterator->Next();
}

//_____________________________________________________________________________
TObject* AliMUONClusterStoreV2Iterator::Next()
{
  /// Return next cluster in store
  TObject* o = NextInCurrentChamber();
  
  while (!o) {
    // fChamberIterator exhausted, try to get the next ones
    if (fCurrentChamberId == fLastChamberId) return 0x0; // we reached the end
    
    fCurrentChamberId++;
    delete fChamberIterator;
    fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
    
    o = NextInCurrentChamber();
  }
  
  return o;
}

//_____________________________________________________________________________
void AliMUONClusterStoreV2Iterator::Reset()
{
  /// Reset the iterator
  fCurrentChamberId = fFirstChamberId;
  delete fChamberIterator;
  fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
}
 AliMUONClusterStoreV2Iterator.cxx:1
 AliMUONClusterStoreV2Iterator.cxx:2
 AliMUONClusterStoreV2Iterator.cxx:3
 AliMUONClusterStoreV2Iterator.cxx:4
 AliMUONClusterStoreV2Iterator.cxx:5
 AliMUONClusterStoreV2Iterator.cxx:6
 AliMUONClusterStoreV2Iterator.cxx:7
 AliMUONClusterStoreV2Iterator.cxx:8
 AliMUONClusterStoreV2Iterator.cxx:9
 AliMUONClusterStoreV2Iterator.cxx:10
 AliMUONClusterStoreV2Iterator.cxx:11
 AliMUONClusterStoreV2Iterator.cxx:12
 AliMUONClusterStoreV2Iterator.cxx:13
 AliMUONClusterStoreV2Iterator.cxx:14
 AliMUONClusterStoreV2Iterator.cxx:15
 AliMUONClusterStoreV2Iterator.cxx:16
 AliMUONClusterStoreV2Iterator.cxx:17
 AliMUONClusterStoreV2Iterator.cxx:18
 AliMUONClusterStoreV2Iterator.cxx:19
 AliMUONClusterStoreV2Iterator.cxx:20
 AliMUONClusterStoreV2Iterator.cxx:21
 AliMUONClusterStoreV2Iterator.cxx:22
 AliMUONClusterStoreV2Iterator.cxx:23
 AliMUONClusterStoreV2Iterator.cxx:24
 AliMUONClusterStoreV2Iterator.cxx:25
 AliMUONClusterStoreV2Iterator.cxx:26
 AliMUONClusterStoreV2Iterator.cxx:27
 AliMUONClusterStoreV2Iterator.cxx:28
 AliMUONClusterStoreV2Iterator.cxx:29
 AliMUONClusterStoreV2Iterator.cxx:30
 AliMUONClusterStoreV2Iterator.cxx:31
 AliMUONClusterStoreV2Iterator.cxx:32
 AliMUONClusterStoreV2Iterator.cxx:33
 AliMUONClusterStoreV2Iterator.cxx:34
 AliMUONClusterStoreV2Iterator.cxx:35
 AliMUONClusterStoreV2Iterator.cxx:36
 AliMUONClusterStoreV2Iterator.cxx:37
 AliMUONClusterStoreV2Iterator.cxx:38
 AliMUONClusterStoreV2Iterator.cxx:39
 AliMUONClusterStoreV2Iterator.cxx:40
 AliMUONClusterStoreV2Iterator.cxx:41
 AliMUONClusterStoreV2Iterator.cxx:42
 AliMUONClusterStoreV2Iterator.cxx:43
 AliMUONClusterStoreV2Iterator.cxx:44
 AliMUONClusterStoreV2Iterator.cxx:45
 AliMUONClusterStoreV2Iterator.cxx:46
 AliMUONClusterStoreV2Iterator.cxx:47
 AliMUONClusterStoreV2Iterator.cxx:48
 AliMUONClusterStoreV2Iterator.cxx:49
 AliMUONClusterStoreV2Iterator.cxx:50
 AliMUONClusterStoreV2Iterator.cxx:51
 AliMUONClusterStoreV2Iterator.cxx:52
 AliMUONClusterStoreV2Iterator.cxx:53
 AliMUONClusterStoreV2Iterator.cxx:54
 AliMUONClusterStoreV2Iterator.cxx:55
 AliMUONClusterStoreV2Iterator.cxx:56
 AliMUONClusterStoreV2Iterator.cxx:57
 AliMUONClusterStoreV2Iterator.cxx:58
 AliMUONClusterStoreV2Iterator.cxx:59
 AliMUONClusterStoreV2Iterator.cxx:60
 AliMUONClusterStoreV2Iterator.cxx:61
 AliMUONClusterStoreV2Iterator.cxx:62
 AliMUONClusterStoreV2Iterator.cxx:63
 AliMUONClusterStoreV2Iterator.cxx:64
 AliMUONClusterStoreV2Iterator.cxx:65
 AliMUONClusterStoreV2Iterator.cxx:66
 AliMUONClusterStoreV2Iterator.cxx:67
 AliMUONClusterStoreV2Iterator.cxx:68
 AliMUONClusterStoreV2Iterator.cxx:69
 AliMUONClusterStoreV2Iterator.cxx:70
 AliMUONClusterStoreV2Iterator.cxx:71
 AliMUONClusterStoreV2Iterator.cxx:72
 AliMUONClusterStoreV2Iterator.cxx:73
 AliMUONClusterStoreV2Iterator.cxx:74
 AliMUONClusterStoreV2Iterator.cxx:75
 AliMUONClusterStoreV2Iterator.cxx:76
 AliMUONClusterStoreV2Iterator.cxx:77
 AliMUONClusterStoreV2Iterator.cxx:78
 AliMUONClusterStoreV2Iterator.cxx:79
 AliMUONClusterStoreV2Iterator.cxx:80
 AliMUONClusterStoreV2Iterator.cxx:81
 AliMUONClusterStoreV2Iterator.cxx:82
 AliMUONClusterStoreV2Iterator.cxx:83
 AliMUONClusterStoreV2Iterator.cxx:84
 AliMUONClusterStoreV2Iterator.cxx:85
 AliMUONClusterStoreV2Iterator.cxx:86
 AliMUONClusterStoreV2Iterator.cxx:87
 AliMUONClusterStoreV2Iterator.cxx:88
 AliMUONClusterStoreV2Iterator.cxx:89
 AliMUONClusterStoreV2Iterator.cxx:90
 AliMUONClusterStoreV2Iterator.cxx:91
 AliMUONClusterStoreV2Iterator.cxx:92
 AliMUONClusterStoreV2Iterator.cxx:93
 AliMUONClusterStoreV2Iterator.cxx:94
 AliMUONClusterStoreV2Iterator.cxx:95
 AliMUONClusterStoreV2Iterator.cxx:96
 AliMUONClusterStoreV2Iterator.cxx:97
 AliMUONClusterStoreV2Iterator.cxx:98
 AliMUONClusterStoreV2Iterator.cxx:99
 AliMUONClusterStoreV2Iterator.cxx:100
 AliMUONClusterStoreV2Iterator.cxx:101
 AliMUONClusterStoreV2Iterator.cxx:102
 AliMUONClusterStoreV2Iterator.cxx:103
 AliMUONClusterStoreV2Iterator.cxx:104
 AliMUONClusterStoreV2Iterator.cxx:105
 AliMUONClusterStoreV2Iterator.cxx:106
 AliMUONClusterStoreV2Iterator.cxx:107
 AliMUONClusterStoreV2Iterator.cxx:108
 AliMUONClusterStoreV2Iterator.cxx:109