pmm  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
pmm_interval.c File Reference

Code for working with construction intervals. More...

#include <stdlib.h>
#include <string.h>
#include "pmm_log.h"
#include "pmm_interval.h"
#include "pmm_model.h"

Go to the source code of this file.

Functions

struct pmm_interval_listnew_interval_list ()
void free_interval_list (struct pmm_interval_list **il)
int isempty_interval_list (struct pmm_interval_list *l)
struct pmm_intervalnew_interval ()
struct pmm_intervalinit_interval (int plane, int n_p, enum pmm_interval_type type, int *start, int *end)
void free_interval (struct pmm_interval **i)
struct pmm_intervalread_top_interval (struct pmm_interval_list *l)
int remove_top_interval (struct pmm_interval_list *l)
int remove_interval (struct pmm_interval_list *l, struct pmm_interval *i)
int add_top_interval (struct pmm_interval_list *l, struct pmm_interval *i)
int add_bottom_interval (struct pmm_interval_list *l, struct pmm_interval *i)
void print_interval_list (const char *output, struct pmm_interval_list *l)
char * interval_type_to_string (enum pmm_interval_type type)
void print_interval (const char *output, struct pmm_interval *i)

Detailed Description

Code for working with construction intervals.

Construction intervals describe built/unbuilt regions of a model and are core to the optimised construction algorithms

Definition in file pmm_interval.c.

Function Documentation

int add_bottom_interval ( struct pmm_interval_list l,
struct pmm_interval i 
)

Add an interval to the bottom of the interval list

Parameters
lpointer to the interval list
ipointer to the interval
Returns
0 on success

Definition at line 343 of file pmm_interval.c.

int add_top_interval ( struct pmm_interval_list l,
struct pmm_interval i 
)

link the interval into interval list at the top/front

Parameters
lpointer to interval list
ipointer to interval to add to list
Returns
success always

Definition at line 311 of file pmm_interval.c.

void free_interval ( struct pmm_interval **  i)

frees an interval structure and members it contains

Parameters
ipointer to address of the interval

Definition at line 188 of file pmm_interval.c.

void free_interval_list ( struct pmm_interval_list **  il)

frees an interval list structure and members it contains

Parameters
ilpointer to address of the interval list

Definition at line 63 of file pmm_interval.c.

struct pmm_interval* init_interval ( int  plane,
int  n_p,
enum pmm_interval_type  type,
int *  start,
int *  end 
)
read

Initialize an interval with parameters passed.

Function maybe be used with _INFLECT and _BISECT intervals and with _POINT intervals if the start parameter is set to the point. May also be used to on initial IT_GBBP_CLIMB but not once climb_step is non-zero

Parameters
planeplane that the interval belongs to (defunct)
n_pnumber of parameters of the interval points
typeinterval tyle
startpointer to the start parameter array
endpointer to the end parameter array
Returns
pointer to a newly allocated interval with values initialised as per the arguments passed

Definition at line 147 of file pmm_interval.c.

char* interval_type_to_string ( enum pmm_interval_type  type)

map interval type to string for printing

Parameters
typeinterval type
Returns
char string describing interval

Definition at line 400 of file pmm_interval.c.

int isempty_interval_list ( struct pmm_interval_list l)

determine if interval list is empty

Parameters
lpointer to interval list
Returns
1 if list is empty, 0 if list is not empty

Definition at line 89 of file pmm_interval.c.

struct pmm_interval* new_interval ( )
read

Allocate and return an interval structure with default, zero parameter values

Returns
pointer to the allocated structure or NULL on failure

Definition at line 105 of file pmm_interval.c.

struct pmm_interval_list* new_interval_list ( )
read

Allocate and return an interval list structure

Returns
pointer to new interval list

Definition at line 44 of file pmm_interval.c.

void print_interval ( const char *  output,
struct pmm_interval i 
)

print interval

Parameters
outputoutput stream to print to
iinterval to print

Definition at line 431 of file pmm_interval.c.

void print_interval_list ( const char *  output,
struct pmm_interval_list l 
)

print interval list

Parameters
outputoutput stream to print to
linterval list to print

Definition at line 374 of file pmm_interval.c.

struct pmm_interval* read_top_interval ( struct pmm_interval_list l)
read

Definition at line 205 of file pmm_interval.c.

int remove_interval ( struct pmm_interval_list l,
struct pmm_interval i 
)

Removes and deletes an interval from an interval list

Parameters
lpointer to interval list
ipointer to the interval to remove
Returns
1 on success

Definition at line 271 of file pmm_interval.c.

int remove_top_interval ( struct pmm_interval_list l)

Removes and deletes the top interval on an interval list

Parameters
lpointer to the interval list
Returns
0 on failure, 1 on success

Definition at line 225 of file pmm_interval.c.