Introduction

This implementation of a set stores the values in subsets that has consecutive values. Each subset only has a start and end member. The complexity of all set operations will therefore depend on the number of groups with consecutive values within the sets, but it does not exist a limit for the fragmentation of values within a set. Subsets are stored in ordinary STL sets.

Installation

Copy the single header file, consecutive_set.h, to wherever that suits your personal preference. No installation package is provided at this point. There is no other dependancy other than the STL set, assert.h and iostream header file (for printing of set contents to ostream&). At the time being, there are no distribution package. The class is contained in a single header file that can be retrieved using cvs: http://consecutiveset.cvs.sourceforge.net/viewvc/consecutiveset/include/

Set Class

The template parameter is the type that will be used for storing start and end values in the subsets.

Some examples:

consecutive_set<uint32_t> a(500,600);// Creates a set with 101 values from 500 to 600.

consecutive_set<uint16_t> b;// Creates an empty set

 

Since the subsets store end value as “past end”, one can not use the highest value that can be represented by the selected type as a member of the set. This is a design choice to improve performance, since it makes trivial to test if two subset can be concatenated. E.g. Using a uint16_t implies a possible range of values in the set to be from 0 to 2^16-2.

API description can be found at: http://consecutiveset.sourceforge.net/html/classconsecutive__set.html

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Detailed information about license terms can be found at http://www.gnu.org/licenses/.