1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
5 // $MpId: AliMpExMap.h,v 1.4 2006/05/24 13:58:07 ivana Exp $
9 /// \brief Helper class making Root persistent TExMap
11 /// The objects and keys from TExMap are store in additional
12 /// arrays which are Root persistent.
14 /// \author Ivana Hrivnacova; IPN Orsay
16 #ifndef ALI_MP_EX_MAP_H
17 #define ALI_MP_EX_MAP_H
20 #include <TObjArray.h>
25 class AliMpExMapIterator;
29 class AliMpExMap : public TObject
33 friend class AliMpExMapIterator;
36 AliMpExMap(TRootIOCtor* /*ioCtor*/);
37 AliMpExMap(const AliMpExMap& rhs);
38 AliMpExMap& operator=(const AliMpExMap& rhs);
39 virtual ~AliMpExMap();
43 // conversion between varius keys and Long_t
45 static Long_t GetIndex(const AliMpIntPair& pair);
46 static Long_t GetIndex(const TString& s);
48 static AliMpIntPair GetPair(Long_t index);
49 static TString GetString(Long_t index);
51 // methods from base class
52 virtual void Clear(Option_t* opt="");
53 virtual void Print(Option_t* opt="") const;
56 void Add(const AliMpIntPair& key, TObject* object);
57 void Add(const TString& key, TObject* object);
58 void Add(Int_t key, TObject* object);
60 void SetSize(Int_t size);
61 void SetOwner(Bool_t owner);
64 Int_t GetSize() const;
65 Int_t GetCapacity() const;
67 TObject* GetValue(const AliMpIntPair& key) const;
68 TObject* GetValue(const TString& key) const;
69 TObject* GetValue(Int_t key) const;
71 AliMpExMapIterator* CreateIterator() const;
76 void AddKey(Long_t key);
77 void Copy(TObject& dest) const;
79 // static data members
80 static const Int_t fgkDefaultSize; ///< Default initial size
81 static const Bool_t fgkDefaultOwnership; ///< Default ownership
83 static const Int_t fgkSeparator1; ///< \brief the separator used for conversion
84 /// of AliMpIntPair to Int_t
85 static const Int_t fgkSeparator2; ///< \brief the separator used for conversion
86 /// of TString to Int_t
87 static const TString fgkCharacterMap; ///< \brief the string mapping characters
91 mutable TExMap fMap; //!< Transient map class
92 TObjArray fObjects; ///< Array of objects
93 TArrayL fKeys; ///< Array of keys
95 ClassDef(AliMpExMap,1) // Root persistent TExMap
98 #endif //ALI_MP_EX_MAP_H