33 |
|
UInt_t Entries() const { return fNumEntries; } |
34 |
|
UInt_t GetEntries() const { return fNumEntries; } |
35 |
|
const char *GetName() const { return fArray.GetName(); } |
36 |
+ |
UInt_t GetSize() const { return fArray.GetSize(); } |
37 |
|
Bool_t IsOwner() const { return kTRUE; } |
38 |
|
TIterator *Iterator(Bool_t dir = kIterForward) const; |
39 |
|
Bool_t MustClear() const { return this->TestBit(14); } |
40 |
|
Bool_t MustDelete() const { return this->TestBit(15); } |
41 |
+ |
void Print(Option_t *opt="") const; |
42 |
|
void Reset(); |
41 |
– |
void Trim() { fArray.Compress(); } |
43 |
|
void SetMustClearBit() { this->SetBit(14); } |
44 |
|
void SetMustDeleteBit() { this->SetBit(15); } |
45 |
|
void SetName(const char *name) { fArray.SetName(name); } |
46 |
+ |
void Trim() { fArray.Compress(); } |
47 |
|
ArrayElement *UncheckedAt(UInt_t idx); |
48 |
|
const ArrayElement *UncheckedAt(UInt_t idx) const; |
47 |
– |
|
49 |
|
ArrayElement *operator[](UInt_t idx); |
50 |
|
const ArrayElement *operator[](UInt_t idx) const; |
51 |
|
|
109 |
|
|
110 |
|
ArrayElement tmp; |
111 |
|
TObject::Fatal("At","Index too large: (%ud < %ud violated) for %s containing %s", |
112 |
< |
idx, fNumEntries, this->GetName(), tmp.GetName()); |
112 |
> |
idx, fNumEntries, GetName(), tmp.GetName()); |
113 |
|
return 0; |
114 |
|
} |
115 |
|
|
124 |
|
|
125 |
|
ArrayElement tmp; |
126 |
|
TObject::Fatal("At","Index too large: (%ud < %ud violated) for %s containing %s", |
127 |
< |
idx, fNumEntries, this->GetName(), tmp.GetName()); |
127 |
> |
idx, fNumEntries, GetName(), tmp.GetName()); |
128 |
|
return 0; |
129 |
|
} |
130 |
|
|
139 |
|
|
140 |
|
//-------------------------------------------------------------------------------------------------- |
141 |
|
template<class ArrayElement> |
142 |
< |
inline const ArrayElement *mithep::Array<ArrayElement>::operator[](UInt_t idx) const |
142 |
> |
void mithep::Array<ArrayElement>::Print(Option_t *opt) const |
143 |
|
{ |
144 |
< |
// Return entry at given index. |
144 |
< |
|
145 |
< |
return At(idx); |
146 |
< |
} |
144 |
> |
// Print out elements of array. |
145 |
|
|
146 |
< |
//-------------------------------------------------------------------------------------------------- |
147 |
< |
template<class ArrayElement> |
150 |
< |
inline ArrayElement *mithep::Array<ArrayElement>::operator[](UInt_t idx) |
151 |
< |
{ |
152 |
< |
// Return entry at given index. |
146 |
> |
printf("%s: Contains %d (out of %d) objs of name %s\n", |
147 |
> |
GetName(), GetEntries(), GetSize(), ArrayElement::Class_Name()); |
148 |
|
|
149 |
< |
return At(idx); |
149 |
> |
const UInt_t N = GetEntries(); |
150 |
> |
for (UInt_t i=0; i<N; ++i) { |
151 |
> |
printf("%4d: ",i); |
152 |
> |
At(i)->Print(opt); |
153 |
> |
} |
154 |
|
} |
155 |
|
|
156 |
|
//-------------------------------------------------------------------------------------------------- |
159 |
|
{ |
160 |
|
// ROOT implementation for clearing the array. |
161 |
|
|
162 |
< |
if (this->MustDelete()) |
162 |
> |
if (MustDelete()) |
163 |
|
fArray.Delete(); //will call destructor for every element |
164 |
< |
else if (this->MustClear()) |
164 |
> |
else if (MustClear()) |
165 |
|
fArray.Clear("C"); //will call clear for every element |
166 |
|
else |
167 |
|
fArray.Clear(); |
186 |
|
|
187 |
|
return static_cast<const ArrayElement*>(fArray.UncheckedAt(idx)); |
188 |
|
} |
189 |
+ |
|
190 |
+ |
//-------------------------------------------------------------------------------------------------- |
191 |
+ |
template<class ArrayElement> |
192 |
+ |
inline const ArrayElement *mithep::Array<ArrayElement>::operator[](UInt_t idx) const |
193 |
+ |
{ |
194 |
+ |
// Return entry at given index. |
195 |
+ |
|
196 |
+ |
return At(idx); |
197 |
+ |
} |
198 |
+ |
|
199 |
+ |
//-------------------------------------------------------------------------------------------------- |
200 |
+ |
template<class ArrayElement> |
201 |
+ |
inline ArrayElement *mithep::Array<ArrayElement>::operator[](UInt_t idx) |
202 |
+ |
{ |
203 |
+ |
// Return entry at given index. |
204 |
+ |
|
205 |
+ |
return At(idx); |
206 |
+ |
} |
207 |
|
#endif |