exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions | Variables
bin/headers/EXISerializer.h File Reference
#include "procTypes.h"

Go to the source code of this file.

Data Structures

struct  EXISerializer
 

Typedefs

typedef struct EXISerializer EXISerializer
 

Functions

errorCode startDocument (EXIStream *strm)
 Indicates the start of the EXI body serialization. More...
 
errorCode endDocument (EXIStream *strm)
 Indicates the end of the EXI body serialization. More...
 
errorCode startElement (EXIStream *strm, QName qname, EXITypeClass *valueType)
 Encodes start of an element with qualified name qname. More...
 
errorCode endElement (EXIStream *strm)
 Encodes the end of the last element. More...
 
errorCode attribute (EXIStream *strm, QName qname, boolean isSchemaType, EXITypeClass *valueType)
 Encodes a start of an attribute with qualified name qname Note that the attributes within an element must be encoded lexicographically sorted when in schema mode. More...
 
errorCode intData (EXIStream *strm, Integer int_val)
 Encodes integer data for element or attribute. More...
 
errorCode booleanData (EXIStream *strm, boolean bool_val)
 Encodes boolean data for element or attribute. More...
 
errorCode stringData (EXIStream *strm, const String str_val)
 Encodes string data for element or attribute. More...
 
errorCode floatData (EXIStream *strm, Float float_val)
 Encodes float data for element or attribute. More...
 
errorCode binaryData (EXIStream *strm, const char *binary_val, Index nbytes)
 Encodes binary data for element or attribute. More...
 
errorCode dateTimeData (EXIStream *strm, EXIPDateTime dt_val)
 Encodes dateTime data for element or attribute. More...
 
errorCode decimalData (EXIStream *strm, Decimal dec_val)
 Encodes decimal data for element or attribute. More...
 
errorCode listData (EXIStream *strm, unsigned int itemCount)
 Encodes list data for element or attribute. More...
 
errorCode qnameData (EXIStream *strm, QName qname)
 This function is only used to encode the value of xsi:type attribute. More...
 
errorCode processingInstruction (EXIStream *strm)
 Encode a processing instruction. More...
 
errorCode namespaceDeclaration (EXIStream *strm, const String ns, const String prefix, boolean isLocalElementNS)
 Encode a namespace declaration when Preserve.prefixes == TRUE. More...
 
errorCode selfContained (EXIStream *strm)
 Encode a self Contained event used for indexing independent elements for random access. More...
 
void initHeader (EXIStream *strm)
 Initialize the header of an EXI stream object. More...
 
errorCode initStream (EXIStream *strm, BinaryBuffer buffer, EXIPSchema *schema)
 Initialize EXI stream object. More...
 
errorCode closeEXIStream (EXIStream *strm)
 Destroy an EXI stream object releasing all the allocated memory for it. More...
 
errorCode flushEXIData (EXIStream *strm, char *outBuf, unsigned int bufSize, unsigned int *bytesFlush)
 In case the EXI buffer (strm->buffer) is filled this function can be used to flush it to some external buffer when strm->buffer.ioStrm.readWriteToStream is not available. More...
 
errorCode serializeEvent (EXIStream *strm, EventCode ec, QName *qname)
 To be used by code generation tools such as static XML bindings and when efficiency is of high importance. More...
 

Variables

const EXISerializer serialize
 Used during serialization for easy access to the EXIP serialization API. More...
 

Typedef Documentation

typedef struct EXISerializer EXISerializer

Definition at line 59 of file bin/headers/EXISerializer.h.

Function Documentation

errorCode attribute ( EXIStream strm,
QName  qname,
boolean  isSchemaType,
EXITypeClass valueType 
)

Sorting is done first by local name and then by namespace.

Parameters
[in,out]strmEXI stream object
[in]qnamequalified name of the attribute
[in]isSchemaTypefor schema mode, define if the value of the attribute is conforming to the type defined in the schema for that attribute. If in schemaless it should be TRUE;
[out]valueTypeIn case of a schema mode and isSchemaType == TRUE - the EXI type class of the attribute. It should be used to determine which function for data handling to be used for its content. Otherwise - VALUE_TYPE_NONE_CLASS
Returns
Error handling code
Todo:
Consider handling the lexicographical sorting of attributes by exip encoding utilities?

Definition at line 383 of file EXISerializer.c.

errorCode binaryData ( EXIStream strm,
const char *  binary_val,
Index  nbytes 
)
Parameters
[in,out]strmEXI stream object
[in]binary_valvalue to be encoded
[in]nbytesnumber of bytes in binary_val
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 702 of file EXISerializer.c.

errorCode booleanData ( EXIStream strm,
boolean  bool_val 
)
Parameters
[in,out]strmEXI stream object
[in]bool_valvalue to be encoded
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 514 of file EXISerializer.c.

errorCode closeEXIStream ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code

Definition at line 1029 of file EXISerializer.c.

errorCode dateTimeData ( EXIStream strm,
EXIPDateTime  dt_val 
)
Parameters
[in,out]strmEXI stream object
[in]dt_valvalue to be encoded
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 734 of file EXISerializer.c.

errorCode decimalData ( EXIStream strm,
Decimal  dec_val 
)
Parameters
[in,out]strmEXI stream object
[in]dec_valvalue to be encoded
Returns
Error handling code
Note
Use in schema mode only!

