WebSphere Message Brokers
File: as08210_
Writer: Lorraine Waitt

Reference topic

This build: July 31, 2007 21:37:59

cpiWriteBuffer

Purpose

Writes a syntax element tree to the message buffer associated with a parser. It appends data to the bit stream in the message buffer associated with the parser object, using the current syntax element tree as a source. The element tree should not be modified during the execution of this implementation function. The cpiAppendToBuffer utility function can be used to append the message buffer (bit stream) with data from the element tree.

If this implementation function is provided in the CPI_VFT structure, neither cpiWriteBufferEncoded() nor cpiWriteBufferFormatted() can be specified, because the cpiDefineParserClass() function will fail with a return code of CCI_INVALID_IMPL_FUNCTION.

Defined In Type Member
CPI_VFT Conditional iFpWriteBuffer

Syntax

int cpiWriteBuffer(
  CciParser*   parser,
  CciContext*  context);

Parameters

parser
The address of the parser object (input).
context
The address of the context owned by the parser object (input).

Return values

The size in bytes of the data appended to the bit stream in the buffer.

Sample

int cpiWriteBuffer(
  CciParser*  parser,
  CciContext* context
){
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
  int                initialSize = 0;
  int                rc = 0;
  const void* a;
  CciByte b;

  
  initialSize = cpiBufferSize(&rc, parser);
  a = cpiBufferPointer(&rc, parser);
  b = cpiBufferByte(&rc, parser, 0);

  cpiAppendToBuffer(&rc, parser, (char *)"Some test data", 14);

  return cpiBufferSize(0, parser) - initialSize;
}
Related concepts
User-defined parsers
User-defined extensions overview
Related tasks
Creating a parser in C
Related reference
cpiWriteBufferEncoded
cpiWriteBufferFormatted
C parser implementation functions
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:37:59

as08210_ This topic's URL is: