New macro to keep track of timing performances of the segmentation methods (Laurent)
[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{
b89ac3d6 31 friend class AliMpExMapIterator;
630711ed 32
b89ac3d6 33 public:
5006ec94 34 AliMpExMap();
630711ed 35 AliMpExMap(TRootIOCtor* /*ioCtor*/);
f8919723 36 AliMpExMap(const AliMpExMap& rhs);
37 AliMpExMap& operator=(const AliMpExMap& rhs);
5006ec94 38 virtual ~AliMpExMap();
39
7332f213 40
5006ec94 41 // static methods
42 // conversion between varius keys and Long_t
43 //
44 static Long_t GetIndex(const AliMpIntPair& pair);
45 static Long_t GetIndex(const TString& s);
630711ed 46
5006ec94 47 static AliMpIntPair GetPair(Long_t index);
48 static TString GetString(Long_t index);
49
7332f213 50 // methods from base class
51 virtual void Clear(Option_t* opt="");
630711ed 52 virtual void Print(Option_t* opt="") const;
7332f213 53
5006ec94 54 // set methods
55 void Add(const AliMpIntPair& key, TObject* object);
56 void Add(const TString& key, TObject* object);
57 void Add(Int_t key, TObject* object);
58
59 void SetSize(Int_t size);
60 void SetOwner(Bool_t owner);
61
62 // get methods
630711ed 63 Int_t GetSize() const;
64 Int_t GetCapacity() const;
65
5006ec94 66 TObject* GetValue(const AliMpIntPair& key) const;
67 TObject* GetValue(const TString& key) const;
68 TObject* GetValue(Int_t key) const;
f8919723 69
630711ed 70 AliMpExMapIterator* CreateIterator() const;
5006ec94 71
72 private:
73 // methods
74 void FillMap();
75 void AddKey(Long_t key);
630711ed 76 void Copy(TObject& dest) const;
5006ec94 77
78 // static data members
829425a5 79 static const Int_t fgkDefaultSize; ///< Default initial size
80 static const Bool_t fgkDefaultOwnership; ///< Default ownership
5006ec94 81
829425a5 82 static const Int_t fgkSeparator1; ///< \brief the separator used for conversion
83 /// of AliMpIntPair to Int_t
84 static const Int_t fgkSeparator2; ///< \brief the separator used for conversion
85 /// of TString to Int_t
86 static const TString fgkCharacterMap; ///< \brief the string mapping characters
87 /// to integers
5006ec94 88
89 // data members
829425a5 90 mutable TExMap fMap; //!< Transient map class
91 TObjArray fObjects; ///< Array of objects
92 TArrayL fKeys; ///< Array of keys
5006ec94 93
94 ClassDef(AliMpExMap,1) // Root persistent TExMap
95};
96
97#endif //ALI_MP_EX_MAP_H
98