BEGIN type validation

END type validation

Definition at line 799 of file EXISerializer.c.

errorCode endDocument ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code

Definition at line 227 of file EXISerializer.c.

errorCode endElement ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code

Definition at line 354 of file EXISerializer.c.

errorCode floatData ( EXIStream strm,
Float  float_val 
)
Parameters
[in,out]strmEXI stream object
[in]float_valvalue to be encoded
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 641 of file EXISerializer.c.

errorCode flushEXIData ( EXIStream strm,
char *  outBuf,
unsigned int  bufSize,
unsigned int *  bytesFlush 
)

This is useful when streaming EXI data, for example, which needs to be implemented without a blocking call to the flushing interface i.e. strm->buffer.ioStrm.readWriteToStream.

Warning
Padding bits to fill a byte when in bit-packed mode should not be used as they will be interpreted as if being part of the EXI stream. This function always flushes the EXI buffer to the last byte boundary thus making sure the padding is not needed.
Remarks
The proper use of this function is as follows: When building the EXI body, before each call to serialize.*() functions the context of the EXI stream needs to be saved to a vairable e.g., StreamContext savedContext = strm.context; and also the grammar state: SmallIndex savedNonTerminalIndex = strm.gStack->currNonTermID; if the serialize.*() returns EXIP_BUFFER_END_REACHED the state needs to be restored with: strm.context = savedContext; and then testStrm.gStack->currNonTermID = savedNonTerminalIndex; Then the flushEXIData() function must be called to flush the buffer after which the failed serialize.*() call needs to be repeated. This non-blocking buffer flushing works only in EXI schema mode without any deviations. Otherwise the grammars and the string tables needs also to be backuped before each call of serialize.*() and then restored in case of EXIP_BUFFER_END_REACHED
Parameters
[in,out]strmEXI stream object
[out]outBufthe next EXI stream chunk to be parsed
[in]bufSizethe size in bytes of the inBuf
[out]bytesFlushbytes written to the outBuf
Returns
Error handling code

Definition at line 1049 of file EXISerializer.c.

void initHeader ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code

Definition at line 66 of file EXISerializer.c.

errorCode initStream ( EXIStream strm,
BinaryBuffer  buffer,
EXIPSchema schema 
)
Parameters
[in,out]strmEXI stream
[in,out]bufferoutput buffer for storing the encoded EXI stream
[in]schemaa compiled schema information to be used for schema enabled processing, NULL if no schema is available
Returns
Error handling code

Definition at line 75 of file EXISerializer.c.

errorCode intData ( EXIStream strm,
Integer  int_val 
)
Parameters
[in,out]strmEXI stream object
[in]int_valvalue to be encoded
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 482 of file EXISerializer.c.

errorCode listData ( EXIStream strm,
unsigned int  itemCount 
)
Parameters
[in,out]strmEXI stream object
[in]itemCountthe number of list items to be encoded
Returns
Error handling code
Note
Use in schema mode only!

Definition at line 897 of file EXISerializer.c.

errorCode namespaceDeclaration ( EXIStream strm,
const String  ns,
const String  prefix,
boolean  isLocalElementNS 
)
Parameters
[in,out]strmEXI stream object
[in]nsthe namespace to be encoded
[in]prefixthe prefix of the namespace to be encoded
[in]isLocalElementNSTRUE if this is the namespace locally defined for the element that contains it (see local-element-ns flag in the EXI spec)
Returns
Error handling code

Definition at line 968 of file EXISerializer.c.

errorCode processingInstruction ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code
Todo:
define the parameters!

Definition at line 963 of file EXISerializer.c.

errorCode qnameData ( EXIStream strm,
QName  qname 
)
Parameters
[in,out]strmEXI stream object
[in]qnamethe qname to be encoded
Returns
Error handling code

Definition at line 926 of file EXISerializer.c.

errorCode selfContained ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code
Todo:
define the parameters!

Definition at line 1024 of file EXISerializer.c.

errorCode serializeEvent ( EXIStream strm,
EventCode  ec,
QName qname 
)
Parameters
[in,out]strmEXI stream
[in]ecEXI event code of the production
[in]qnameused only for SE(*), AT(*), SE(uri:*), AT(uri:*) and when a new prefix should be serialized in SE(QName) and AT(QName); NULL otherwise
Returns
Error handling code

Definition at line 1069 of file EXISerializer.c.

errorCode startDocument ( EXIStream strm)
Parameters
[in,out]strmEXI stream object
Returns
Error handling code

Definition at line 217 of file EXISerializer.c.

errorCode startElement ( EXIStream strm,
QName  qname,
EXITypeClass valueType 
)
Parameters
[in,out]strmEXI stream object
[in]qnamequalified name of the element
[out]valueTypeIn case of a simple type element - the EXI type class of the element. It should be used to determine which function for data handling to be used for its content. If complex type - VALUE_TYPE_NONE_CLASS
Returns
Error handling code

Definition at line 244 of file EXISerializer.c.

errorCode stringData ( EXIStream strm,
const String  str_val 
)
Parameters
[in,out]strmEXI stream object
[in]str_valvalue to be encoded
Returns
Error handling code

Definition at line 588 of file EXISerializer.c.

Variable Documentation

const EXISerializer serialize

Definition at line 34 of file EXISerializer.c.