CWB
|
#include "corpmanag.h"
Data Structures | |
struct | _table |
The table object. More... | |
Typedefs | |
typedef struct _table | table |
The table object. More... | |
typedef enum _table_ops | TableOp |
The TableOp enumeration: specifies an operation to apply to a table. More... | |
Enumerations | |
enum | _table_ops { TReduce, TUnion, TIntersection, TDifference, TMaximalMatches, TLeftMaximalMatches, TNonOverlapping, TUniq } |
The TableOp enumeration: specifies an operation to apply to a table. More... | |
Functions | |
table | new_table (void) |
create and initialise new table (setting size and allocation to zero) More... | |
table | new_table_from_list (int *list, unsigned size) |
initialise new table inserting {list} as match column (sets table.size = table.allocated = size) More... | |
void | table_allocate (table t, int size) |
extend allocated space to exactly {size} rows (must be >= table.size) More... | |
void | delete_table (table t) |
destroy table object (deallocate all data) More... | |
table | table_duplicate (table t) |
make exact copy of table t More... | |
unsigned | table_size (table t) |
current size of table; encapsulates variable table.size More... | |
int | table_defined_field (table t, FieldType fld) |
returns True if {fld} column is defined (i.e. More... | |
int | table_get (table t, FieldType fld, unsigned row) |
get value of {row}th entry in {fld} column; returns -1 if column is NULL or row is out of range More... | |
void | table_set (table t, FieldType fld, unsigned row, int value) |
Sets {row}th entry in {fld} column to {value}; automatically allocates and extends columns. More... | |
int * | table_get_vector (table t, FieldType fld) |
Gets a pointer to int vector representing column {fld} for direct access; note that sortidx is ignored! More... | |
int * | table_get_sortidx (table t) |
Gets a pointer to sort index as int vector; returns NULL if table is unsorted. More... | |
int | table_normalise (table t) |
delete rows where match=-1 or matchend=-1, as well as duplicates; then sort by corpus position; returns True iff successful; note that both the MatchField and the MatchEndField column must be defined More... | |
int | table_setop (table t1, TableOp op, table t2) |
execute unary or binary operation {op}; result is stored in {t1}; returns True iff successful More... | |
The table object.
Tables are used to store query results, i.e. subcorpora with optional target fields.
All fields (Match, MatchEnd, and the various Target fields) are treated uniformly as the columns of a table: {table.field[MatchField]}, {table.field[MatchEndField]}, ... {table.size} is the number of rows (i.e. the number of cells in each column). Each column may be undefined, i.e. NULL. Rows where the MatchField column equals -1 are understood as 'deleted' rows. To allow tables to grow automatically, the number of allocated rows {table.allocated} may be greater than {table.size}. All columns must be allocated to the same size.
typedef enum _table_ops TableOp |
The TableOp enumeration: specifies an operation to apply to a table.
These are used as parameters to the table_setp() function.
We may want to change these ops and/or their exact semantics; however, for a smooth migration of the query evaluation component, it is advantageous to provide precise equivalents of the "traditional" operations
enum _table_ops |
The TableOp enumeration: specifies an operation to apply to a table.
These are used as parameters to the table_setp() function.
We may want to change these ops and/or their exact semantics; however, for a smooth migration of the query evaluation component, it is advantageous to provide precise equivalents of the "traditional" operations
void delete_table | ( | table | t | ) |
destroy table object (deallocate all data)
table new_table | ( | void | ) |
create and initialise new table (setting size and allocation to zero)
table new_table_from_list | ( | int * | list, |
unsigned | size | ||
) |
initialise new table inserting {list} as match column (sets table.size = table.allocated = size)
void table_allocate | ( | table | t, |
int | size | ||
) |
extend allocated space to exactly {size} rows (must be >= table.size)
returns True if {fld} column is defined (i.e.
!= NULL) in table {t}
get value of {row}th entry in {fld} column; returns -1 if column is NULL or row is out of range
int* table_get_sortidx | ( | table | t | ) |
Gets a pointer to sort index as int vector; returns NULL if table is unsorted.
Gets a pointer to int vector representing column {fld} for direct access; note that sortidx is ignored!
int table_normalise | ( | table | t | ) |
delete rows where match=-1 or matchend=-1, as well as duplicates; then sort by corpus position; returns True iff successful; note that both the MatchField and the MatchEndField column must be defined
Sets {row}th entry in {fld} column to {value}; automatically allocates and extends columns.
execute unary or binary operation {op}; result is stored in {t1}; returns True iff successful
unsigned table_size | ( | table | t | ) |
current size of table; encapsulates variable table.size