MeatAxe  2.4
Sets of Integers.

Detailed Description

Data Structures

class  Set_t
 A Set of Integers. More...
 

Functions

int SetIsValid (const Set_t *s)
 Check a set. More...
 
Set_tSetAlloc ()
 Create a new set. More...
 
int SetFree (Set_t *x)
 Destroy a set. More...
 
Set_tSetDup (const Set_t *s)
 Duplicate a set. More...
 
int SetInsert (Set_t *set, long elem)
 Insert an element into a set. More...
 
int SetPrint (char *name, const Set_t *s)
 Write a Set to the Standar Output. More...
 
int SetContains (const Set_t *set, long elem)
 Check if a number is in a set. More...
 

Function Documentation

◆ SetAlloc()

Set_t* SetAlloc ( )

Create a new set.

This function creates a new, empty set. To destroy a set, use SetFree(), not SysFree().

Returns
Pointer to the new set or 0 on error.

◆ SetContains()

int SetContains ( const Set_t set,
long  elem 
)

Check if a number is in a set.

Parameters
setPointer to the set.
elemNumber to check.
Returns
1 if the set contains elem, 0 if not.

◆ SetDup()

Set_t* SetDup ( const Set_t s)

Duplicate a set.

Parameters
sPointer to the set.
Returns
Pointer to a copy of the set, or 0 on error.

◆ SetFree()

int SetFree ( Set_t x)

Destroy a set.

This function frees an integer set. The argument must be a Set_t structure which has previously been allocated with SetAlloc().

Parameters
xPointer to the set.
Returns
0 on success, -1 on error.

◆ SetInsert()

int SetInsert ( Set_t set,
long  elem 
)

Insert an element into a set.

Parameters
setPointer to the set.
elemNumber to insert.
Returns
0 on success, -1 on error.

◆ SetIsValid()

int SetIsValid ( const Set_t s)

Check a set.

This function checks if the argument is a valid set. If the set is o.k., the function returns 1. Otherwise, an error is signaled and, if the error handler does not terminate the program, the function returns 0.

Parameters
sPointer to the set.
Returns
1 if s is a valid set, 0 otherwise.

◆ SetPrint()

int SetPrint ( char *  name,
const Set_t s 
)

Write a Set to the Standar Output.

This function prints a set in human-readable format on the standard output. If name is different from 0, name and a "=" is printed before the set.

Parameters
nameName to print before the set or 0.
sPointer to the set.

MeatAxe 2.4 documentation, generated on Mon Jun 7 2021 11:42:24