iflBitArray(3)
iflBitArray - limited subscriptable bit array class
As shipped in IRIX 6.5.19. Unchanged since IRIX 6.5.
NAME iflBitArray - limited subscriptable bit array class INHERITS FROM none, standalone object HEADER FILE #include <ifl/iflBitArray.h> CLASS DESCRIPTION This class implements a very limited functionality subscriptable bit array that is used by the image data type converter (iflConverter). The constructor requires a void* initializer, so a form such as int from[1024], to[1024]; iflBitArray f = from, t = to; declares bit "pointers" referencing the int arrays. The bit array can then be accessed with contructs of the form floatVal = (float)f[i]; and deposits made with statements such as t[i] = floatVal; // no cast needed CLASS MEMBER FUNCTION SUMMARY Constructor iflBitArray(void* dp) Subscripted access iflBitArray& operator[](int idx) void operator=(long rhs) operator long() FUNCTION DESCRIPTIONS iflBitArray() iflBitArray(void* dp) Constructs a bit "pointer" that accesses the bit array pointed to by dp. Use the subscript operator to access elements of the array off this pseudo-pointer on either the left-hand or right-hand side of an assignment. operator[] iflBitArray& operator[](int idx) The subscript operator stores the byte and bit offsets needed to access the element specified by idx. This function returns a self- reference so the real work can be done with the cast and assigment operators for this class. It works with certain restrictions noted below. operator= void operator=(long rhs) The assignment operator clears or sets the bit pointed to by the left-hand side of the assigment. The bit is set if rhs is nonzero, otherwise it is cleared. By only allowing a long for the right-hand side, a bit subscript on the right is automatically extracted by going through the cast operator. C++ converts other types such as float and short to long without complaining. operator long operator long() The cast operator extracts the (previously remembered) subscripted bit. Again, C++ fills in all the other type conversions. NOTES Due to limitations of the implementation, the same bit "pointer" must not occur twice in the same assignment (with different subscripts): t[i] = ~(long)t[j]; // bogus result (depends on order of evaluation) t[i] = f[j]; // ok even if 't' and 'f' point to same data array