#ifndef MARS_MArrayI #define MARS_MArrayI #ifndef MARS_MArray #include "MArray.h" #endif #include class MArrayI : public MArray { private: Int_t *fArray; //[fN] Array of fN chars public: MArrayI() { fN = 0; fArray = NULL; } MArrayI(UInt_t n) { fN = 0; fArray = NULL; Set(n); } MArrayI(UInt_t n, Int_t *array) { // Create TArrayC object and initialize it with values of array. fN = 0; fArray = NULL; Set(n, array); } MArrayI(const MArrayI &array) : MArray() { // Copy constructor. fArray = NULL; Set(array.fN, array.fArray); } MArrayI &operator=(const MArrayI &rhs) { // TArrayC assignment operator. if (this != &rhs) Set(rhs.fN, rhs.fArray); return *this; } virtual ~MArrayI() { // Delete TArrayC object. delete [] fArray; fArray = NULL; } void Adopt(UInt_t n, Int_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(Int_t c, UInt_t i) { // Add char c at position i. Check for out of bounds. fArray[i] = c; } void Add(Int_t c) { Set(fN+1); fArray[fN-1] = c; } Int_t Find(Int_t c) const { for (Int_t *ptr=fArray; ptr