data_structures
Data Fields
s_type Struct Reference

A full representation of a data type, used to achieve polymorphism in the implementation of data structures. More...

#include <types.h>

Data Fields

char * name
 The name of a datatype as a string. More...
 
void *(* copy )(const void *)
 A function pointer used to copy the data type. More...
 
void(* del )(void *)
 A function pointer used to free the memory taken by the data type. More...
 
int(* cmp )(const void *, const void *)
 (optional) A function ponter used to compare members of this data type More...
 
size_t(* hash )(const void *, size_t)
 (optional) A function pointer used to get a hash value of this data type More...
 

Detailed Description

A full representation of a data type, used to achieve polymorphism in the implementation of data structures.

Remarks
Because polymorphism is achieved with void pointers, primitive data types, such as int and char, must be converted to pointers.
See also
data2ptr.c
ptr2data.c

It contains pointers to all the functions needed to work with this data type. New type's can be defined to extend the types that the data structures in this library can work with.

Definition at line 47 of file types.h.

Field Documentation

◆ cmp

s_type::cmp

(optional) A function ponter used to compare members of this data type

Definition at line 52 of file types.h.

◆ copy

s_type::copy

A function pointer used to copy the data type.

Definition at line 50 of file types.h.

◆ del

s_type::del

A function pointer used to free the memory taken by the data type.

Definition at line 51 of file types.h.

◆ hash

s_type::hash

(optional) A function pointer used to get a hash value of this data type

Definition at line 53 of file types.h.

◆ name

s_type::name

The name of a datatype as a string.

Definition at line 49 of file types.h.


The documentation for this struct was generated from the following file: