35 #include <Riostream.h>
50 const Bool_t
AliMpExMap::fgkDefaultOwnership = true;
63 static const TString kCharacterMap
64 =
" 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-";
74 AliErrorClass(
"String too long.");
79 for (Int_t i=s.Length()-1; i>=0; --i)
106 fMap(fgkDefaultSize),
107 fObjects(fgkDefaultSize),
108 fKeys(fgkDefaultSize)
145 if (
this == &rhs)
return *
this;
166 if ( first >= 0xFFFF || second >= 0xFFFF )
168 AliFatalClass(
"Index out of limit");
172 return 1 + ( first | ( second << 16 ) );
187 return (index-1) & 0xFFFF ;
195 return ( (index-1) & 0xFFFF0000 ) >> 16 ;
207 for (Int_t i=0; i<
fObjects.GetEntriesFast(); i++)
219 AliDebugStream(1) <<
"AliMpExMap::AddKey: resized Key array " << endl;
241 for ( Int_t i = 0; i <=
fObjects.GetLast(); ++i )
243 TObject* o =
fObjects.At(i)->Clone();
246 AliError(
"Object was not cloned properly ! Please investigate...");
273 cout << Form(
"fMap size/capacity %d/%d",
fMap.GetSize(),
fMap.Capacity())
274 << Form(
" fObjects.GetSize/Entries %d/%d",
fObjects.GetSize(),
fObjects.GetEntries())
275 << Form(
" fKeys.GetSize %d",
fKeys.GetSize()) << endl;
280 if ( sopt.Contains(
"FULL") )
284 while ( ( o = next() ) )
296 fMap.Add(
GetIndex(keyFirst, keySecond), (Long_t)
object);
316 fMap.Add(key, (Long_t)
object);
370 return reinterpret_cast<TObject*
>(
fMap.GetValue(
GetIndex(keyFirst, keySecond)));
379 return reinterpret_cast<TObject*
>(
fMap.GetValue(
GetIndex(key)));
388 return reinterpret_cast<TObject*
>(
fMap.GetValue(key));
392 void AliMpExMap::Streamer(TBuffer &R__b)
397 if (R__b.IsReading()) {
398 AliMpExMap::Class()->ReadBuffer(R__b,
this);
402 AliMpExMap::Class()->WriteBuffer(R__b,
this);
virtual void Print(Option_t *opt="") const
static const TString & GetCharacterMap()
AliMpExMap & operator=(const AliMpExMap &rhs)
void Copy(TObject &dest) const
friend class AliMpExMapIterator
static const Bool_t fgkDefaultOwnership
Default ownership.
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
TExMap fMap
! Transient map class
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
static const Int_t fgkSeparator2
the separator used for conversion of TString to Int_t
void SetOwner(Bool_t owner)
static Int_t GetPairSecond(Long_t index)
TArrayL fKeys
Array of keys.
static Long_t GetIndex(const TString &s)
static TString GetString(Long_t index)
Implementation of TIterator for AliMpExMap.
virtual void Clear(Option_t *opt="")
Int_t GetCapacity() const
Helper class making Root persistent TExMap.
AliMpExMapIterator * CreateIterator() const
TObjArray fObjects
Array of objects.
static Int_t GetPairFirst(Long_t index)