src/copier.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include "rdd.h"
#include "rdd_internals.h"
#include "reader.h"
#include "writer.h"
#include "filter.h"
#include "filterset.h"
#include "copier.h"

Include dependency graph for copier.c:

Go to the source code of this file.

Functions

int rdd_copy_exec (RDD_COPIER *c, RDD_READER *r, RDD_FILTERSET *fset, RDD_COPIER_RETURN *ret)
 Generic copy routine that instructs a copier to start copying.
int rdd_copy_free (RDD_COPIER *c)
 Deallocates the copier object and releases its resources.
int rdd_new_copier (RDD_COPIER **self, RDD_COPY_OPS *ops, unsigned statesize)
 Allocates a copier object and space for its implementation-specific state.


Function Documentation

int rdd_copy_exec ( RDD_COPIER c,
RDD_READER r,
RDD_FILTERSET fset,
RDD_COPIER_RETURN ret 
)

Generic copy routine that instructs a copier to start copying.

Parameters:
c a pointer to the copier object.
r a reader object from which the copier will read its source data.
fset a filter set; the copier will push the data it reads from the reader to all filters in the filter set.
Returns:
Returns RDD_OK on success.
Every copier reads, or tries to read, data from reader r. The data it reads, or the data that it substitutes, is passed to the filter set fset. The current copier implementation differ in how they handle read errors. A simple copier will give up after the first read error, but a robust copier will retry and eventually substitute data if a read fails repeatedly.

Definition at line 75 of file copier.c.

References _RDD_COPY_OPS::exec, and _RDD_COPIER::ops.

int rdd_copy_free ( RDD_COPIER c  ) 

Deallocates the copier object and releases its resources.

Parameters:
c a pointer to the copier object.
Returns:
Returns RDD_OK on success.

Definition at line 84 of file copier.c.

References _RDD_COPY_OPS::free, _RDD_COPIER::ops, RDD_OK, and _RDD_COPIER::state.

int rdd_new_copier ( RDD_COPIER **  c,
RDD_COPY_OPS ops,
unsigned  statesize 
)

Allocates a copier object and space for its implementation-specific state.

Parameters:
c output value: will be set to a pointer to the new copier object.
ops a pointer to a copiers implementation-specific copy routines.
statesize the size in bytes of the copier's state.
Returns:
Returns RDD_OK on success. Returns RDD_NOMEM if there is insufficient memory to create the object.
This is a utility routine that does not belong to the copy interface. It is used to prevent code duplication in copier implementations, which must all allocate a copier object and some implementation-specific state. This routine allocates the object and that state. The state buffer is zeroed. Initializing it with sensible values is, of course, a job left to the copier implementation.

Definition at line 49 of file copier.c.

References _RDD_COPIER::ops, RDD_BADARG, RDD_NOMEM, RDD_OK, and _RDD_COPIER::state.


Generated on Sun Feb 6 12:36:04 2011 for rdd by  doxygen 1.5.6