Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

udbm.cpp File Reference

#include <math.h>
#include <string>
#include "ruby.h"
#include "base/bitstring.h"
#include "dbm/gen.h"
#include "dbm/fed.h"
#include "dbm/mingraph.h"

Defines

#define SHORT_LINES
#define FED(VAL, NAME)   fed_t *NAME; Data_Get_Struct(VAL, fed_t, NAME)
#define FED2VALUE(FED)   Data_Wrap_Struct(cFed, NULL, delete_fed, FED)
#define RELATION2VALUE(R)   Data_Wrap_Struct(cRelation, NULL, NULL, (void*)(R << 4))
#define CONSTRAINT2BOUND(C)   NUM2INT(rb_funcall(C, BOUND_ID, 0))
#define CONSTRAINT2STRICT(C)   value2bool(rb_funcall(C, STRICT_QID, 0))
#define CONST_OP(OP)
#define SELF_OP(OP)
#define CONST_DO(WHAT)
#define SELF_DO(WHAT)
#define CONST_OPX(OP)
#define SELF_OPX(OP)
#define FED_OP(OP)
#define TEST_OP(OP)
#define DECL_SELF(FUNC)
#define DECL_FUNC(FUNC)
#define DECL_OP(NAME, OP)
#define DECL_TEST(OP)
#define DECL_CLOCK_OP(OP)
#define M(I, J)   m[(I)*dim+(J)]
#define BOUND(I, J)   dbm_raw2bound(M(I,J))
#define SX(B)   ((int)((B)*sx))
#define SY(B)   ((int)((B)*sy))
#define VALUEFUNC(f)   ((VALUE (*)(ANYARGS)) f)
#define METHOD(CLASS, NAME, FUNC, ARGC)   rb_define_method(CLASS, NAME, VALUEFUNC(FUNC), ARGC)
#define SINGLETON(CLASS, NAME, FUNC, ARGC)   rb_define_singleton_method(CLASS, NAME, VALUEFUNC(FUNC), ARGC)

Functions

