michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef INTCNT_H michael@0: #define INTCNT_H michael@0: michael@0: class IntCount michael@0: { michael@0: public: michael@0: IntCount(); michael@0: ~IntCount(); michael@0: void clear(); michael@0: int countAdd(int index, int increment=1); michael@0: int countGet(int index); michael@0: int getSize(); michael@0: int getCount(int pos); michael@0: int getIndex(int pos); michael@0: michael@0: IntCount(const IntCount&old) michael@0: { michael@0: numInts = old.numInts; michael@0: if (numInts > 0) { michael@0: iPair = new IntPair[numInts]; michael@0: for (int i = 0; i < numInts; i++) { michael@0: iPair[i] = old.iPair[i]; michael@0: } michael@0: } else { michael@0: iPair = nullptr; michael@0: } michael@0: } michael@0: private: michael@0: michael@0: int numInts; michael@0: struct IntPair{int idx; int cnt;} *iPair; michael@0: }; michael@0: michael@0: #endif