GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATXdsWrapper.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include "xds_p.h"
#include "uuid.h"
#include "GAT.h"
#include "GATXdsWrapper.h"
#include "GATMemoryStream.h"

Include dependency graph for GATXdsWrapper.c:

Include dependency graph

Go to the source code of this file.

Functions

int xml_encode_object (xds_t *xds, void *engine_context, void *buffer, size_t buffer_size, size_t *used_buffer_size, va_list *args)
 xml_encode_object

int xml_decode_object (xds_t *xds, void *engine_context, void *buffer, size_t buffer_size, size_t *used_buffer_size, va_list *args)
 xml_decode_object

int xml_encode_double_fmt (xds_t *xds, void *engine_context, void *buffer, size_t buffer_size, size_t *used_buffer_size, va_list *args)
int xml_decode_double_fmt (xds_t *xds, void *engine_context, void *buffer, size_t buffer_size, size_t *used_buffer_size, va_list *args)
GATResult GATXds_Init (GATXds *xds, GATXdsType type)
 GATXds_Init.

GATResult GATXds_InitEx (GATXds *xds, GATXdsType type, GATContext context)
void GATXds_Destroy (GATXds *xds)
 GATXds_Destroy.

GATResult GATXds_Encode (GATXds xds, GATXdsScope flag, void **buffer, size_t *buffer_len, const char *fmt,...)
 GATXds_Encode.

GATResult GATXds_EncodeV (GATXds xds, GATXdsScope flag, void **buffer, size_t *buffer_len, const char *fmt, va_list args)
GATResult GATXds_Decode (GATXds xds, GATXdsScope flag, void *buffer, size_t buffer_len, const char *fmt,...)
 GATXds_Decode.

GATResult GATXds_DecodeV (GATXds xds, GATXdsScope flag, void *buffer, size_t buffer_len, const char *fmt, va_list args)
size_t GATXds_GetBufferLen (GATXds xds)
 GATXds_GetBufferLen.

size_t GATXds_GetBufferCapacity (GATXds xds)
 GATXds_GetBufferLen.

GATResult GATXds_GetBuffer (GATXds xds, GATXdsScope flag, void **buffer, size_t *buffer_size)
 GATXds_GetBuffer.

GATResult GATXds_SerialiseObject (GATObject object, GATObject stream, GATBool clear_dirty, GATXdsSerialiseCallback callback, char const *fmt,...)
 GATXds_SerialiseObject.

GATResult GATXds_DeSerialiseObject (GATContext context, GATObject stream, GATXdsDeSerialiseCallback callback, GATXdsVersionCallback version_callback, GATObject *object, char const *fmt,...)
 GATXds_DeSerialiseObject.


Variables

const char * rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATXdsWrapper.c,v 1.23 2004/05/10 15:17:32 hartmutkaiser Exp $"


Function Documentation

int xml_encode_object xds_t *    xds,
void *    engine_context,
void *    buffer,
size_t    buffer_size,
size_t *    used_buffer_size,
va_list *    args
[static]
 

xml_encode_object

The function xml_encode_object

Definition at line 529 of file GATXdsWrapper.c.

References GAT_FAIL, GAT_FAILED, GAT_SUCCEEDED, GATBool, GATFalse, GATMemoryStream, GATMemoryStream_Create(), GATMemoryStream_Destroy(), GATMemoryStream_GetBuffer(), GATResult, GATSerialisable_Serialise(), GATTrue, GATuint32, and GATuint32_Serialise().

Referenced by GATXds_InitEx().

int xml_decode_object xds_t *    xds,
void *    engine_context,
void *    buffer,
size_t    buffer_size,
size_t *    used_buffer_size,
va_list *    args
[static]
 

xml_decode_object

The function xml_decode_object

Definition at line 586 of file GATXdsWrapper.c.

References GAT_FAILED, GAT_SUCCESS, GATFalse, GATMemoryStream, GATMemoryStream_Create(), GATMemoryStream_Destroy(), GATMemoryStream_Seek(), GATOrigin_Current, GATResult, GATSerialisable_DeSerialise(), GATTrue, GATuint32, and GATuint32_DeSerialise().

Referenced by GATXds_InitEx().

int xml_encode_double_fmt xds_t *    xds,
void *    engine_context,
void *    buffer,
size_t    buffer_size,
size_t *    used_buffer_size,
va_list *    args
[static]
 

Definition at line 659 of file GATXdsWrapper.c.

References assert.

Referenced by GATXds_InitEx().

int xml_decode_double_fmt xds_t *    xds,
void *    engine_context,
void *    buffer,
size_t    buffer_size,
size_t *    used_buffer_size,
va_list *    args
[static]
 

GATResult GATXds_Init GATXds   xds,
GATXdsType    type
 

GATXds_Init.

The function GATXds_Init initialises a new instance of the underlying XDS engine and registers all the streaming functions to be used by subsequent streaming operations via GATXds_Encode or GATXds_Decode.

Parameters:
xds  The pointer to a variable, which receives the initialised xds handle.
type  Defines, whether the returned engine is to be used for serialisation (type == GATXdsType_Encode) or de-serialisation (type == GATXdsType_Decode).
Returns:
An error code.

