Code Examples.
Code Examples.
The following code example shows how to use few of the basic APIs of the buffer library. The following code shows initializing the buffer library, creation of a buffer message, writing and reading to the buffer message and deleting it once the application is done with using it.
}
}
strcpy(pByteBuffer, "Hello Clovis");
}
ClUint32T length = 0;
}
ClUint32T length = 15;
}
strcpy(pByteBuffer, "ABRAKADABRA");
strlen("ABRAKADABRA")+1);
}
}
ClRcT clBufferInitialize(const ClBufferPoolConfigT *pConfig)
Initializes the Buffer Management library.
ClPtrT ClBufferHandleT
The type of the handle for the buffer messages.
Definition: clBufferApi.h:82
ClRcT clBufferLengthGet(ClBufferHandleT messageHandle, ClUint32T *pMessageLength)
Returns the length of the message.
ClRcT clBufferNBytesWrite(ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T numberOfBytesToWrite)
Writes the specified number bytes of data from a message.
ClRcT clBufferDelete(ClBufferHandleT *pMessageHandle)
Deletes the Buffers.
ClRcT clBufferDataPrepend(ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T numberOfBytesToWrite)
Prepends specified number of bytes at the begining of message.
ClRcT clBufferCreate(ClBufferHandleT *pMessageHandle)
Creates a new message.
ClRcT clBufferNBytesRead(ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T *pNumberOfBytesToRead)
Reads the specified number of bytes of data from a message.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OK
Every thing is OK.
Definition: clCommonErrors.h:68
ClPtrT clHeapAllocate(CL_IN ClUint32T size)
Allocates memory of the requested size.