[GRASS-SVN] r59091 - grass/trunk/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 18 13:01:41 PST 2014


Author: mmetz
Date: 2014-02-18 13:01:41 -0800 (Tue, 18 Feb 2014)
New Revision: 59091

Removed:
   grass/trunk/raster/r.li/r.li.daemon/index.h
Modified:
   grass/trunk/raster/r.li/r.li.daemon/daemon.c
   grass/trunk/raster/r.li/r.li.daemon/daemon.h
   grass/trunk/raster/r.li/r.li.daemon/worker.c
Log:
r.li.daemon: use a function prototype, new modules do not need to modify the daemon code

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-02-18 20:27:24 UTC (rev 59090)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-02-18 21:01:41 UTC (rev 59091)
@@ -41,7 +41,7 @@
 #define random rand
 #endif
 
-int calculateIndex(char *file, int f(int, char **, struct area_entry *, double *),
+int calculateIndex(char *file, rli_func *f,
 		   char **parameters, char *raster, char *output)
 {
 

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.h
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.h	2014-02-18 20:27:24 UTC (rev 59090)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.h	2014-02-18 21:01:41 UTC (rev 59091)
@@ -119,9 +119,18 @@
     char *mask_name;
 };
 
+/**
+ * \brief function prototype for index calculation
+ * \param fd file descripter of opened raster map
+ * \param par optional parameters
+ * \param ad definition of the sample area
+ * \param result pointer to store the result
+ * \return RLI_ERRORE error occurs in calculating index
+ * \return RLI_OK  otherwise
+ */
+typedef int rli_func(int fd, char **par, struct area_entry *ad, double *result);
 
 
-
 /**
  * \brief applies the f index once for every
  * area defined in setup file
@@ -132,7 +141,7 @@
  * \return 1  otherwise
  */
 
-int calculateIndex(char *file, int f(int, char **, struct area_entry *, double *),
+int calculateIndex(char *file, rli_func *f,
 		   char **parameters, char *raster, char *output);
 
 /**
@@ -199,7 +208,7 @@
  * \param f the function used for index computing
  * \param result where to put the result of index computing
  */
-void worker_init(char *raster, int f(int, char **, struct area_entry *, double *),
+void worker_init(char *raster, rli_func *f,
 		 char **parameters);
 void worker_process(msg * ret, msg * m);
 void worker_end(void);
@@ -267,4 +276,3 @@
   */
 FCELL *RLI_get_fcell_raster_row(int fd, int row, struct area_entry * ad);
 
-#include "index.h"

Deleted: grass/trunk/raster/r.li/r.li.daemon/index.h
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/index.h	2014-02-18 20:27:24 UTC (rev 59090)
+++ grass/trunk/raster/r.li/r.li.daemon/index.h	2014-02-18 21:01:41 UTC (rev 59091)
@@ -1,50 +0,0 @@
-/*
- * \file index.h
- *
- * \brief declaration of functions for r.li raster analysis
- *  
- * \author Claudio Porta, Lucio Davide Spano, Serena Pallecchi students of Computer Science University of Pisa (Italy)
- *                      Commission from Faunalia Pontedera (PI) www.faunalia.it
- *        Luca Delucchi and Duccio Rocchini, Fondazione Edmund Mach, Italy: r.li.pielou, r.li.renyi
- *
- *
- * This program is free software under the GPL (>=v2)
- * Read the COPYING file that comes with GRASS for details.
- * 
- * \version 1.1
- *
- */
-
-
- /* #################################################
-    ADD HERE INDEX DECLARATIONS
-    ################################################# */
-
-
-
- /**
-  * \brief calculate patch density index on selected area
-  * the abstract function is patch_density= patch_number / area
-  */
-int patch_density(int fd, char **par, struct area_entry *ad, double *result);
-
-int patch_number(int fd, char **par, struct area_entry *ad, double *result);
-int shape_index(int fd, char **par, struct area_entry *ad, double *result);
-int shannon(int fd, char **par, struct area_entry *ad, double *result);
-
-int pielou(int fd, char **par, struct area_entry *ad, double *result);
-int renyi(int fd, char **par, struct area_entry *ad, double *result);
-
-int simpson(int fd, char **par, struct area_entry *ad, double *result);
-int meanPatchSize(int fd, char **par, struct area_entry *ad, double *result);
-int meanPixelAttribute(int fd, char **par, struct area_entry *ad, double *result);
-int contrastWeightedEdgeDensity(int fd, char **par, struct area_entry *ad,
-				double *result);
-int edgedensity(int fd, char **valore, struct area_entry *ad, double *result);
-int patchAreaDistributionCV(int fd, char **par, struct area_entry *ad, double *result);
-int patchAreaDistributionMN(int fd, char **par, struct area_entry *ad, double *result);
-int patchAreaDistributionSD(int fd, char **par, struct area_entry *ad, double *result);
-int patchAreaDistributionRANGE(int fd, char **par, struct area_entry *ad,
-			       double *result);
-int dominance(int fd, char **par, struct area_entry *ad, double *result);
-int richness(int fd, char **par, struct area_entry *ad, double *result);

Modified: grass/trunk/raster/r.li/r.li.daemon/worker.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/worker.c	2014-02-18 20:27:24 UTC (rev 59090)
+++ grass/trunk/raster/r.li/r.li.daemon/worker.c	2014-02-18 21:01:41 UTC (rev 59091)
@@ -49,9 +49,9 @@
 static fcell_manager fm;
 static char *raster;
 static char **parameters;
-static int (*func) (int, char **, struct area_entry *, double *);
+static rli_func *func;
 
-void worker_init(char *r, int f(int, char **, struct area_entry *, double *), char **p)
+void worker_init(char *r, rli_func *f, char **p)
 {
     cm = G_malloc(sizeof(struct cell_memory_entry));
     fm = G_malloc(sizeof(struct fcell_memory_entry));



More information about the grass-commit mailing list