#ifndef MARS_MArrayD #define MARS_MArrayD #ifndef MARS_MArray #include "MArray.h" #endif #include class TArrayD; class MArrayD : public MArray { private: Double_t *fArray; //[fN] Array of fN chars public: MArrayD() { fN = 0; fArray = NULL; } MArrayD(UInt_t n) { fN = 0; fArray = NULL; Set(n); } MArrayD(UInt_t n, Double_t *array) { // Create TArrayC object and initialize it with values of array. fN = 0; fArray = NULL; Set(n, array); } MArrayD(const MArrayD &array) : MArray() { // Copy constructor. fArray = NULL; Set(array.fN, array.fArray); } MArrayD &operator=(const MArrayD &rhs) { // TArrayC assignment operator. if (this != &rhs) Set(rhs.fN, rhs.fArray); return *this; } virtual ~MArrayD() { // Delete TArrayC object. delete [] fArray; fArray = NULL; } void Adopt(UInt_t n, Double_t *array) { // Adopt array arr into TArrayC, i.e. don't copy arr but use it directly // in TArrayC. User may not delete arr, TArrayC dtor will do it. if (fArray) delete [] fArray; fN = n; fArray = array; } void AddAt(Double_t c, UInt_t i) { // Add char c at position i. Check for out of bounds. fArray[i] = c; } Double_t At(UInt_t i) const { return fArray[i]; } Double_t *GetArray() const { return fArray; } void Reset() { memset(fArray, 0, fN*sizeof(Double_t)); } void Reset(Double_t v) { for (Double_t *d=fArray; d