--- /dev/null
+/**************************************************************************
+* 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$
+
+#include "AliMUON1DMap.h"
+
+#include "AliLog.h"
+#include "AliMpExMap.h"
+#include "AliMUON1DMapIterator.h"
+
+///
+/// \class AliMUON1DMap
+/// This class is simply a wrapper to an AliMpExMap, offering in addition a
+/// control over the replacement policy when you add
+/// something to it.
+///
+/// \author Laurent Aphecetche
+
+/// \cond CLASSIMP
+ClassImp(AliMUON1DMap)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUON1DMap::AliMUON1DMap(Int_t theSize)
+: AliMUONV1DStore(),
+ fMap(new AliMpExMap(true))
+{
+/// Default ctor
+
+ if ( theSize )
+ {
+ fMap->SetSize(theSize);
+ }
+ fMap->SetOwner(kTRUE);
+}
+
+//_____________________________________________________________________________
+AliMUON1DMap::AliMUON1DMap(const AliMUON1DMap& other)
+: AliMUONV1DStore(),
+ fMap(0x0)
+{
+/// Copy constructor
+
+ other.CopyTo(*this);
+}
+
+//_____________________________________________________________________________
+AliMUON1DMap&
+AliMUON1DMap::operator=(const AliMUON1DMap& other)
+{
+/// Assignment operator
+
+ other.CopyTo(*this);
+ return *this;
+}
+
+//_____________________________________________________________________________
+AliMUON1DMap::~AliMUON1DMap()
+{
+/// dtor, we're the owner of our internal map.
+
+ delete fMap;
+}
+
+//_____________________________________________________________________________
+void
+AliMUON1DMap::CopyTo(AliMUON1DMap& dest) const
+{
+/// Make a deep copy
+
+ delete dest.fMap;
+ dest.fMap = fMap;
+}
+
+//_____________________________________________________________________________
+TObject*
+AliMUON1DMap::Get(Int_t i) const
+{
+/// Get the object located at index i, if it exists, and if i is correct.
+
+ return fMap->GetValue(i);
+}
+
+//_____________________________________________________________________________
+AliMUONVDataIterator*
+AliMUON1DMap::Iterator() const
+{
+ // Create and return an iterator on this map
+ // Returned iterator must be deleted by user.
+ if ( fMap )
+ {
+ return new AliMUON1DMapIterator(*fMap);
+ }
+ return 0x0;
+}
+
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON1DMap::Set(Int_t i, TObject* object, Bool_t replace)
+{
+/// Set the object located at i
+/// If replace=kFALSE and there's already an object at location i,
+/// this method fails and returns kFALSE, otherwise it returns kTRUE
+
+ TObject* o = Get(i);
+ if ( o && !replace )
+ {
+ AliError(Form("Object %p is already there for i=%d",o,i));
+ return kFALSE;
+ }
+ if ( replace )
+ {
+ delete o;
+ }
+ fMap->Add(i,object);
+ return kTRUE;
+}
+
+
+
--- /dev/null
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup base
+/// \class AliMUON1DMap
+/// \brief Implementation of AliMUONV1DStore
+///
+// Author Laurent Aphecetche
+
+#ifndef ALIMUON1DMAP_H
+#define ALIMUON1DMAP_H
+
+#ifndef ALIMUONV1DSTORE_H
+# include "AliMUONV1DStore.h"
+#endif
+
+class AliMpExMap;
+
+class AliMUON1DMap : public AliMUONV1DStore
+{
+public:
+ AliMUON1DMap(Int_t theSize=0);
+ AliMUON1DMap(const AliMUON1DMap& other);
+ AliMUON1DMap& operator=(const AliMUON1DMap& other);
+
+ virtual ~AliMUON1DMap();
+
+ /// Return the object stored at i.
+ virtual TObject* Get(Int_t i) const;
+
+ virtual AliMUONVDataIterator* Iterator() const;
+
+ /** Set the object stored at i.
+ if replace=false and there's already an object there, returns kFALSE
+ */
+ virtual Bool_t Set(Int_t i, TObject* object, Bool_t replace);
+
+ /// Whether or not this container is the owner of its contents.
+ virtual Bool_t IsOwner() const { return kTRUE; }
+
+private:
+ void CopyTo(AliMUON1DMap& to) const;
+
+private:
+
+ AliMpExMap* fMap; ///< Internal array (map)
+
+ ClassDef(AliMUON1DMap,1) // Implementation of AliMUONV1DStore
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+* 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$
+
+#include "AliMUON1DMapIterator.h"
+#include "AliMpExMap.h"
+#include "AliLog.h"
+#include "AliMpIntPair.h"
+#include "AliMUONObjectPair.h"
+#include "AliMpExMap.h"
+
+/// \class AliMUON1DMapIterator
+/// Implementation of AliMUONVDataIterator for 1Dmaps
+///
+/// A simple implementation of VDataIterator for 1Dmaps.
+///
+/// \author Laurent Aphecetche
+
+/// \cond CLASSIMP
+ClassImp(AliMUON1DMapIterator)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUON1DMapIterator::AliMUON1DMapIterator(AliMpExMap& theMap)
+: AliMUONVDataIterator(),
+fIter(theMap.GetIterator()),
+fCurrentI(-1)
+{
+ /// default ctor
+ Reset();
+}
+
+//_____________________________________________________________________________
+AliMUON1DMapIterator::~AliMUON1DMapIterator()
+{
+ /// dtor
+}
+
+//_____________________________________________________________________________
+TObject*
+AliMUON1DMapIterator::Next()
+{
+ ///
+
+ Long_t key, value;
+ Bool_t ok = fIter.Next(key,value);
+ if (!ok) return 0x0;
+ Int_t i = (Int_t)(key & 0xFFFF);
+ TObject* o = reinterpret_cast<TObject*>(value);
+
+ return new AliMUONObjectPair(new AliMpIntPair(i,0),o,
+ kTRUE, /* owner of intpair */
+ kFALSE /* but not of o */);
+}
+
+//_____________________________________________________________________________
+void
+AliMUON1DMapIterator::Reset()
+{
+ /// rewind the iterator
+ fIter.Reset();
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON1DMapIterator::Remove()
+{
+ /// to be implemented if needed
+ AliInfo("Not supported yet");
+ return kFALSE;
+}
--- /dev/null
+#ifndef ALIMUON1DMAPITERATOR_H
+#define ALIMUON1DMAPITERATOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup base
+/// \class AliMUON1DMapIterator
+/// \brief Implementation of AliMUONVDataIterator for 1D maps
+///
+// Author Laurent Aphecetche
+
+#ifndef ROOT_TObject
+# include "TObject.h"
+#endif
+#ifndef ROOT_TExMap
+# include "TExMap.h"
+#endif
+#ifndef ALIMUONVDATAITERATOR_H
+# include "AliMUONVDataIterator.h"
+#endif
+
+class AliMpExMap;
+
+//_____________________________________________________________________________
+class AliMUON1DMapIterator : public AliMUONVDataIterator
+{
+public:
+ AliMUON1DMapIterator(AliMpExMap& theMap);
+
+ virtual ~AliMUON1DMapIterator();
+
+ /** The object returned by this iterator is an AliMUONObjectPair(TObject* key,TObject* value)
+ where key is an AliMpIntPair (i,0), and value is
+ an AliMUONVCalibParam.
+ The returned object must be deleted by the user.
+ */
+ virtual TObject* Next();
+
+ virtual void Reset();
+
+ virtual Bool_t Remove();
+
+private:
+ /// copy ctor will not implemented
+ AliMUON1DMapIterator(const AliMUON1DMapIterator&);
+ /// assignement operator will not implemented
+ AliMUON1DMapIterator& operator=(const AliMUON1DMapIterator&);
+
+private:
+ TExMapIter fIter; //!< iterator
+ Int_t fCurrentI; //!< current index in direction i
+
+ ClassDef(AliMUON1DMapIterator,0) // VDataIterator for 1D maps
+};
+
+
+#endif
#pragma link C++ class AliMUON2DMap+;
#pragma link C++ class AliMUON2DMapIterator+;
#pragma link C++ class AliMUON1DArray+;
+#pragma link C++ class AliMUON1DMap+;
+#pragma link C++ class AliMUON1DMapIterator+;
#pragma link C++ class AliMUONVCalibParam+;
#pragma link C++ class AliMUONCalibParam1I+;
#pragma link C++ class AliMUONCalibParam2F+;
AliMUON2DMap.cxx \
AliMUON2DMapIterator.cxx \
AliMUON1DArray.cxx \
+ AliMUON1DMap.cxx \
+ AliMUON1DMapIterator.cxx \
AliMUONVCalibParam.cxx \
AliMUONCalibParam1I.cxx \
AliMUONCalibParam2F.cxx \
AliMUON2DStoreValidator.cxx \
AliMUONCheckItem.cxx \
AliMUONCheckItemIterator.cxx
-
+
HDRS:= $(SRCS:.cxx=.h)
DHDR:= MUONbaseLinkDef.h