Definition at line 68 of file GATXdsWrapper.c.

References GATXds, GATXds_InitEx(), and GATXdsType.

Referenced by GATList_i_DeSerialise(), GATList_i_Serialise(), GATTable_Serialise(), and GATXds_SerialiseObject().

GATResult GATXds_InitEx GATXds   xds,
GATXdsType    type,
GATContext    context
 

Definition at line 74 of file GATXdsWrapper.c.

References GAT_INVALID_PARAMETER, GAT_SUCCESS, GATResult, GATXds, GATXdsType, GATXdsType_Decode, GATXdsType_Encode, XDS_TO_GAT, xml_decode_object(), xml_encode_double_fmt(), and xml_encode_object().

Referenced by GATTable_DeSerialise(), GATXds_DeSerialiseObject(), and GATXds_Init().

void GATXds_Destroy GATXds   xds
 

GATXds_Destroy.

The function GATXds_Destroy frees all the memory used by the XDS engine.

Parameters:
xds  The XDS engine handle to destroy.

Definition at line 130 of file GATXdsWrapper.c.

References GATXds.

Referenced by GATList_i_DeSerialise(), GATList_i_Serialise(), GATTable_DeSerialise(), GATTable_Serialise(), GATXds_DeSerialiseObject(), and GATXds_SerialiseObject().

GATResult GATXds_Encode GATXds    xds,
GATXdsScope    flag,
void **    buffer,
size_t *    buffer_len,
const char *    fmt,
...   
 

GATXds_Encode.

The function GATXds_Encode encodes the given data items accordingly to the given format description and returns the streamed data through the supplied buffer variable.

Parameters:
xds  The handle of the XDS engine to use.
flag  This defines the ownership of the returned buffer. If flag == GATXdsScope_Gift, the returned buffer is to be freed by the caller, If flag == GATXdsScope_Loan, the returned buffer memory is maintained by the XDS engine.
buffer  The pointer to a variable, where the buffer is to be returned. If this parameter is zero, no buffer is returned and may be requested in a subsequent call to GATXds_Encode.
buffer_len  This receives the size of the returned buffer.
fmt  A format description, which defines the data format of all subsequent parameters.
...  An arbitrary amount of data items to stream.
Returns:
An error code.

Definition at line 161 of file GATXdsWrapper.c.

References assert, GAT_SUCCESS, GATResult, GATXds, GATXdsScope, GATXdsScope_Gift, GATXdsScope_Loan, and XDS_TO_GAT.

Referenced by GATList_i_Serialise(), GATList_i_SerialiseItems(), GATTable_Serialise(), GATTable_SerialiseItems(), and GATXds_SerialiseObject().

GATResult GATXds_EncodeV GATXds    xds,
GATXdsScope    flag,
void **    buffer,
size_t *    buffer_len,
const char *    fmt,
va_list    args
 

Definition at line 194 of file GATXdsWrapper.c.

References assert, GAT_SUCCESS, GATResult, GATXds, GATXdsScope, GATXdsScope_Gift, GATXdsScope_Loan, and XDS_TO_GAT.

Referenced by GATXds_SerialiseObject().

GATResult GATXds_Decode GATXds    xds,
GATXdsScope    flag,
void *    buffer,
size_t    buffer_len,
const char *    fmt,
...   
 

GATXds_Decode.

The function GATXds_Decode decodes the required amount of data items accordingly to the given format description.

Parameters:
xds  The handle of the XDS engine to use.
flag  This defines the ownership of given returned buffer. If flag == GATXdsScope_Gift, the returned buffer is to be freed by the XDS engine, If flag == GATXdsScope_Loan, the supplied buffer memory is maintained by the caller.
buffer  The buffer containing the streamed data. If this parameter is zero, the existing buffer is reused and the decoding continues at the point, where a previous decode ended.
buffer_len  The size of the supplied buffer.
fmt  A format description, which defines the data format of all subsequent parameters.
...  An arbitrary amount of data item addresses to decode from the stream.
Returns:
An error code.

Definition at line 245 of file GATXdsWrapper.c.

References GAT_SUCCESS, GATResult, GATXds, GATXdsScope, and XDS_TO_GAT.

Referenced by GATList_DeSerialise_Items(), GATList_i_DeSerialise(), GATTable_DeSerialise(), GATTable_DeSerialise_Create(), and GATXds_DeSerialiseObject().

GATResult GATXds_DecodeV GATXds    xds,
GATXdsScope    flag,
void *    buffer,
size_t    buffer_len,
const char *    fmt,
va_list    args
 

Definition at line 273 of file GATXdsWrapper.c.

References GAT_SUCCESS, GATResult, GATXds, GATXdsScope, and XDS_TO_GAT.

Referenced by GATXds_DeSerialiseObject().

size_t GATXds_GetBufferLen GATXds    xds
 

GATXds_GetBufferLen.

The function GATXds_GetBufferLen may be used to retrieve the real amount of data decoded by the last call to GATXds_Decode.

Parameters:
xds  The handle of the XDS engine to use.
Returns:
The offset into the buffer, up to which the data was decoded successful.

