3D-ICE 3.0.0
Data Structures | Typedefs | Functions
material.h File Reference
#include <stdio.h>
#include "types.h"
#include "string_t.h"

Go to the source code of this file.

Data Structures

struct  Material_t
 Structure used to store data about the materials that compose the 2D/3D stack. More...
 

Typedefs

typedef struct Material_t Material_t
 

Functions

void material_init (Material_t *material)
 
void material_copy (Material_t *dst, Material_t *src)
 
void material_destroy (Material_t *material)
 
Material_tmaterial_calloc (void)
 
Material_tmaterial_clone (Material_t *material)
 
void material_free (Material_t *material)
 
bool material_same_id (Material_t *material, Material_t *other)
 
void material_print (Material_t *material, FILE *stream, String_t prefix)
 

Typedef Documentation

◆ Material_t

typedef struct Material_t Material_t

Definition of the type Material_t

Definition at line 93 of file material.h.

Function Documentation

◆ material_calloc()

Material_t * material_calloc ( void  )

Allocates memory for a structure of type Material_t

The content of the new structure is set to default values calling material_init

Returns
the pointer to the new structure
NULL if the memory allocation fails

Definition at line 76 of file material.c.

◆ material_clone()

Material_t * material_clone ( Material_t material)

Allocates memory for a new copy of the structure material

Parameters
materialthe address of the structure to clone
Returns
a pointer to a new structure
NULL if the memory allocation fails
NULL if the parameter material is NULL

Definition at line 89 of file material.c.

◆ material_copy()

void material_copy ( Material_t dst,
Material_t src 
)

Copies the structure src into dst , as an assignement

The function destroys the content of dst and then makes the copy

Parameters
dstthe address of the left term sructure (destination)
srcthe address of the right term structure (source)

Definition at line 55 of file material.c.

◆ material_destroy()

void material_destroy ( Material_t material)

Destroys the content of the fields of the structure material

The function releases any dynamic memory used by the structure and resets its state calling material_init .

Parameters
materialthe address of the structure to destroy

Definition at line 67 of file material.c.

◆ material_free()

void material_free ( Material_t material)

Frees the memory space pointed by material

The function destroys the structure material and then frees its memory. The pointer material must have been returned by a previous call to material_calloc or material_clone .

If material is NULL, no operation is performed.

Parameters
materialthe pointer to free

Definition at line 106 of file material.c.

◆ material_init()

void material_init ( Material_t material)

Inits the fields of the material structure with default values

Parameters
materialthe address of the structure to initalize

Definition at line 45 of file material.c.

◆ material_print()

void material_print ( Material_t material,
FILE *  stream,
String_t  prefix 
)

Prints the material declaration as it looks in the stack file

Parameters
materialthe address of the structure to print
streamthe output stream (must be already open)
prefixa string to be printed as prefix at the beginning of each line

Definition at line 126 of file material.c.

◆ material_same_id()

bool material_same_id ( Material_t material,
Material_t other 
)

Tests if two materials have the same Id

Parameters
materialthe first material
otherthe second material
Returns
TRUE if material and other have the same Id
FALSE otherwise

Definition at line 119 of file material.c.