static void check_Matrix (VALUE val)
static void check_size (int size, cindex_t dim)
static void check_Constraint (VALUE val)
static cindex_t check_clock (VALUE val, cindex_t dim)
static cindex_t check_index (VALUE val, cindex_t dim)
static void check_dim (int dim1, int dim2)
static void check_dim (const fed_t *f1, const fed_t *f2)
static cindex_t check_dim (VALUE val)
static bool value2bool (VALUE val)
static relation_t value2relation (VALUE val)
static relation_t check_relation (VALUE val)
static VALUE call_toa (VALUE val)
static int call_size (VALUE val)
static void check_argc (int argc, int nb)
static bool check_Fed_Matrix (VALUE arg)
static void value2intarray (VALUE arg, int *vec, int size)
static void value2doublearray (VALUE arg, double *vec, int size)
static void check_intarray (VALUE arg, int *vec, cindex_t dim)
static dbm_t matrix2dbm (VALUE matrix, cindex_t dim)
static void add_matrix (fed_t *fed, cindex_t dim, VALUE matrix)
static void delete_fed (void *fed)
static VALUE cRelation_new (VALUE classValue, VALUE arg)
static VALUE cRelation_toi (VALUE self)
static VALUE cRelation_tos (VALUE self)
static VALUE cFed_new (int argc, VALUE *argv, VALUE classValue)
static VALUE cFed_initialize (int argc, VALUE *argv, VALUE self)
static VALUE cFed_tos (VALUE self)
static VALUE cFed_toa (VALUE self)
static VALUE cFed_zero (VALUE self, VALUE arg)
static VALUE cFed_init (VALUE self, VALUE arg)
static VALUE cFed_random (VALUE self, VALUE arg)
static VALUE cFed_size (VALUE self)
static VALUE cFed_dim (VALUE self)
static VALUE cFed_setDimension (VALUE self, VALUE arg)
static VALUE cFed_copy (VALUE self)
static VALUE cFed_isEmpty (VALUE self)
static VALUE cFed_isUnbounded (VALUE self)
static VALUE cFed_relation (VALUE self, VALUE arg)
static VALUE cFed_constrainClock (VALUE self, VALUE clk, VALUE val)
static VALUE cFed_constrain (int argc, VALUE *argv, VALUE self)
static VALUE cFed_const_updateValue (VALUE self, VALUE x, VALUE val)
static VALUE cFed_self_updateValue (VALUE self, VALUE x, VALUE val)
static VALUE cFed_const_updateClock (VALUE self, VALUE x, VALUE y)
static VALUE cFed_self_updateClock (VALUE self, VALUE x, VALUE y)
static VALUE cFed_const_updateIncrement (VALUE self, VALUE x, VALUE inc)
static VALUE cFed_self_updateIncrement (VALUE self, VALUE x, VALUE inc)
static VALUE cFed_const_update (VALUE self, VALUE x, VALUE y, VALUE val)
static VALUE cFed_self_update (VALUE self, VALUE x, VALUE y, VALUE val)
static VALUE cFed_satisfies (int argc, VALUE *argv, VALUE self)
static VALUE cFed_contains (VALUE self, VALUE arg)
static VALUE cFed_possibleBackDelay (VALUE self, VALUE arg)
static VALUE cFed_delay (VALUE self, VALUE arg)
static void do_extrapolateMaxBounds (fed_t *fed, VALUE arg)
static VALUE cFed_const_extrapolateMaxBounds (VALUE self, VALUE arg)
static VALUE cFed_self_extrapolateMaxBounds (VALUE self, VALUE arg)
static void do_diagonalExtrapolateMaxBounds (fed_t *fed, VALUE arg)
static VALUE cFed_const_diagonalExtrapolateMaxBounds (VALUE self, VALUE arg)
static VALUE cFed_self_diagonalExtrapolateMaxBounds (VALUE self, VALUE arg)
static void do_extrapolateLUBounds (fed_t *fed, VALUE low, VALUE up)
static VALUE cFed_const_extrapolateLUBounds (VALUE self, VALUE low, VALUE up)
static VALUE cFed_self_extrapolateLUBounds (VALUE self, VALUE low, VALUE up)
static void do_diagonalExtrapolateLUBounds (fed_t *fed, VALUE low, VALUE up)
static VALUE cFed_const_diagonalExtrapolateLUBounds (VALUE self, VALUE low, VALUE up)
static VALUE cFed_self_diagonalExtrapolateLUBounds (VALUE self, VALUE low, VALUE up)
static raw_t get_max (const raw_t *dbm, cindex_t dim, cindex_t x, cindex_t y)
static void add_line (VALUE arr, int x1, int y1, int x2, int y2)
static void add_point (VALUE arr, int x, int y, int val)
static VALUE cFed_const_getDrawing (VALUE self, VALUE vborder, VALUE vwidth, VALUE vheight, VALUE vx, VALUE vy)
static VALUE cFed_const_getPointDrawing (VALUE self, VALUE pt, VALUE xval, VALUE yval)
static VALUE cFed_const_getFormula (VALUE self, VALUE arrString)
static void do_changeClocks (fed_t *fed, VALUE arg)
static VALUE cFed_const_changeClocks (VALUE self, VALUE arg)
static VALUE cFed_self_changeClocks (VALUE self, VALUE arg)
void Init_UDBM_lib ()

Variables

static const ID NEW_ID = rb_intern("new")
static const ID SIZE_ID = rb_intern("size")
static const ID TO_A_ID = rb_intern("to_a")
static const ID BOUND_ID = rb_intern("bound")
static const ID STRICT_QID = rb_intern("strict?")
static const char rDifferent [] = "Different"
static const char rSuperset [] = "Superset"
static const char rSubset [] = "Subset"
static const char rEqual [] = "Equal"
static VALUE mUDBM
static VALUE cFed
static VALUE cMatrix
static VALUE cConstraint
static VALUE cRelation
static int height
static int border
static double sx
static double sy

