src/simplecopier.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.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 simplecopier.c:

Go to the source code of this file.

Data Structures

struct  _RDD_SIMPLE_COPIER
 State structure for a simple copier. More...

Defines

#define SIMPLE_READ_SIZE   65536
 Size of the read buffer in bytes; a simple copier reads at most SIMPLE_READ_SIZE bytes at a time from its reader.

Typedefs

typedef struct _RDD_SIMPLE_COPIER RDD_SIMPLE_COPIER
 State structure for a simple copier.

Functions

int rdd_new_simple_copier (RDD_COPIER **self, RDD_SIMPLE_PARAMS *params)
 Creates a new simple copier.
static int simple_exec (RDD_COPIER *c, RDD_READER *r, RDD_FILTERSET *fset, RDD_COPIER_RETURN *ret)

Variables

static RDD_COPY_OPS simple_ops


Define Documentation

#define SIMPLE_READ_SIZE   65536

Size of the read buffer in bytes; a simple copier reads at most SIMPLE_READ_SIZE bytes at a time from its reader.

Definition at line 52 of file simplecopier.c.


Typedef Documentation

State structure for a simple copier.

At present, a simple reader's state consists only of a read buffer. The read buffer could also be allocated on the stack in simple_exec(), which would eliminate all state, but I prefer to keep large data objects off the stack.


Function Documentation

int rdd_new_simple_copier ( RDD_COPIER **  c,
RDD_SIMPLE_PARAMS params 
)

Creates a new simple copier.

Parameters:
c output value: will be set to a pointer to the new simple copier object.
params the copier's parameters
Returns:
Returns RDD_OK on success. Returns RDD_NOMEM if there is insufficient memory to create the object.
A simple copier reads data from its reader (see rdd_copy_exec()) until it reached end-of-file or until it encounters any error, including a read error.

The parameters params specify a callback function and its environment. This function is called periodically and can be used to report or track progress.

Definition at line 76 of file simplecopier.c.

References _RDD_SIMPLE_PARAMS::progressenv, _RDD_SIMPLE_COPIER::progressenv, _RDD_SIMPLE_PARAMS::progressfun, _RDD_SIMPLE_COPIER::progressfun, rdd_new_copier(), RDD_OK, _RDD_SIMPLE_COPIER::readbuf, and _RDD_COPIER::state.

Here is the call graph for this function:

static int simple_exec ( RDD_COPIER c,
RDD_READER r,
RDD_FILTERSET fset,
RDD_COPIER_RETURN ret 
) [static]


Variable Documentation

Initial value:

 {
    simple_exec,
    0
}

Definition at line 70 of file simplecopier.c.


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