AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpExMap.h
Go to the documentation of this file.
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.4 2006/05/24 13:58:07 ivana Exp $
6 
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 AliMpExMapIterator;
25 
26 class TString;
27 
28 class AliMpExMap : public TObject
29 {
30  friend class AliMpExMapIterator;
31 
32  public:
33  AliMpExMap();
34  AliMpExMap(TRootIOCtor* /*ioCtor*/);
35  AliMpExMap(const AliMpExMap& rhs);
36  AliMpExMap& operator=(const AliMpExMap& rhs);
37  virtual ~AliMpExMap();
38 
39 
40  // static methods
41  // conversion between String and Long_t
42  static Long_t GetIndex(const TString& s);
43  static TString GetString(Long_t index);
44 
45  // methods from base class
46  virtual void Clear(Option_t* opt="");
47  virtual void Print(Option_t* opt="") const;
48 
49  // set methods
50  void Add(Int_t keyFirst, Int_t keySecond, 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  Int_t GetCapacity() const;
60 
61  TObject* GetValue(Int_t keyFirst, Int_t keySecond) const;
62  TObject* GetValue(const TString& key) const;
63  TObject* GetValue(Int_t key) const;
64 
66 
67  private:
68  // static methods
69  static const TString& GetCharacterMap();
70 
71  // methods
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 
78  void FillMap();
79  void AddKey(Long_t key);
80  void Copy(TObject& dest) const;
81 
82  // static data members
83  static const Int_t fgkDefaultSize;
84  static const Bool_t fgkDefaultOwnership;
85 
86  static const Int_t fgkSeparator1;
87  static const Int_t fgkSeparator2;
89 
91  // data members
92  mutable TExMap fMap;
94  TArrayL fKeys;
95 
96  ClassDef(AliMpExMap,1) // Root persistent TExMap
97 };
98 
99 #endif //ALI_MP_EX_MAP_H
100 
virtual void Print(Option_t *opt="") const
Definition: AliMpExMap.cxx:268
#define TObjArray
void SetSize(Int_t size)
Definition: AliMpExMap.cxx:321
static const TString & GetCharacterMap()
Definition: AliMpExMap.cxx:59
void AddKey(Long_t key)
Definition: AliMpExMap.cxx:211
Int_t GetSize() const
Definition: AliMpExMap.cxx:339
AliMpExMap & operator=(const AliMpExMap &rhs)
Definition: AliMpExMap.cxx:139
static const Int_t fgkDefaultSize
Default initial size.
Definition: AliMpExMap.h:83
virtual ~AliMpExMap()
Definition: AliMpExMap.cxx:151
void Copy(TObject &dest) const
Definition: AliMpExMap.cxx:226
static const Bool_t fgkDefaultOwnership
Default ownership.
Definition: AliMpExMap.h:84
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
Definition: AliMpExMap.cxx:364
TExMap fMap
! Transient map class
Definition: AliMpExMap.h:92
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
Definition: AliMpExMap.cxx:291
static const Int_t fgkSeparator2
the separator used for conversion of TString to Int_t
Definition: AliMpExMap.h:88
void SetOwner(Bool_t owner)
Definition: AliMpExMap.cxx:331
static const Int_t fgkSeparator1
the separator used for conversion of Int_t pair to Int_t
Definition: AliMpExMap.h:86
static Int_t GetPairSecond(Long_t index)
Definition: AliMpExMap.cxx:190
TArrayL fKeys
Array of keys.
Definition: AliMpExMap.h:94
void FillMap()
Definition: AliMpExMap.cxx:202
static Long_t GetIndex(const TString &s)
Definition: AliMpExMap.cxx:68
static TString GetString(Long_t index)
Definition: AliMpExMap.cxx:85
Implementation of TIterator for AliMpExMap.
virtual void Clear(Option_t *opt="")
Definition: AliMpExMap.cxx:258
Int_t GetCapacity() const
Definition: AliMpExMap.cxx:347
Helper class making Root persistent TExMap.
Definition: AliMpExMap.h:28
AliMpExMapIterator * CreateIterator() const
Definition: AliMpExMap.cxx:356
TObjArray fObjects
Array of objects.
Definition: AliMpExMap.h:93
static Int_t GetPairFirst(Long_t index)
Definition: AliMpExMap.cxx:182