Define Documentation

#define BOUND (  I,
J   )     dbm_raw2bound(M(I,J))
 

#define CONST_DO (  WHAT   ) 
 

Value:

FED(self, fed);\
fed_t result(*fed);\
WHAT;\
return FED2VALUE(new fed_t(result))

#define CONST_OP (  OP   ) 
 

Value:

FED(self, fed);\
fed_t *result = new fed_t(*fed);\
result->OP;\
return FED2VALUE(result)

#define CONST_OPX (  OP   ) 
 

Value:

fed_t *result = new fed_t(*fed);\
result->OP;\
return FED2VALUE(result)

#define CONSTRAINT2BOUND (  C   )     NUM2INT(rb_funcall(C, BOUND_ID, 0))
 

#define CONSTRAINT2STRICT (  C   )     value2bool(rb_funcall(C, STRICT_QID, 0))
 

#define DECL_CLOCK_OP (  OP   ) 
 

Value:

static VALUE cFed_const_##OP(VALUE self, VALUE x)\
{\
    FED(self, fed);\
    cindex_t clock = check_clock(x, fed->getDimension());\
    CONST_OPX(OP(clock));\
}\
static VALUE cFed_self_##OP(VALUE self, VALUE x)\
{\
    SELF_OP(OP(check_clock(x, fed->getDimension())));\
}

#define DECL_FUNC (  FUNC   ) 
 

Value:

static VALUE cFed_const_##FUNC(VALUE self)\
{\
    CONST_OP(FUNC());\
}\
DECL_SELF(FUNC)

#define DECL_OP (  NAME,
OP   ) 
 

Value:

static void do_##NAME(fed_t *fed, VALUE arg)\
{\
    FED_OP(OP);\
}\
static VALUE cFed_const_##NAME(VALUE self, VALUE arg)\
{\
    CONST_DO(do_##NAME(&result, arg));\
}\
static VALUE cFed_self_##NAME(VALUE self, VALUE arg)\
{\
    SELF_DO(do_##NAME(fed, arg));\
}

#define DECL_SELF (  FUNC   ) 
 

Value:

static VALUE cFed_self_##FUNC(VALUE self)\
{\
    SELF_OP(FUNC());\
}

#define DECL_TEST (  OP   ) 
 

Value:

static VALUE cFed_##OP(VALUE self, VALUE arg)\
{\
    TEST_OP(OP);\
}

#define FED (  VAL,
NAME   )     fed_t *NAME; Data_Get_Struct(VAL, fed_t, NAME)
 

#define FED2VALUE (  FED   )     Data_Wrap_Struct(cFed, NULL, delete_fed, FED)
 

#define FED_OP (  OP   ) 
 

Value:

if (check_Fed_Matrix(arg))\
{\
    FED(arg, fed2);\
    check_dim(fed, fed2);\
    OP(*fed2);\
}\
else\
{\
    cindex_t dim = fed->getDimension();\
    check_size(call_size(arg), dim);\
    OP(matrix2dbm(arg, dim));\
}

#define M (  I,
J   )     m[(I)*dim+(J)]
 

#define METHOD (  CLASS,
NAME,
FUNC,
ARGC   )     rb_define_method(CLASS, NAME, VALUEFUNC(FUNC), ARGC)
 

#define RELATION2VALUE (  R   )     Data_Wrap_Struct(cRelation, NULL, NULL, (void*)(R << 4))
 

#define SELF_DO (  WHAT   ) 
 

Value:

FED(self, fed);\
WHAT;\
return self

#define SELF_OP (  OP   ) 
 

Value:

FED(self, fed);\
fed->OP;\
return self

#define SELF_OPX (  OP   ) 
 

Value:

fed->OP;\
return self

#define SHORT_LINES
 

#define SINGLETON (  CLASS,
NAME,
FUNC,
ARGC   )     rb_define_singleton_method(CLASS, NAME, VALUEFUNC(FUNC), ARGC)
 

