Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sobj_ser.c File Reference


Detailed Description

Serialization and deserialization functions.

These functions are top-level wrappers for the functions implemented in sobj_bin.c (binary serialization) and sobj_text.c (text serialization).

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <math.h>
#include <errno.h>
#include "sobject_p.h"

Include dependency graph for sobj_ser.c:

Include dependency graph

Functions

sobjsobj_unpack (const char *ser, ptrdiff_t ser_len, enum sobj_text_context context, struct sobj_env *env)
 Deserialize a simple object.
sobjsobj_unpack_x (const char **ser, ptrdiff_t ser_len, enum sobj_text_context context, struct sobj_env *env)
 Deserialize a simple object.
sobjsobj_unpack_fp (FILE *fp, ptrdiff_t count, enum sobj_text_context context, struct sobj_env *env)
 Deserialize a simple object from a standard C stream.
int sobj_unpack_scan (int(*get_fn)(void *), void *sender, struct sobj_buffer *buffer, long limit)
 Scan for the end of a serialization of a simple object.
size_t sobj_pack (struct sobj *sobj, enum sobj_serialization_mode mode, struct sobj_buffer *buffer, struct sobj_env *env)
 Create a serialization from a simple object instance.
size_t sobj_pack_fp (struct sobj *sobj, enum sobj_serialization_mode mode, FILE *out, struct sobj_env *env)
 Create a serialization from a simple object instance.
sobjsobj_pack_do_callback (struct sobj *sobj, struct sobj_env *env)
 Internal function performing the ClassEnv::pack() callback.
sobjsobj_unpack_do_callback (struct sobj *sobj, struct sobj_env *env)
 Internal function performing the ClassEnv::unpack() callback.

Function Documentation

struct sobj* sobj_pack_do_callback struct sobj sobj,
struct sobj_env env
 

Internal function performing the ClassEnv::pack() callback.

The function processes the passed object sobj recursively, calling the ClassEnv::pack() callback on the leaf objects first.

Parameters:
sobj The called object. The function will steal a reference if the object is replaced by the callback.
env The environment. This may not be a null-pointer.
Returns:
The callback object or a new reference to the replaced object. If the ClassEnv::pack() callback returns null, an error message is issued and the called object sobj is returned as is.
Note:
The function handles references in a way that the following sequence works:
          RETAIN(x);
          x = sobj_pack_do_callback(x, env);
          // Code
          RELEASE(x);

Never call this function without owning a reference to the called object sobj.

struct sobj* sobj_unpack_do_callback struct sobj sobj,
struct sobj_env env
 

Internal function performing the ClassEnv::unpack() callback.

In contrast to the sobj_pack_do_callback() function, the callback is not callback on the subobjects first. This is because of the recursive object construction processes already processes the subobjects in the correct order.

Parameters:
sobj The called object. The function will steal a reference if the object is replaced by the callback.
env The environment object. This may not be a null-pointer.
Returns:
The callback object or a new reference to the replaced object. If the ClassEnv::unpack() callback returns null, an error message is issued and the called object sobj is returned as is.
Note:
The function handles references in a way that the following sequence works:
          RETAIN(x);
          x = sobj_unpack_do_callback(x, env);
          // Code
          RELEASE(x);

Never call this function without owning a reference to the called object sobj.


Generated on Sat Jul 23 16:05:34 2005 for sobject by  doxygen 1.3.9.1