#include "node.h"
#include <time.h>
Include dependency graph for statement.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | _statement |
The statement structure. More... | |
Typedefs | |
typedef _statement | Statement |
The statement structure. | |
Enumerations | |
enum | ex_flags { STATEMENT_RETURN_LIE = 1, STATEMENT_SET_LIE = 1 } |
enum | statement_mask { NO_MASK = 0, CONTEXT_MASK = 1, PREDICATE_MASK = 2, SUBJECT_MASK = 4, OBJECT_MASK = 8, MASK_ALL = 15 } |
Statement mask bits. More... | |
enum | statement_op { STATEMENT_OP_UNSET = 0, STATEMENT_OP_SET = 1, STATEMENT_OP_UNDEF = 2 } |
Statement operation field type. More... | |
Functions | |
STORAGE_TYPE void | statement_clear (Statement *stmt) |
Clears the statement's nodes. | |
STORAGE_TYPE Statement * | statement_clone (const Statement *src) |
Creates a copy of the source statement. | |
STORAGE_TYPE Statement * | statement_create (const Node *context, const Node *predicate, const Node *subject, const Node *object) |
Creates new statement object with filled values. | |
STORAGE_TYPE Statement * | statement_create_with_op (const Node *c, const Node *p, const Node *s, const Node *o, statement_op op) |
Creates a new statement with given operation. | |
STORAGE_TYPE void | statement_free (Statement *stmt) |
Destroys the statement. | |
STORAGE_TYPE const Node * | statement_get_context (const Statement *stmt) |
The statement context accessor. | |
STORAGE_TYPE time_t | statement_get_end (const Statement *stmt) |
STORAGE_TYPE int | statement_get_mask (const Statement *stmt) |
The statement mask accessor. | |
STORAGE_TYPE const Node * | statement_get_object (const Statement *stmt) |
The statement object accessor. | |
STORAGE_TYPE statement_op | statement_get_op (const Statement *stmt) |
Returns statement operation. | |
STORAGE_TYPE const Node * | statement_get_predicate (const Statement *stmt) |
The statement predicate accessor. | |
STORAGE_TYPE time_t | statement_get_start (const Statement *stmt) |
STORAGE_TYPE const Node * | statement_get_subject (const Statement *stmt) |
The statement subject accessor. | |
STORAGE_TYPE void | statement_init (Statement *stmt, const Node *c, const Node *p, const Node *s, const Node *o) |
STORAGE_TYPE int | statement_match (const Statement *mask, const Statement *stmt) |
Check the matching of stmt against mask returns zero if there is no match and positive value otherwise. | |
STORAGE_TYPE Statement * | statement_new () |
Creates empty statement object. | |
STORAGE_TYPE void | statement_result_append (Statement **result, Statement *s) |
Appends a new statement to the statement bunch. | |
STORAGE_TYPE void | statement_result_compact (unsigned *count, Statement ***result) |
Compacts the statement bunch. | |
STORAGE_TYPE unsigned int | statement_result_count (Statement *result) |
STORAGE_TYPE void | statement_result_free (Statement **result) |
Destroys the result model_storage_get() and model_storage_get_nr() functions. | |
STORAGE_TYPE int | statement_result_pop (Statement **result, Statement *head) |
Withdraws the head of a list and returns it. | |
STORAGE_TYPE void | statement_result_remove (Statement **result, Statement *stmt) |
Removes from the bunch and frees the statement with given index. | |
STORAGE_TYPE void | statement_set_context (Statement *stmt, const Node *context) |
Sets the context of the statement. | |
STORAGE_TYPE void | statement_set_end (Statement *stmt, time_t t) |
STORAGE_TYPE void | statement_set_mask (Statement *stmt, int mask) |
Sets the mask of the statement. | |
STORAGE_TYPE void | statement_set_object (Statement *stmt, const Node *object) |
Sets the object of the statement. | |
STORAGE_TYPE Statement * | statement_set_op (Statement *stmt, statement_op operation) |
Sets statement operation. | |
STORAGE_TYPE void | statement_set_predicate (Statement *stmt, const Node *predicate) |
Sets the predicate of the statement. | |
STORAGE_TYPE void | statement_set_start (Statement *stmt, time_t t) |
STORAGE_TYPE void | statement_set_subject (Statement *stmt, const Node *subject) |
Sets the subject of the statement. | |
STORAGE_TYPE void | statement_swap_op (Statement *op) |
Swaps the operation of the statement and its previsous state. | |
STORAGE_TYPE Statement * | stmt_from_strings (const char *c, const char *p, const char *s, const char *o) |
Creates new statement that contains nodes, created from given literals. | |
STORAGE_TYPE void | stmt_init_from_strings (Statement *stmt, const char *c, const char *p, const char *s, const char *o) |
Automatically creates nodes from strings and initializes a statement with them. |
The statement holds four members (context, predicate, subject, object). These members are all of Node (Node) type.
To create a new statement:
Statement *s; Node a,b,c,d; char *prefix = "noprefix"; node_init_string(&a, prefix, "Context"); node_init_string(&b, prefix, "Predicate"); node_init_string(&c, prefix, "Subject"); node_init_string(&d, prefix, "Object"); s = statement_create(&a, &b, &c, &d);
|
The statement structure. Contains the quadruplet nodes: context, predicate, subject and object. It also contains the mask bits. |
|
|
|
Statement mask bits.
|
|
Statement operation field type.
|
|
Clears the statement's nodes.
|
|
Creates a copy of the source statement. The newly created statement refers to the same nodes and mask as the source statement. |
|
Creates new statement object with filled values. The nodes passed to this function are cloned and managed by it So the caller is responsible for the arguments (depending on how has he got them). |
|
Creates a new statement with given operation.
|
|
Destroys the statement.
|
|
The statement context accessor.
|
|
|
|
The statement mask accessor.
|
|
The statement object accessor.
|
|
Returns statement operation.
|
|
The statement predicate accessor.
|
|
|
|
The statement subject accessor.
|
|
|
|
Check the matching of stmt against mask returns zero if there is no match and positive value otherwise.
|
|
Creates empty statement object.
|
|
Appends a new statement to the statement bunch. This function automatically reallocates the memory for the list of statements. The result should be cleared with statement_result_free() function. |
|
Compacts the statement bunch. Statement result should be compactified after massive removing with statement_result_remove() function and before any usage. This function reallocates the memory for the list compacted.
|
|
|
|
Destroys the result model_storage_get() and model_storage_get_nr() functions.
|
|
Withdraws the head of a list and returns it.
|
|
Removes from the bunch and frees the statement with given index. The result should be compacted with statement_result_compact() function |
|
Sets the context of the statement.
|
|
|
|
Sets the mask of the statement.
|
|
Sets the object of the statement.
|
|
Sets statement operation.
|
|
Sets the predicate of the statement.
|
|
|
|
Sets the subject of the statement.
|
|
Swaps the operation of the statement and its previsous state.
|
|
Creates new statement that contains nodes, created from given literals.
|
|
Automatically creates nodes from strings and initializes a statement with them.
|