#define SX (  B   )     ((int)((B)*sx))
 

#define SY (  B   )     ((int)((B)*sy))
 

#define TEST_OP (  OP   ) 
 

Value:

FED(self, fed);\
bool test;\
FED_OP(test = fed->OP);\
return test ? Qtrue : Qfalse

#define VALUEFUNC (  f   )     ((VALUE (*)(ANYARGS)) f)
 


Function Documentation

static void add_line (  VALUE  arr,
int  x1,
int  y1,
int  x2,
int  y2
)  [static]
 

static void add_matrix (  fed_t *  fed,
cindex_t  dim,
VALUE  matrix
)  [static]
 

static void add_point (  VALUE  arr,
int  x,
int  y,
int  val
)  [static]
 

static int call_size (  VALUE  val  )  [static]
 

static VALUE call_toa (  VALUE  val  )  [static]
 

static VALUE cFed_const_changeClocks (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_const_diagonalExtrapolateLUBounds (  VALUE  self,
VALUE  low,
VALUE  up
)  [static]
 

static VALUE cFed_const_diagonalExtrapolateMaxBounds (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_const_extrapolateLUBounds (  VALUE  self,
VALUE  low,
VALUE  up
)  [static]
 

static VALUE cFed_const_extrapolateMaxBounds (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_const_getDrawing (  VALUE  self,
VALUE  vborder,
VALUE  vwidth,
VALUE  vheight,
VALUE  vx,
VALUE  vy
)  [static]
 

static VALUE cFed_const_getFormula (  VALUE  self,
VALUE  arrString
)  [static]
 

static VALUE cFed_const_getPointDrawing (  VALUE  self,
VALUE  pt,
VALUE  xval,
VALUE  yval
)  [static]
 

static VALUE cFed_const_update (  VALUE  self,
VALUE  x,
VALUE  y,
VALUE  val
)  [static]
 

static VALUE cFed_const_updateClock (  VALUE  self,
VALUE  x,
VALUE  y
)  [static]
 

static VALUE cFed_const_updateIncrement (  VALUE  self,
VALUE  x,
VALUE  inc
)  [static]
 

static VALUE cFed_const_updateValue (  VALUE  self,
VALUE  x,
VALUE  val
)  [static]
 

static VALUE cFed_constrain (  int  argc,
VALUE *  argv,
VALUE  self
)  [static]
 

static VALUE cFed_constrainClock (  VALUE  self,
VALUE  clk,
VALUE  val
)  [static]
 

static VALUE cFed_contains (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_copy (  VALUE  self  )  [static]
 

static VALUE cFed_delay (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_dim (  VALUE  self  )  [static]
 

static VALUE cFed_init (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_initialize (  int  argc,
VALUE *  argv,
VALUE  self
)  [static]
 

static VALUE cFed_isEmpty (  VALUE  self  )  [static]
 

static VALUE cFed_isUnbounded (  VALUE  self  )  [static]
 

static VALUE cFed_new (  int  argc,
VALUE *  argv,
VALUE  classValue
)  [static]
 

static VALUE cFed_possibleBackDelay (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_random (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_relation (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_satisfies (  int  argc,
VALUE *  argv,
VALUE  self
)  [static]
 

static VALUE cFed_self_changeClocks (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_self_diagonalExtrapolateLUBounds (  VALUE  self,
VALUE  low,
VALUE  up
)  [static]
 

static VALUE cFed_self_diagonalExtrapolateMaxBounds (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_self_extrapolateLUBounds (  VALUE  self,
VALUE  low,
VALUE  up
)  [static]
 

static VALUE cFed_self_extrapolateMaxBounds (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_self_update (  VALUE  self,
VALUE  x,
VALUE  y,
VALUE  val
)  [static]
 

static VALUE cFed_self_updateClock (  VALUE  self,
VALUE  x,
VALUE  y
)  [static]
 

static VALUE cFed_self_updateIncrement (  VALUE  self,
VALUE  x,
VALUE  inc
)  [static]
 

static VALUE cFed_self_updateValue (  VALUE  self,
VALUE  x,
VALUE  val
)  [static]
 

static VALUE cFed_setDimension (  VALUE  self,
VALUE  arg
)  [static]
 

static VALUE cFed_size (  VALUE  self  )  [static]
 

static VALUE cFed_toa (  VALUE  self  )  [static]
 

static VALUE cFed_tos (  VALUE  self  )  [static]
 

static VALUE cFed_zero (  VALUE  self,
VALUE  arg
)  [static]
 

static void check_argc (  int  argc,
int  nb
)  [static]
 

static cindex_t check_clock (  VALUE  val,
cindex_t  dim
)  [static]
 

static void check_Constraint (  VALUE  val  )  [static]
 

static cindex_t check_dim (  VALUE  val  )  [static]
 

static void check_dim (  const fed_t *  f1,
const fed_t *  f2
)  [static]
 

static void check_dim (  int  dim1,
int  dim2
)  [static]
 

static bool check_Fed_Matrix (  VALUE  arg  )  [static]
 

static cindex_t check_index (  VALUE  val,
cindex_t  dim
)  [static]
 

static void check_intarray (  VALUE  arg,
int *  vec,
cindex_t  dim
)  [static]
 

static void check_Matrix (  VALUE  val  )  [static]
 

static relation_t check_relation (  VALUE  val  )  [static]
 

static void check_size (  int  size,
cindex_t  dim
)  [static]
 

static VALUE cRelation_new (  VALUE  classValue,
VALUE  arg
)  [static]
 

static VALUE cRelation_toi (  VALUE  self  )  [static]
 

static VALUE cRelation_tos (  VALUE  self  )  [static]
 

static void delete_fed (  void *  fed  )  [static]
 

static void do_changeClocks (  fed_t *  fed,
VALUE  arg
)  [static]
 

static void do_diagonalExtrapolateLUBounds (  fed_t *  fed,
VALUE  low,
VALUE  up
)  [static]
 

static void do_diagonalExtrapolateMaxBounds (  fed_t *  fed,
VALUE  arg
)  [static]
 

static void do_extrapolateLUBounds (  fed_t *  fed,
VALUE  low,
VALUE  up
)  [static]
 

static void do_extrapolateMaxBounds (  fed_t *  fed,
VALUE  arg
)  [static]
 

static raw_t get_max (  const raw_t *  dbm,
cindex_t  dim,
cindex_t  x,
cindex_t  y
)  [static]
 

void Init_UDBM_lib (   ) 
 

static dbm_t matrix2dbm (  VALUE  matrix,
cindex_t  dim
)  [static]
 

static bool value2bool (  VALUE  val  )  [static]
 

static void value2doublearray (  VALUE  arg,
double *  vec,
int  size
)  [static]
 

static void value2intarray (  VALUE  arg,
int *  vec,
int  size
)  [static]
 

static relation_t value2relation (  VALUE  val  )  [static]
 


Variable Documentation

int border [static]
 

const ID BOUND_ID = rb_intern("bound") [static]
 

VALUE cConstraint [static]
 

VALUE cFed [static]
 

VALUE cMatrix [static]
 

VALUE cRelation [static]
 

int height [static]
 

VALUE mUDBM [static]
 

const ID NEW_ID = rb_intern("new") [static]
 

const char rDifferent[] = "Different" [static]
 

const char rEqual[] = "Equal" [static]
 

const char rSubset[] = "Subset" [static]
 

const char rSuperset[] = "Superset" [static]
 

const ID SIZE_ID = rb_intern("size") [static]
 

const ID STRICT_QID = rb_intern("strict?") [static]
 

double sx [static]
 

double sy [static]
 

const ID TO_A_ID = rb_intern("to_a") [static]
 


Generated on Fri Jun 30 00:02:46 2006 for Module dbm by  doxygen 1.4.2