Relational Algebra Engine
Loading...
Searching...
No Matches
Classes | Functions
relation.h File Reference
#include "set.h"
#include "tuple.h"
Include dependency graph for relation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Relation
 

Functions

Relation * relation_create (const char *name)
 Create a new Relation.
 
int relation_add_tuple (Relation *r, Tuple *t)
 Add a tuple to a relation.
 
void relation_destroy (Relation *r)
 Destroy a Relation and free its memory.
 
void relation_print (const Relation *r)
 Print a Relation to stdout.
 
Tuple * relation_find_tuple (Relation *r, Tuple *t)
 Find a tuple in a relation matching the target.
 

Function Documentation

◆ relation_add_tuple()

int relation_add_tuple ( Relation *  r,
Tuple *  t 
)

Add a tuple to a relation.

Parameters
rPointer to the Relation.
tPointer to the Tuple to add.
Returns
1 if added, 0 if already present, -1 on error.

◆ relation_create()

Relation * relation_create ( const char *  name)

Create a new Relation.

Parameters
nameName of the relation (copied).
Returns
Pointer to the new Relation, or NULL on failure.

◆ relation_destroy()

void relation_destroy ( Relation *  r)

Destroy a Relation and free its memory.

Parameters
rPointer to the Relation to destroy. Safe to pass NULL.

◆ relation_find_tuple()

Tuple * relation_find_tuple ( Relation *  r,
Tuple *  target 
)

Find a tuple in a relation matching the target.

Parameters
rPointer to the Relation.
targetPointer to the Tuple to find.
Returns
Pointer to the found Tuple, or NULL if not found.

◆ relation_print()

void relation_print ( const Relation *  r)

Print a Relation to stdout.

Parameters
rPointer to the Relation to print.