Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

stmtbase.h File Reference

Statement Base interface. More...

#include "stmt/statement.h"
#include <stdio.h>

Include dependency graph for stmtbase.h:

Go to the source code of this file.

Typedefs

typedef int(* StmtBaseFilter )(void *obj, void *data)
typedef _StmtBaseHandle StmtBaseHandle
typedef void(* StmtUpdateCallback )(Statement *stmt, void *obj, void *data)

Functions

int stmtbase_close (StmtBaseHandle *h)
 Closes stmtbase handle.
void stmtbase_destoy ()
 Clears the statement base.
int stmtbase_get (StmtBaseHandle *h, const Statement *mask, Statement **result)
 Returns the request of the request.
int stmtbase_get_ex (StmtBaseHandle *h, const Statement *mask, Statement **result, void *data, int flags)
int stmtbase_init ()
 Initializes the statement base common structures.
int stmtbase_load (StmtBaseHandle *h, FILE *f)
int stmtbase_open (char *opts, StmtBaseHandle **h)
 Opens stmt base with given options.
int stmtbase_save (StmtBaseHandle *h, FILE *f)
int stmtbase_set (StmtBaseHandle *h, Statement *stmt)
 Changes the state of a statement in the statment base.
int stmtbase_set_ex (StmtBaseHandle *h, Statement *stmt, int flags)
void stmtbase_set_filter (StmtBaseHandle *h, StmtBaseFilter func)
void stmtbase_set_update_cb (StmtBaseHandle *h, StmtUpdateCallback cb)


Detailed Description

Statement Base interface.

Statement Base is the place where all the statements are resided.

The Statement base may have several implementations with the same interface which states the univerasal access for the statements. It is planned to be thread-safe to work in multithreaded enviroments.


Typedef Documentation

typedef int( * StmtBaseFilter)(void *obj, void *data)
 

typedef struct _StmtBaseHandle StmtBaseHandle
 

typedef void( * StmtUpdateCallback)(Statement *stmt, void *obj, void *data)
 


Function Documentation

int stmtbase_close StmtBaseHandle h  ) 
 

Closes stmtbase handle.

void stmtbase_destoy  ) 
 

Clears the statement base.

int stmtbase_get StmtBaseHandle h,
const Statement mask,
Statement **  result
 

Returns the request of the request.

  • mask -- the mask of the request
  • result -- a pointer to the list of result statements.
Returns:
zero value on success and error value otherwise.
The memory for the result is allocated automatically by this function. Most natural way of this function usage is:
 Statement *result = NULL;
 Statement *mask = stmt_init_strings("a", "b", "c", "d");
 statement_set_mask(mask, MASK_OBJECT);
 
 err = stmtbase_get(mask, &result);

 // do smth with result
 // free the result
 statement_result_free(&result);

int stmtbase_get_ex StmtBaseHandle h,
const Statement mask,
Statement **  result,
void *  data,
int  flags
 

int stmtbase_init  ) 
 

Initializes the statement base common structures.

This function is automatically called by model_storage_init() when you are using modelstorage.h interface.

int stmtbase_load StmtBaseHandle h,
FILE *  f
 

int stmtbase_open char *  opts,
StmtBaseHandle **  h
 

Opens stmt base with given options.

  • opts option string
  • h returned handle
Returns:
zero in case of successful opening and error code otherwise.

int stmtbase_save StmtBaseHandle h,
FILE *  f
 

int stmtbase_set StmtBaseHandle h,
Statement stmt
 

Changes the state of a statement in the statment base.

Tries to set or unset statement in the base depeding on Statement::operation field. Updates the Statement::prev field with the previous state of the statement.

  • h stmtbase handle
  • stmt a Statement to be set or unset
Returns:
zero on success and error code otherwise

int stmtbase_set_ex StmtBaseHandle h,
Statement stmt,
int  flags
 

void stmtbase_set_filter StmtBaseHandle h,
StmtBaseFilter  func
 

void stmtbase_set_update_cb StmtBaseHandle h,
StmtUpdateCallback  cb
 


Generated on Wed Dec 27 16:52:26 2006 for VRB Online Server by  doxygen 1.4.4