]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpExMap.h
Format fixed in Logs lines.
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpExMap.h
CommitLineData
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 24class AliMpIntPair;
630711ed 25class AliMpExMapIterator;
5006ec94 26
2a7ea2e6 27class TString;
28
5006ec94 29class AliMpExMap : public TObject
30{
31 public:
630711ed 32
33 friend class AliMpExMapIterator;
34
5006ec94 35 AliMpExMap();
630711ed 36 AliMpExMap(TRootIOCtor* /*ioCtor*/);
f8919723 37 AliMpExMap(const AliMpExMap& rhs);
38 AliMpExMap& operator=(const AliMpExMap& rhs);
5006ec94 39 virtual ~AliMpExMap();
40
7332f213 41
5006ec94 42 // static methods
43 // conversion between varius keys and Long_t
44 //
45 static Long_t GetIndex(const AliMpIntPair& pair);
46 static Long_t GetIndex(const TString& s);
630711ed 47
5006ec94 48 static AliMpIntPair GetPair(Long_t index);
49 static TString GetString(Long_t index);
50
7332f213 51 // methods from base class
52 virtual void Clear(Option_t* opt="");
630711ed 53 virtual void Print(Option_t* opt="") const;
7332f213 54
5006ec94 55 // set methods
56 void Add(const AliMpIntPair& key, TObject* object);
57 void Add(const TString& key, TObject* object);
58 void Add(Int_t key, TObject* object);
59
60 void SetSize(Int_t size);
61 void SetOwner(Bool_t owner);
62
63 // get methods
630711ed 64 Int_t GetSize() const;
65 Int_t GetCapacity() const;
66
5006ec94 67 TObject* GetValue(const AliMpIntPair& key) const;
68 TObject* GetValue(const TString& key) const;
69 TObject* GetValue(Int_t key) const;
f8919723 70
630711ed 71 AliMpExMapIterator* CreateIterator() const;
5006ec94 72
73 private:
74 // methods
75 void FillMap();
76 void AddKey(Long_t key);
630711ed 77 void Copy(TObject& dest) const;
5006ec94 78
79 // static data members
829425a5 80 static const Int_t fgkDefaultSize; ///< Default initial size
81 static const Bool_t fgkDefaultOwnership; ///< Default ownership
5006ec94 82
829425a5 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
88 /// to integers
5006ec94 89
90 // data members
829425a5 91 mutable TExMap fMap; //!< Transient map class
92 TObjArray fObjects; ///< Array of objects
93 TArrayL fKeys; ///< Array of keys
5006ec94 94
95 ClassDef(AliMpExMap,1) // Root persistent TExMap
96};
97
98#endif //ALI_MP_EX_MAP_H
99