Definition at line 308 of file GATXdsWrapper.c.

References GATXds.

Referenced by GATList_i_DeSerialise(), GATTable_DeSerialise(), and GATXds_DeSerialiseObject().

size_t GATXds_GetBufferCapacity GATXds    xds
 

GATXds_GetBufferLen.

The function GATXds_GetBufferCapacity may be used to retrieve the capacity of the buffer inside the XDS engine.

Parameters:
xds  The handle of the XDS engine to use.
Returns:
The buffer capacity.

Definition at line 323 of file GATXdsWrapper.c.

References GATXds.

Referenced by GATList_DeSerialise_Create().

GATResult GATXds_GetBuffer GATXds    xds,
GATXdsScope    flag,
void **    buffer,
size_t *    buffer_size
 

GATXds_GetBuffer.

The GATXds_GetBuffer may be called to get access to the buffer stored inside the XDS engine.

Parameters:
xds  The handle of the XDS engine to use.
flag  This defines the ownership of given returned buffer. If flag == GATXdsScope_Gift, the returned buffer is to be freed by the XDS engine, If flag == GATXdsScope_Loan, the supplied buffer memory is maintained by the caller.
buffer  The pointer to a variable, where the buffer is to be returned. If this parameter is zero, no buffer is returned and may be requested in a subsequent call to GATXds_Encode.
buffer_len  This receives the size of the returned buffer.
Returns:
An error code.

Definition at line 346 of file GATXdsWrapper.c.

References GAT_FAIL, GAT_SUCCESS, GATResult, GATXds, GATXdsScope, and XDS_TO_GAT.

Referenced by GATList_DeSerialise_Create(), GATList_i_SerialiseItems(), and GATTable_SerialiseItems().

GATResult GATXds_SerialiseObject GATObject    object,
GATObject    stream,
GATBool    clear_dirty,
GATXdsSerialiseCallback    callback,
char const *    fmt,
...   
 

GATXds_SerialiseObject.

The function GATXds_SerialiseObject is a helper function for serialisation of a GATObject, which calls back to the caller (through the callback argument) to serialize the data of the associated CPI provider.

Parameters:
object  The object to serialise. This is passed through to the callback function.
stream  The stream interface to use for the serialisation.
clear_dirty  If the clear_dirty parameter is set to GATTrue, the internal dirty flag of this object is to be reset (no used here) This is passed through to the callback function.
fmt  The format string for the serialisation of the supplied data items. This format should start with "uint32" for the version of the object.
...  The data items to serialise for the given object. The first of this items should be the version of the object.
Returns:
An error code.

Definition at line 383 of file GATXdsWrapper.c.

References assert, GAT_FAIL, GAT_SUCCESS, GATBool, GATResult, GATStreamable_Write(), GATuint32, GATXds, GATXds_Destroy(), GATXds_Encode(), GATXds_EncodeV(), GATXds_Init(), GATXdsScope_Gift, GATXdsSerialiseCallback, and GATXdsType_Encode.

Referenced by GATEndpoint_Serialise(), GATFile_Serialise(), GATJob_Serialise(), GATJobDescription_Serialise(), GATLocation_Serialise(), GATLogicalFile_Serialise(), GATResource_Serialise(), GATResourceDescription_Serialise(), GATSoftwareDescription_Serialise(), GATStatus_Serialise(), GATString_Serialise(), GATTime_Serialise(), and GATTimePeriod_Serialise().

GATResult GATXds_DeSerialiseObject GATContext    context,
GATObject    stream,
GATXdsDeSerialiseCallback    callback,
GATXdsVersionCallback    version_callback,
GATObject   object,
char const *    fmt,
...   
 

GATXds_DeSerialiseObject.

The function GATXds_DeSerialiseObject

Returns:
An error code.

Definition at line 436 of file GATXdsWrapper.c.

References GAT_MEMORYFAILURE, GAT_SUCCESS, GAT_UNKNOWN_FORMAT, GATFalse, GATOrigin_Current, GATResult, GATStreamable_Read(), GATStreamable_Seek(), GATuint32, GATXds, GATXds_Decode(), GATXds_DecodeV(), GATXds_Destroy(), GATXds_GetBufferLen(), GATXds_InitEx(), GATXdsDeSerialiseCallback, GATXdsScope, GATXdsScope_Gift, GATXdsScope_Loan, GATXdsType_Decode, and GATXdsVersionCallback.

Referenced by GATEndpoint_DeSerialise(), GATFile_DeSerialise(), GATJob_DeSerialise(), GATJobDescription_DeSerialise(), GATLocation_DeSerialise(), GATLogicalFile_DeSerialise(), GATResource_DeSerialise(), GATResourceDescription_DeSerialise(), GATSoftwareDescription_DeSerialise(), GATStatus_DeSerialise(), GATString_DeSerialise(), GATTime_DeSerialise(), and GATTimePeriod_DeSerialise().


Variable Documentation

const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATXdsWrapper.c,v 1.23 2004/05/10 15:17:32 hartmutkaiser Exp $" [static]
 

Definition at line 17 of file GATXdsWrapper.c.