rtxDynBitSet.h File Reference

  • Implementation of a dynamic bit set similar to the Java BitSet class.
More...

#include "rtxsrc/rtxBitString.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxDynBitSetInit (OSCTXT *pctxt, OSRTDynBitSet *pbitset, OSUINT16 segNBytes)
 This function initializes a dynamic bit set structure.
EXTERNRT void rtxDynBitSetFree (OSCTXT *pctxt, OSRTDynBitSet *pbitset)
 This function frees dynamic memory held by the bit set.
EXTERNRT int rtxDynBitSetCopy (OSCTXT *pctxt, const OSRTDynBitSet *pSrcBitSet, OSRTDynBitSet *pDestBitSet)
 This function creates a deep copy of the given bit set.
EXTERNRT int rtxDynBitSetSetBit (OSCTXT *pctxt, OSRTDynBitSet *pbitset, OSUINT32 idx)
 This function sets the bit at the given index.
EXTERNRT int rtxDynBitSetClearBit (OSRTDynBitSet *pbitset, OSUINT32 idx)
 This function clears the bit at the given index.
EXTERNRT OSBOOL rtxDynBitSetTestBit (const OSRTDynBitSet *pbitset, OSUINT32 idx)
 This function tests the bit at the given index.
EXTERNRT int rtxDynBitSetSetBitToValue (OSCTXT *pctxt, OSRTDynBitSet *pbitset, OSUINT32 idx, OSBOOL value)
 This function sets the bit at the given index to the give value.
EXTERNRT int rtxDynBitSetInsertBit (OSCTXT *pctxt, OSRTDynBitSet *pbitset, OSUINT32 idx, OSBOOL value)
 This function inserts a bit with the given value at the given index.

Detailed Description

  • Implementation of a dynamic bit set similar to the Java BitSet class.

Definition in file rtxDynBitSet.h.


Function Documentation

EXTERNRT int rtxDynBitSetClearBit ( OSRTDynBitSet *  pbitset,
OSUINT32  idx 
)

This function clears the bit at the given index.

The bit set will be not be expanded if the given index is outside the currently allocated range. The bit will be assumed to already be clear since it is undefined.

Parameters:
pbitset Pointer to bit set structure.
idx Index of bit to be clear.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT int rtxDynBitSetCopy ( OSCTXT pctxt,
const OSRTDynBitSet *  pSrcBitSet,
OSRTDynBitSet *  pDestBitSet 
)

This function creates a deep copy of the given bit set.

Parameters:
pctxt Pointer to a context structure.
pSrcBitSet Pointer to bit set structure to be copied.
pDestBitSet Pointer to bit set structure to recieve copied data.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT void rtxDynBitSetFree ( OSCTXT pctxt,
OSRTDynBitSet *  pbitset 
)

This function frees dynamic memory held by the bit set.

Parameters:
pctxt Pointer to a context structure.
pbitset Pointer to bit set structure to be freed.
EXTERNRT int rtxDynBitSetInit ( OSCTXT pctxt,
OSRTDynBitSet *  pbitset,
OSUINT16  segNBytes 
)

This function initializes a dynamic bit set structure.

Memory is allocated for the initial segment.

Parameters:
pctxt Pointer to a context structure.
pbitset Pointer to bit set structure to be initialized.
segNBytes Number of bytes per segment expansion. If zero, the default value is used.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT int rtxDynBitSetInsertBit ( OSCTXT pctxt,
OSRTDynBitSet *  pbitset,
OSUINT32  idx,
OSBOOL  value 
)

This function inserts a bit with the given value at the given index.

All other bits are shifted to the right one position. If the maximum set bit number is at the end of the allocated range, the set is expanded.

Parameters:
pctxt Pointer to a context structure.
pbitset Pointer to bit set structure.
idx Index of position where bit is to be inserted.
value Boolean value of the bit.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT int rtxDynBitSetSetBit ( OSCTXT pctxt,
OSRTDynBitSet *  pbitset,
OSUINT32  idx 
)

This function sets the bit at the given index.

The bit set will be expanded if the given index is outside the currently allocated range.

Parameters:
pctxt Pointer to a context structure.
pbitset Pointer to bit set structure.
idx Index of bit to be set.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT int rtxDynBitSetSetBitToValue ( OSCTXT pctxt,
OSRTDynBitSet *  pbitset,
OSUINT32  idx,
OSBOOL  value 
)

This function sets the bit at the given index to the give value.

The bit set will be expanded if the given index is outside the currently allocated range.

Parameters:
pctxt Pointer to a context structure.
pbitset Pointer to bit set structure.
idx Index of bit to be set.
value Boolean value to which bit is to be set.
Returns:
Status of operation: zero if success or a negative error code if failure.
EXTERNRT OSBOOL rtxDynBitSetTestBit ( const OSRTDynBitSet *  pbitset,
OSUINT32  idx 
)

This function tests the bit at the given index.

If the index is outside the range of the currently allocated set, the bit is assumed to be clear; otherwise, the state of the bit in the set is tested.

Parameters:
pbitset Pointer to bit set structure.
idx Index of bit to be tested.
Returns:
Boolean result: true if bit set; false if clear.