]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpExMap.h
0395a54e14ce30a31ec085ff9c3be7a91b125730
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpExMap.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // $MpId: AliMpExMap.h,v 1.1 2005/09/26 16:16:16 ivana Exp $
6
7 /// \ingroup basic
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 ///
14 /// Author: Ivana Hrivnacova; IPN Orsay
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
24 class TString;
25
26 class AliMpIntPair;
27
28 class AliMpExMap : public TObject
29 {
30   public:
31     AliMpExMap(Bool_t standardConstructor);
32     AliMpExMap();
33     virtual ~AliMpExMap();
34     
35     // static methods
36     // conversion between varius keys and Long_t
37     //
38     static Long_t  GetIndex(const AliMpIntPair& pair);
39     static Long_t  GetIndex(const TString& s);
40     static AliMpIntPair  GetPair(Long_t index);
41     static TString       GetString(Long_t index);
42
43     // set methods
44     void Add(const AliMpIntPair& key, TObject* object);
45     void Add(const TString& key, TObject* object);
46     void Add(Int_t key, TObject* object);
47
48     void SetSize(Int_t size);
49     void SetOwner(Bool_t owner);
50     
51     // get methods
52     Int_t       GetSize() const;
53     TExMapIter  GetIterator() const;
54
55     TObject*    GetValue(const AliMpIntPair& key) const;
56     TObject*    GetValue(const TString& key) const;
57     TObject*    GetValue(Int_t key) const;
58     
59   private:  
60     // methods
61     void FillMap();
62     void AddKey(Long_t key);
63     
64     // static data members
65     static const Int_t    fgkDefaultSize;      // Default initial size
66     static const Bool_t   fgkDefaultOwnership; // Default ownership
67
68     static const Int_t    fgkSeparator1; // the separator used for conversion
69                                          // of AliMpIntPair to Int_t
70     static const Int_t    fgkSeparator2; // the separator used for conversion
71                                          // of TString to Int_t
72     static const TString  fgkCharacterMap; // the string mapping characters 
73                                            // to integers 
74     
75     // data members
76     mutable TExMap  fMap;     //! Transient map class
77     TObjArray       fObjects; // Array of objects 
78     TArrayL         fKeys;    // Array of keys 
79
80   ClassDef(AliMpExMap,1)  // Root persistent TExMap
81 };
82
83 #endif //ALI_MP_EX_MAP_H
84