1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 ///////////////////////////////////////////////////////////////////////////////
23 //AliObjectArray is an array of clone (identical) objects. //
24 //In comparison with the TClonesArray objects in this array don't need //
25 //to derive from TObject. They also don't need RTTI - type information. //
27 //Objects type information is stored in object fClassInfo (instance of //
28 //the AliClassInfo). //
29 //Objects in array are stored sequentialy in buffers. Buffer is standart C++ //
30 //array of objects. Buffers size is equal for all of the buffers. If we specify
31 //fBufferSize==0 objects are stored in one big standart C++ array.
33 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
37 <img src="../gif/AliObjectArray.gif">
39 ///////////////////////////////////////////////////////////////////////////////
42 #include "AliObjectArray.h"
44 ClassImp(AliObjectArray)
46 AliObjectArray::AliObjectArray():AliMemArray()
54 AliObjectArray::AliObjectArray(const char * classname, Int_t buffersize):AliMemArray()
57 // AliObject array constructor
58 // Set class information fClassInfo according specified type and set the array size -size
59 // Buufer size fBufferSize
61 fBufferSize = buffersize;
65 AliObjectArray::AliObjectArray(const AliObjectArray &arr)
69 *((AliMemArray*)this) = *((AliMemArray*)&arr);
70 fClassInfo = arr.GetClassInfo();
74 AliObjectArray & AliObjectArray::operator=(const AliObjectArray &arr)
78 *((AliMemArray*)this) = *((AliMemArray*)&arr);
79 fClassInfo = arr.GetClassInfo();
83 AliObjectArray::~AliObjectArray()
90 Bool_t AliObjectArray::SetClass(const char * classname)
93 // Set class information fClassInfo according class name
97 fClassInfo = AliClassInfo::GenerClassInfo(classname);
98 fObjectSize = fClassInfo->Size();
99 return (fClassInfo!=0);
102 void AliObjectArray::Dump(Int_t i)
104 //dump object at position i
105 if (At(i)) fClassInfo->ObjectDump(At(i));
106 else printf("index %d - out of range\n",i);
109 void AliObjectArray::Streamer(TBuffer& R__b)
112 //Stream of the AliVector2D
115 if (R__b.IsReading()) {
116 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
117 TObject::Streamer(R__b);
118 s.Streamer(R__b); //read class info
119 if (s!=" ") SetClass(s.Data());
127 if (fBufferSize==0) fClassInfo->StreamBuffer(R__b, GetArray(), fSize);
129 for (UInt_t i=0;i<GetNBuffers();i++)
130 fClassInfo->StreamBuffer(R__b, GetRow(i), fBufferSize);
133 R__b.WriteVersion(AliObjectArray::IsA());
134 TObject::Streamer(R__b);
135 if (fClassInfo) s = fClassInfo->GetClassName();
143 if (fBufferSize==0) fClassInfo->StreamBuffer(R__b, GetArray(), fSize);
145 for (UInt_t i=0;i<GetNBuffers();i++)
146 fClassInfo->StreamBuffer(R__b, GetRow(i), fBufferSize);