cell_stats.c File Reference

#include "gis.h"
#include <stdlib.h>

Include dependency graph for cell_stats.c:

Go to the source code of this file.

Defines

#define INCR   10
#define SHIFT   6
#define NODE   struct Cell_stats_node

Functions

int G_init_cell_stats (struct Cell_stats *s)
 initialize cell stats
int G_update_cell_stats (CELL *cell, int n, struct Cell_stats *s)
 add data to cell stats
int G_find_cell_stat (CELL cat, long *count, struct Cell_stats *s)
 random query of cell stats
int G_rewind_cell_stats (struct Cell_stats *s)
 reset/rewind cell stats
int G_next_cell_stat (CELL *cat, long *count, struct Cell_stats *s)
 retrieve sorted cell stats
int G_get_stats_for_null_value (long *count, struct Cell_stats *s)
 Get a number of null values from stats structure. Note: when reporting values which appear in a map using G_next_cell_stats(), to get stats for null, call G_get_stats_for_null_value() first, since G_next_cell_stats() does not report stats for null.
int G_free_cell_stats (struct Cell_stats *s)
 free cell stats


Define Documentation

#define INCR   10

Definition at line 4 of file cell_stats.c.

Referenced by G_init_cell_stats(), and G_update_cell_stats().

#define NODE   struct Cell_stats_node

Definition at line 9 of file cell_stats.c.

Referenced by G_init_cell_stats(), and G_update_cell_stats().

#define SHIFT   6

Definition at line 5 of file cell_stats.c.

Referenced by G_find_cell_stat(), G_next_cell_stat(), and G_update_cell_stats().


Function Documentation

int G_find_cell_stat ( CELL  cat,
long *  count,
struct Cell_stats *  s 
)

random query of cell stats

Allow finding the count for the NULL-value

Returns:
int

Definition at line 215 of file cell_stats.c.

References G_is_c_null_value(), and SHIFT.

int G_free_cell_stats ( struct Cell_stats *  s  ) 

free cell stats

The memory associated with structure s is freed. This routine may be called any time after callingG_init_cell_stats.

Parameters:
s 
Returns:
int

Definition at line 439 of file cell_stats.c.

int G_get_stats_for_null_value ( long *  count,
struct Cell_stats *  s 
)

Get a number of null values from stats structure. Note: when reporting values which appear in a map using G_next_cell_stats(), to get stats for null, call G_get_stats_for_null_value() first, since G_next_cell_stats() does not report stats for null.

Parameters:
count 
s 
Returns:
int

Definition at line 422 of file cell_stats.c.

int G_init_cell_stats ( struct Cell_stats *  s  ) 

initialize cell stats

Set the count for NULL-values to zero.

Returns:
int

Definition at line 34 of file cell_stats.c.

References G_malloc(), INCR, and NODE.

int G_next_cell_stat ( CELL *  cat,
long *  count,
struct Cell_stats *  s 
)

retrieve sorted cell stats

Do not return a record for the NULL-value

Returns:
int

Definition at line 358 of file cell_stats.c.

References if(), and SHIFT.

Referenced by G_cell_stats_histo_eq(), G_make_histogram_cs(), G_make_histogram_eq_colors(), G_make_histogram_log_colors(), and G_write_histogram_cs().

int G_rewind_cell_stats ( struct Cell_stats *  s  ) 

reset/rewind cell stats

The structure s is rewound (i.e., positioned at the first raster category) so that sorted sequential retrieval can begin.

Parameters:
s 
Returns:
int

Definition at line 284 of file cell_stats.c.

Referenced by G_cell_stats_histo_eq(), G_make_histogram_cs(), G_make_histogram_eq_colors(), G_make_histogram_log_colors(), and G_write_histogram_cs().

int G_update_cell_stats ( CELL *  cell,
int  n,
struct Cell_stats *  s 
)

add data to cell stats

Look for NULLs and update the NULL-value count.

Returns:
int

Definition at line 67 of file cell_stats.c.

References cat, G_is_c_null_value(), G_realloc(), INCR, NODE, and SHIFT.

Referenced by G_put_map_row_random().


Generated on Mon Jan 1 19:49:27 2007 for GRASS by  doxygen 1.5.1