Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Bit Set Container
[Data Containers]

Collaboration diagram for Bit Set Container:


Files

file  psBitSet.h
 Creates an array of bytes of arbitrary length for storing individual bits.

Data Structures

struct  psBitSet
 Struct containing array of bytes to hold bit data and corresponding array length. More...

Functions

psBitSetpsBitSetAlloc (psS32 n)
 Allocate a psBitSet.
psBitSetpsBitSetSet (psBitSet *inMask, psS32 bit)
 Set a bit.
psBitSetpsBitSetClear (psBitSet *inMask, psS32 bit)
 Clear a bit.
psBool psBitSetTest (const psBitSet *inMask, psS32 bit)
 Test the value of a bit.
psBitSetpsBitSetOp (psBitSet *outMask, const psBitSet *inMask1, char *operator, const psBitSet *inMask2)
 Perform a binary operation on two psBitSets.
psBitSetpsBitSetNot (psBitSet *outBitSet, const psBitSet *inBitSet)
 Perform a not operation on a psBitSet.
char * psBitSetToString (const psBitSet *inMask)
 Convert the psBitSet to a string of ones and zeros.


Function Documentation

psBitSet* psBitSetAlloc psS32  n  ) 
 

Allocate a psBitSet.

Create a psBitSet with the number of bits specified by the user. All bits are set to zero upon allocation.

Returns:
psBitSet* : Pointer to struct containing array of bits and size of array.
Parameters:
n  Number of bits in psBitSet array

psBitSet* psBitSetClear psBitSet inMask,
psS32  bit
 

Clear a bit.

Clear a bit at a given bit location. The bit is cleared based on a zero index with the first bit set in the zero bit slot of the zero element of the byte array.

Returns:
psBitSet* : Pointer to struct containing psBitSet.
Parameters:
inMask  Pointer to psBitSet to be cleared.
bit  Bit to be cleared.

psBitSet* psBitSetNot psBitSet outBitSet,
const psBitSet inBitSet
 

Perform a not operation on a psBitSet.

Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero.

Returns:
psBitSet* : Pointer to struct containing result of operation.
Parameters:
outBitSet  Resulting psBitSet from operation
inBitSet  Input psBitSet

psBitSet* psBitSetOp psBitSet outMask,
const psBitSet inMask1,
char *  operator,
const psBitSet inMask2
 

Perform a binary operation on two psBitSets.

Perform an AND, OR, or XOR on two psBitSets. If the BitMasks are not the same size, the operation will not be performed and an error message will be logged.

Returns:
psBitSet* : Pointer to struct containing result of binary operation.
Parameters:
outMask  Resulting psBitSet from binary operation
inMask1  First psBitSet on which to operate
operator  Bit operation
inMask2  First psBitSet on which to operate

psBitSet* psBitSetSet psBitSet inMask,
psS32  bit
 

Set a bit.

Sets a bit at a given bit location. The bit is set based on a zero index with the first bit set in the zero bit slot of the zero element of the byte array. As an example, setting bit 3 in an array with two elements would result in an psBitSet that looks like 00000000 00001000.

Returns:
psBitSet* : Pointer to struct containing psBitSet.
Parameters:
inMask  Pointer to psBitSet to be set.
bit  Bit to be set.

psBool psBitSetTest const psBitSet inMask,
psS32  bit
 

Test the value of a bit.

Prints the value of a bit at a given bit location, either one or zero. The resulting bit is based on a zero index format with the first bit set in the zero bit slot of the zero element of the byte array As an example, testing bit 3 in a psBitSet with two bytes that looks like 00000000 00001000 would return a value of one, since that is the value that was set.

Returns:
int: Value of bit, either one or zero.
Parameters:
inMask  Pointer psBitSet to be tested.
bit  Bit to be tested.

char* psBitSetToString const psBitSet inMask  ) 
 

Convert the psBitSet to a string of ones and zeros.

Converts the contents of a psBitSet to a string representation of its binary form of ones and zeros. The LSB is the right-most chracter. Each set of eight characters represents one byte.

Returns:
char*: Pointer to character array containing string data.
Parameters:
inMask  psBitSet to convert */


Generated on Wed Jun 15 11:01:14 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1