[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Variables and related operations (`ap_var.h')

A variable is not necessarily a name, it can be a more complex structured datatype, depending on the application. That is the motivation to make it a parameter of the interface.

The abstract type ap_var_t is equipped with a total ordering function, a hashing function, a copy function, and a free function. The parametrization of the interface is performed via a global variable pointing to a ap_var_operations_t structure, containing the above-mentione doperations on ap_var_t objects. This means that this type should be fixed once, and that in a multitreaded application all threads should share the same ap_var_t type.

By default, ap_var_t is a C string (char*), and the global variable ap_var_operations is properly initialized.

datatype: ap_var_t
 
typedef void* ap_var_t;
Datatype for "variables". It is assumed to be of size sizeof(void*).

datatype: ap_var_operations_t
 
typedef struct ap_var_operations_t {
  int (*compare)(ap_var_t v1, ap_var_t v2); /* Total ordering function */
  int (*hash)(ap_var_t v);                  /* Hash function */
  ap_var_t (*copy)(ap_var_t var);           /* Duplication function */
  void (*free)(ap_var_t var);               /* Deallocation function */
  char* (*to_string)(ap_var_t var); /* Conversion to a dynamically allocated string,
				       which should be deallocated with free after use */
} ap_var_operations_t;
Datatype for defining the operations on "variables".

Variable: ap_var_operations_t var_operations_default
Default manager, where ap_var_t is assumed to be char*.

Variable: ap_var_operations_t* var_operations
Global pointer to the manager in use, by default points to ap_var_operations_default.



This document was generated on September, 10 2009 using texi2html