Class DBitArray

Inherits from:
Object
Declared in:
DBitArray.h

Class Hierarchy

    Object
      |
      +---DBitArray

Class Description

The bit array data type implements a number of methods for creating, manipulating and checking bit sets.

Example:
#include <stdio.h>
#include "ofc/DBitArray.h"

int main(int argc, char *argv[])
{
  DBitArray *array = [DBitArray alloc];

  [array init :1 :25];         // Initialise the array for values from 1..25

  [array set   :7];            // Set value 7 in the array
  [array set   :9 :20];        // Set values 9..20 in the array
  [array reset :11];           // Reset value 11 in the array
  [array reset :15 :18];       // Reset values 15..18 in the array

                               // Checking values
  printf("Value 10 is %s\n", [array has :10] ? "set" : "reset");
  printf("Value  8 is %s\n", [array has :8 ] ? "set" : "reset");

  printf("Threre are %d values set\n", [array count]);

  [array free];                // Cleanup

  return 0;
}
Last modified:
19-Jul-2008 (DBitArray.h)

Instance Variables

private unsigned char *_array
the bits for the array
private int _min
the minimum value in the bit array
private int _max
the maximum value in the bit array
private int _size
the size of the bit array

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0