Code Examples.
Code Examples.
Create a bitmap of specified length
ClBitmapHandleT bitHdl = CL_BM_INVALID_BITMAP_HANDLE;
ClUint32T bitNum = 10;
{
clLogError("EXP","BIT", "Failed to create bitmap.");
return rc;
}
ClRcT clBitmapCreate(CL_OUT ClBitmapHandleT *phBitmap, CL_IN ClUint32T bitNum)
Create a bitmap.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OK
Every thing is OK.
Definition: clCommonErrors.h:68
Set a bit of the bitmap
ClUint32T bitNum = 5;
{
clLogError("EXP","BIT", "Failed to set the bit 5.");
return rc;
}
ClRcT clBitmapBitSet(CL_IN ClBitmapHandleT hBitmap, CL_IN ClUint32T bitNum)
Set a bit of the bitmap.
Check the status of a bit of the bitmap
ClUint32T bitNum = 5;
ClInt32T bitStatus = CL_BM_BIT_UNDEF;
{
clLogError("EXP","BIT", "Failed to check the bit status.");
return rc;
}
if(CL_BM_BIT_SET == bitStatus)
{
clLogInfo("EXP","BIT", "Bit 5 is set.");
}
else if(CL_BM_BIT_CLEAR == bitStatus)
{
clLogInfo("EXP","BIT", "Bit 5 is not set.");
}
else
{
clLogInfo("EXP","BIT", "Bit 5 is undefined.");
}
ClInt32T clBitmapIsBitSet(CL_IN ClBitmapHandleT hBitmap, CL_IN ClUint32T bitNum, CL_OUT ClRcT *pRetCode)
Find the status of a bit (Set or Clear) in a bitmap.
Clear a bit of the bitmap
ClUint32T bitNum = 3;
Clear a bit of the bitmap
{
clLogError("EXP","BIT", "Failed to clear bit number 3.");
return rc;
}
ClRcT clBitmapBitClear(CL_IN ClBitmapHandleT hBitmap, CL_IN ClUint32T bitNum)
Clear a bit of the bitmap.
Get the length of the bitmap
ClUint32T bitmapLength = 0;
if(0 == bitmapLength)
{
clLogError("EXP","BIT", "Failed to get the bitmap length.");
}
else
{
clLogInfo("EXP","BIT", "Bitmap length = %d.", bitmapLength);
}
ClUint32T clBitmapLen(CL_IN ClBitmapHandleT hBitmap)
Get the length of a bitmap.
Get the number of bits set in the bitmap
ClUint32T numBitSet = 0;
{
clLogError("EXP","BIT", "Failed to get the bitmap length.");
return rc;
}
else
{
clLogInfo("EXP","BIT", "Number of bits set in the bitmap = %d.",
numBitSet);
}
ClRcT clBitmapNumBitsSet(CL_IN ClBitmapHandleT hBitmap, CL_OUT ClUint32T *pNumBits)
Number of bits set in a bitmap.
Destroy the Bitmap
{
clLogError("EXP","BIT", "Failed to destroy the bitmap.");
return rc;
}
ClRcT clBitmapDestroy(CL_IN ClBitmapHandleT hBitmap)
Destroy a bitmap.