]>
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 | ||
5006ec94 | 24 | class AliMpIntPair; |
25 | ||
2a7ea2e6 | 26 | class TString; |
27 | ||
5006ec94 | 28 | class AliMpExMap : public TObject |
29 | { | |
30 | public: | |
5006ec94 | 31 | AliMpExMap(); |
f8919723 | 32 | AliMpExMap(Bool_t standardConstructor); |
33 | AliMpExMap(const AliMpExMap& rhs); | |
34 | AliMpExMap& operator=(const AliMpExMap& rhs); | |
5006ec94 | 35 | virtual ~AliMpExMap(); |
36 | ||
7332f213 | 37 | |
5006ec94 | 38 | // static methods |
39 | // conversion between varius keys and Long_t | |
40 | // | |
41 | static Long_t GetIndex(const AliMpIntPair& pair); | |
42 | static Long_t GetIndex(const TString& s); | |
43 | static AliMpIntPair GetPair(Long_t index); | |
44 | static TString GetString(Long_t index); | |
45 | ||
7332f213 | 46 | // methods from base class |
47 | virtual void Clear(Option_t* opt=""); | |
48 | ||
5006ec94 | 49 | // set methods |
50 | void Add(const AliMpIntPair& key, TObject* object); | |
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 | |
58 | Int_t GetSize() const; | |
59 | TExMapIter GetIterator() const; | |
6b431a48 | 60 | TObject* GetObject(Int_t index) const; |
4c7ce41d | 61 | TObject* GetObjectFast(Int_t index) const; |
5006ec94 | 62 | |
63 | TObject* GetValue(const AliMpIntPair& key) const; | |
64 | TObject* GetValue(const TString& key) const; | |
65 | TObject* GetValue(Int_t key) const; | |
f8919723 | 66 | |
67 | void Copy(TObject& dest) const; | |
5006ec94 | 68 | |
69 | private: | |
70 | // methods | |
71 | void FillMap(); | |
72 | void AddKey(Long_t key); | |
73 | ||
74 | // static data members | |
829425a5 | 75 | static const Int_t fgkDefaultSize; ///< Default initial size |
76 | static const Bool_t fgkDefaultOwnership; ///< Default ownership | |
5006ec94 | 77 | |
829425a5 | 78 | static const Int_t fgkSeparator1; ///< \brief the separator used for conversion |
79 | /// of AliMpIntPair to Int_t | |
80 | static const Int_t fgkSeparator2; ///< \brief the separator used for conversion | |
81 | /// of TString to Int_t | |
82 | static const TString fgkCharacterMap; ///< \brief the string mapping characters | |
83 | /// to integers | |
5006ec94 | 84 | |
85 | // data members | |
829425a5 | 86 | mutable TExMap fMap; //!< Transient map class |
87 | TObjArray fObjects; ///< Array of objects | |
88 | TArrayL fKeys; ///< Array of keys | |
5006ec94 | 89 | |
90 | ClassDef(AliMpExMap,1) // Root persistent TExMap | |
91 | }; | |
92 | ||
93 | #endif //ALI_MP_EX_MAP_H | |
94 |