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>
24 class AliMpExMapIterator;
28 class AliMpExMap : public TObject
30 friend class AliMpExMapIterator;
34 AliMpExMap(TRootIOCtor* /*ioCtor*/);
35 AliMpExMap(const AliMpExMap& rhs);
36 AliMpExMap& operator=(const AliMpExMap& rhs);
37 virtual ~AliMpExMap();
41 // conversion between String and Long_t
42 static Long_t GetIndex(const TString& s);
43 static TString GetString(Long_t index);
45 // methods from base class
46 virtual void Clear(Option_t* opt="");
47 virtual void Print(Option_t* opt="") const;
50 void Add(Int_t keyFirst, Int_t keySecond, TObject* object);
51 void Add(const TString& key, TObject* object);
52 void Add(Int_t key, TObject* object);
54 void SetSize(Int_t size);
55 void SetOwner(Bool_t owner);
58 Int_t GetSize() const;
59 Int_t GetCapacity() const;
61 TObject* GetValue(Int_t keyFirst, Int_t keySecond) const;
62 TObject* GetValue(const TString& key) const;
63 TObject* GetValue(Int_t key) const;
65 AliMpExMapIterator* CreateIterator() const;
69 static const TString& GetCharacterMap();
73 // conversion between Int_t pair key and Long_t
74 static Long_t GetIndex(Int_t first, Int_t second);
75 static Int_t GetPairFirst(Long_t index);
76 static Int_t GetPairSecond(Long_t index);
79 void AddKey(Long_t key);
80 void Copy(TObject& dest) const;
82 // static data members
83 static const Int_t fgkDefaultSize; ///< Default initial size
84 static const Bool_t fgkDefaultOwnership; ///< Default ownership
86 static const Int_t fgkSeparator1; ///< \brief the separator used for conversion
87 /// of Int_t pair to Int_t
88 static const Int_t fgkSeparator2; ///< \brief the separator used for conversion
89 /// of TString to Int_t
92 mutable TExMap fMap; //!< Transient map class
93 TObjArray fObjects; ///< Array of objects
94 TArrayL fKeys; ///< Array of keys
96 ClassDef(AliMpExMap,1) // Root persistent TExMap
99 #endif //ALI_MP_EX_MAP_H