/*
$Log$
+Revision 1.7 2000/11/01 14:53:20 cblume
+Merge with TRD-develop
+
+Revision 1.1.4.3 2000/10/06 16:49:46 cblume
+Made Getters const
+
+Revision 1.1.4.2 2000/10/04 16:34:58 cblume
+Replace include files by forward declarations
+
+Revision 1.6 2000/06/09 11:10:07 cblume
+Compiler warnings and coding conventions, next round
+
+Revision 1.5 2000/06/08 18:32:58 cblume
+Make code compliant to coding conventions
+
Revision 1.4 2000/06/07 16:27:01 cblume
Try to remove compiler warnings on Sun and HP
// The row- and column dimensions are compressible.
//
+ fIndex = 0;
+
Allocate(nrow,ncol,ntime);
}
//_____________________________________________________________________________
-AliTRDdataArray::AliTRDdataArray(AliTRDdataArray &d)
+AliTRDdataArray::AliTRDdataArray(const AliTRDdataArray &d)
{
//
// AliTRDdataArray copy constructor
//
- d.Copy(*this);
+ ((AliTRDdataArray &) d).Copy(*this);
}
// AliTRDdataArray destructor
//
- if (fIndex) fIndex->Delete();
+ if (fIndex) delete fIndex;
}
//_____________________________________________________________________________
-void AliTRDdataArray::Copy(AliTRDdataArray &d)
+AliTRDdataArray &AliTRDdataArray::operator=(const AliTRDdataArray &d)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &d) ((AliTRDdataArray &) d).Copy(*this);
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArray::Copy(TObject &d)
{
//
// Copy function
//
- d.fNrow = fNrow;
- d.fNcol = fNcol;
- d.fNtime = fNtime;
+ ((AliTRDdataArray &) d).fNrow = fNrow;
+ ((AliTRDdataArray &) d).fNcol = fNcol;
+ ((AliTRDdataArray &) d).fNtime = fNtime;
- d.fNdim1 = fNdim1;
- d.fNdim2 = fNdim2;
+ ((AliTRDdataArray &) d).fNdim1 = fNdim1;
+ ((AliTRDdataArray &) d).fNdim2 = fNdim2;
- d.fBufType = fBufType;
- d.fNelems = fNelems;
+ ((AliTRDdataArray &) d).fBufType = fBufType;
+ ((AliTRDdataArray &) d).fNelems = fNelems;
- d.fCurrentIdx1 = 0;
- d.fCurrentIdx2 = 0;
- d.fCurrentIndex = 0;
+ ((AliTRDdataArray &) d).fCurrentIdx1 = 0;
+ ((AliTRDdataArray &) d).fCurrentIdx2 = 0;
+ ((AliTRDdataArray &) d).fCurrentIndex = 0;
- fIndex->Copy(*d.fIndex);
+ fIndex->Copy(*((AliTRDdataArray &) d).fIndex);
}
fNtime = ntime;
if (fIndex) delete fIndex;
- fIndex = new AliTRDarrayI;
+ fIndex = new AliTRDarrayI();
fIndex->Set(fNdim2);
for (Int_t i = 0, k = 0; i < fNdim2; i++, k += fNdim1) {
(*fIndex)[i] = k;
}
+//_____________________________________________________________________________
+Bool_t AliTRDdataArray::CheckBounds(const char *where, Int_t idx1, Int_t idx2)
+{
+ //
+ // Does the boundary checking
+ //
+
+ if ((idx2 >= fNdim2) || (idx2 < 0))
+ return OutOfBoundsError(where,idx1,idx2);
+
+ Int_t index = (*fIndex).At(idx2) + idx1;
+ if ((index < 0) || (index > fNelems))
+ return OutOfBoundsError(where,idx1,idx2);
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArray::OutOfBoundsError(const char *where, Int_t idx1, Int_t idx2)
+{
+ //
+ // Generate an out-of-bounds error. Always returns false.
+ //
+
+ TObject::Error(where, "idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+ ,idx1,idx2,fNdim1,fNdim2,this);
+
+ return kFALSE;
+
+}
+
//_____________________________________________________________________________
void AliTRDdataArray::Reset()
{
//
if (fIndex) delete fIndex;
- fIndex = new AliTRDarrayI;
+ fIndex = new AliTRDarrayI();
fIndex->Set(0);
fNdim1 = -1;
}
//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col)
+Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col) const
{
//
// Maps the two-dimensional row/column plane into an one-dimensional array.
}
//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time)
+Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time) const
{
//
// Maps the row/column/time into one number