]>
Commit | Line | Data |
---|---|---|
5006ec94 | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
4 | // $Id$ | |
13985652 | 5 | // $MpId: AliMpExMap.h,v 1.4 2006/05/24 13:58:07 ivana Exp $ |
5006ec94 | 6 | |
46df088d | 7 | /// \ingroup core |
5006ec94 | 8 | /// \class AliMpExMap |
9 | /// \brief Helper class making Root persistent TExMap | |
10 | /// | |
11 | /// The objects and keys from TExMap are store in additional | |
12 | /// arrays which are Root persistent. | |
13 | /// | |
13985652 | 14 | /// \author Ivana Hrivnacova; IPN Orsay |
5006ec94 | 15 | |
16 | #ifndef ALI_MP_EX_MAP_H | |
17 | #define ALI_MP_EX_MAP_H | |
18 | ||
19 | #include <TObject.h> | |
20 | #include <TObjArray.h> | |
21 | #include <TArrayL.h> | |
22 | #include <TExMap.h> | |
23 | ||
630711ed | 24 | class AliMpExMapIterator; |
5006ec94 | 25 | |
2a7ea2e6 | 26 | class TString; |
27 | ||
5006ec94 | 28 | class AliMpExMap : public TObject |
29 | { | |
b89ac3d6 | 30 | friend class AliMpExMapIterator; |
630711ed | 31 | |
b89ac3d6 | 32 | public: |
5006ec94 | 33 | AliMpExMap(); |
630711ed | 34 | AliMpExMap(TRootIOCtor* /*ioCtor*/); |
f8919723 | 35 | AliMpExMap(const AliMpExMap& rhs); |
36 | AliMpExMap& operator=(const AliMpExMap& rhs); | |
5006ec94 | 37 | virtual ~AliMpExMap(); |
38 | ||
7332f213 | 39 | |
5006ec94 | 40 | // static methods |
168e9c4d | 41 | // conversion between String and Long_t |
5006ec94 | 42 | static Long_t GetIndex(const TString& s); |
168e9c4d | 43 | static TString GetString(Long_t index); |
5006ec94 | 44 | |
7332f213 | 45 | // methods from base class |
46 | virtual void Clear(Option_t* opt=""); | |
630711ed | 47 | virtual void Print(Option_t* opt="") const; |
7332f213 | 48 | |
5006ec94 | 49 | // set methods |
168e9c4d | 50 | void Add(Int_t keyFirst, Int_t keySecond, TObject* object); |
5006ec94 | 51 | void Add(const TString& key, TObject* object); |
52 | void Add(Int_t key, TObject* object); | |
53 | ||
54 | void SetSize(Int_t size); | |
55 | void SetOwner(Bool_t owner); | |
56 | ||
57 | // get methods | |
630711ed | 58 | Int_t GetSize() const; |
59 | Int_t GetCapacity() const; | |
60 | ||
168e9c4d | 61 | TObject* GetValue(Int_t keyFirst, Int_t keySecond) const; |
5006ec94 | 62 | TObject* GetValue(const TString& key) const; |
63 | TObject* GetValue(Int_t key) const; | |
f8919723 | 64 | |
630711ed | 65 | AliMpExMapIterator* CreateIterator() const; |
5006ec94 | 66 | |
67 | private: | |
31edb2d7 | 68 | // static methods |
69 | static const TString& GetCharacterMap(); | |
70 | ||
5006ec94 | 71 | // methods |
168e9c4d | 72 | |
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); | |
77 | ||
5006ec94 | 78 | void FillMap(); |
79 | void AddKey(Long_t key); | |
630711ed | 80 | void Copy(TObject& dest) const; |
5006ec94 | 81 | |
82 | // static data members | |
829425a5 | 83 | static const Int_t fgkDefaultSize; ///< Default initial size |
84 | static const Bool_t fgkDefaultOwnership; ///< Default ownership | |
5006ec94 | 85 | |
829425a5 | 86 | static const Int_t fgkSeparator1; ///< \brief the separator used for conversion |
168e9c4d | 87 | /// of Int_t pair to Int_t |
829425a5 | 88 | static const Int_t fgkSeparator2; ///< \brief the separator used for conversion |
89 | /// of TString to Int_t | |
5006ec94 | 90 | |
91 | // data members | |
829425a5 | 92 | mutable TExMap fMap; //!< Transient map class |
93 | TObjArray fObjects; ///< Array of objects | |
94 | TArrayL fKeys; ///< Array of keys | |
5006ec94 | 95 | |
96 | ClassDef(AliMpExMap,1) // Root persistent TExMap | |
97 | }; | |
98 | ||
99 | #endif //ALI_MP_EX_MAP_H | |
100 |