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

BitSet


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

bool psMemCheckBitSet (psPtr ptr)
 Checks the type of a particular pointer.
psBitSetpsBitSetAlloc (long nalloc)
 Allocate a psBitSet.
psBitSetpsBitSetSet (psBitSet *bitSet, long bit)
 Set a bit.
psBitSetpsBitSetClear (psBitSet *bitSet, long bit)
 Clear a bit.
bool psBitSetTest (const psBitSet *bitSet, long bit)
 Test the value of a bit.
psBitSetpsBitSetOp (psBitSet *outBitSet, const psBitSet *inBitSet1, const char *operator, const psBitSet *inBitSet2)
 Perform a binary operation on two psBitSets.
psBitSetpsBitSetNot (psBitSet *outBitSet, const psBitSet *inBitSet)
 Perform a not operation on a psBitSet.
psString psBitSetToString (const psBitSet *bitSet)
 Convert the psBitSet to a string of ones and zeros.


Function Documentation

psBitSet* psBitSetAlloc long  nalloc  ) 
 

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:
nalloc  Number of bits in psBitSet array

psBitSet* psBitSetClear psBitSet bitSet,
long  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:
bitSet  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 outBitSet,
const psBitSet inBitSet1,
const char *  operator,
const psBitSet inBitSet2
 

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:
outBitSet  Resulting psBitSet from binary operation
inBitSet1  First psBitSet on which to operate
operator  Bit operation
inBitSet2  First psBitSet on which to operate

psBitSet* psBitSetSet psBitSet bitSet,
long  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:
bitSet  Pointer to psBitSet to be set.
bit  Bit to be set.

bool psBitSetTest const psBitSet bitSet,
long  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:
bool: True if successful, otherwise false
Parameters:
bitSet  Pointer psBitSet to be tested.
bit  Bit to be tested.

psString psBitSetToString const psBitSet bitSet  ) 
 

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:
bitSet  psBitSet to convert */

bool psMemCheckBitSet psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psBitSet structure, false otherwise.
Parameters:
ptr  the pointer whose type to check


Generated on Wed Sep 14 10:43:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2