Index: trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- trunk/zoo-project/zoo-kernel/service.h	(revision 576)
+++ trunk/zoo-project/zoo-kernel/service.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -60,10 +60,31 @@
 }
 #else
+/**
+ * The crossplatform strdup alias
+ */
 #define zStrdup strdup
+/**
+ * The crossplatform mkdir alias
+ */
 #define zMkdir mkdir
+/**
+ * The crossplatform open alias
+ */
 #define zOpen open
+/**
+ * The crossplatform write alias
+ */
 #define zWrite write
+/**
+ * The crossplatform sleep alias
+ */
 #define zSleep sleep
+/**
+ * The crossplatform gettimeofday alias
+ */
 #define zGettimeofday gettimeofday
+/**
+ * The crossplatform timeval alias
+ */
 #define ztimeval timeval
 #endif 
@@ -87,19 +108,55 @@
 #endif
 #ifndef true
+  /**
+   * Local true definition
+   */
 #define true 1
+  /**
+   * Local false definition
+   */
 #define false -1
 #endif
 #endif
 
+/**
+ * The global accepted status for a service
+ */
 #define SERVICE_ACCEPTED 0
+/**
+ * The global started status for a service
+ */
 #define SERVICE_STARTED 1
+/**
+ * The global paused status for a service
+ */
 #define SERVICE_PAUSED 2
+/**
+ * The global succeeded status for a service
+ */
 #define SERVICE_SUCCEEDED 3
+/**
+ * The global failed status for a service
+ */
 #define SERVICE_FAILED 4
 
+/**
+ * The memory size to create an elements
+ */
 #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*2)+sizeof(char*)+(((2*sizeof(char*))+sizeof(iotype*))*2)+sizeof(elements*))
+/**
+ * The memory size to create a map
+ */
 #define MAP_SIZE (2*sizeof(char*))+sizeof(NULL)
+/**
+ * The memory size to create an iotype
+ */
 #define IOTYPE_SIZE MAP_SIZE+sizeof(NULL)
+/**
+ * The memory size to create a maps
+ */
 #define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE
+/**
+ * The memory size to create a service
+ */
 #define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
 
@@ -116,6 +173,5 @@
 
   /**
-   * \struct map
-   * \brief KVP linked list
+   * KVP linked list
    *
    * Deal with WPS KVP (name,value).
@@ -138,6 +194,5 @@
 
   /**
-   * \struct maps
-   * \brief linked list of map pointer
+   * linked list of map pointer
    *
    * Small object to store WPS KVP set.
@@ -154,5 +209,7 @@
 
   /**
-   * \brief Dump a map on stderr
+   * Dump a map on stderr
+   *
+   * @param t the map to dump
    */
   static void _dumpMap(map* t){
@@ -166,4 +223,9 @@
   }
 
+  /**
+   * Dump a map on stderr, see _dumpMap()
+   *
+   * @param t the map to dump
+   */
   static void dumpMap(map* t){
     map* tmp=t;
@@ -174,4 +236,10 @@
   }
 
+  /**
+   * Dump a map to a file
+   *
+   * @param t the map to dump to file
+   * @param file the file to store the map
+   */
   static void dumpMapToFile(map* t,FILE* file){
     map* tmp=t;
@@ -185,4 +253,9 @@
   }
 
+  /**
+   * Dump a maps on stderr, see dumpMap().
+   *
+   * @param m the map to dump
+   */
   static void dumpMaps(maps* m){
     maps* tmp=m;
@@ -194,4 +267,10 @@
   }
 
+  /**
+   * Dump a maps to a file, see dumpMapToFile().
+   *
+   * @param m the map to dump
+   * @param file_path the full path to the file name to store the map
+   */
   static void dumpMapsToFile(maps* m,char* file_path){
     FILE* file=fopen(file_path,"w");
@@ -205,4 +284,11 @@
   }
 
+  /**
+   * Create a new map
+   *
+   * @param name the key to add to the map
+   * @param value the corresponding value to add to the map
+   * @return the allocated map
+   */
   static map* createMap(const char* name,const char* value){
     map* tmp=(map *)malloc(MAP_SIZE);
@@ -213,4 +299,10 @@
   }
 
+  /**
+   * Count number of map in a map
+   *
+   * @param m the maps to count
+   * @return number of map in a map
+   */
   static int count(map* m){
     map* tmp=m;
@@ -223,4 +315,11 @@
   }
     
+  /**
+   * Verify if a key exist in a map
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @return true if the key wwas found, false in other case
+   */
   static bool hasKey(map* m,const char *key){
     map* tmp=m;
@@ -236,4 +335,11 @@
   }
 
+  /**
+   * Access a specific maps
+   *
+   * @param m the maps to search for the key
+   * @param key the key to search in the maps
+   * @return a pointer on the maps found or NULL if not found
+   */
   static maps* getMaps(maps* m,const char *key){
     maps* tmp=m;
@@ -247,4 +353,11 @@
   }
 
+  /**
+   * Access a specific map
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMap(map* m,const char *key){
     map* tmp=m;
@@ -259,4 +372,10 @@
 
 
+  /**
+   * Access the last map
+   *
+   * @param m the map to search for the lastest map
+   * @return a pointer on the lastest map found or NULL if not found
+   */
   static map* getLastMap(map* m){
     map* tmp=m;
@@ -270,4 +389,12 @@
   }
 
+  /**
+   * Access a specific map from a maps
+   *
+   * @param m the maps to search for the key
+   * @param key the key to search in the maps
+   * @param subkey the key to search in the map (found for the key, if any)
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapFromMaps(maps* m,const char* key,const char* subkey){
     maps* _tmpm=getMaps(m,key);
@@ -279,5 +406,10 @@
   }
 
-
+  /**
+   * Free allocated memory of a map.
+   * Require to call free on mo after calling this function.
+   *
+   * @param mo the map to free
+   */
   static void freeMap(map** mo){
     map* _cursor=*mo;
@@ -295,4 +427,10 @@
   }
 
+  /**
+   * Free allocated memory of a maps.
+   * Require to call free on mo after calling this function.
+   *
+   * @param mo the maps to free
+   */
   static void freeMaps(maps** mo){
     maps* _cursor=*mo;
@@ -314,5 +452,5 @@
 
   /**
-   * \brief Not named linked list
+   * Not named linked list
    *
    * Used to store informations about formats, such as mimeType, encoding ... 
@@ -328,9 +466,9 @@
 
   /**
-   * \brief Metadata information about input or output.
+   * Metadata information about input or output.
    *
    * The elements are used to store metadata informations defined in the ZCFG.
    *
-   * An elements is defined as :
+   * An elements is defined as:
    *  - a name,
    *  - a content map,
@@ -351,4 +489,14 @@
   } elements;
 
+  /**
+   * Metadata informations about a full Service.
+   *
+   * An element is defined as:
+   *  - a name,
+   *  - a content map,
+   *  - a metadata map,
+   *  - an inputs elements
+   *  - an outputs elements
+   */
   typedef struct service{
     char* name;
@@ -359,4 +507,7 @@
   } service;
 
+  /**
+   * Multiple services chained list.
+   */
   typedef struct services{
     struct service* content; 
@@ -364,4 +515,11 @@
   } services;
 
+  /**
+   * Verify if an elements contains a name equal to the given key.
+   *
+   * @param e the elements to search for the key
+   * @param key the elements name to search
+   * @return true if the elements contains the name, false in other cases.
+   */ 
   static bool hasElement(elements* e,const char* key){
     elements* tmp=e;
@@ -374,4 +532,11 @@
   }
 
+  /**
+   * Access a specific elements named key.
+   *
+   * @param m the elements to search
+   * @param key the elements name to search
+   * @return a pointer to the specific element if found, NULL in other case.
+   */ 
   static elements* getElements(elements* m,char *key){
     elements* tmp=m;
@@ -384,5 +549,10 @@
   }
 
-
+  /**
+   * Free allocated memory of an iotype.
+   * Require to call free on i after calling this function.
+   *
+   * @param i the iotype to free
+   */
   static void freeIOType(iotype** i){
     iotype* _cursor=*i;
@@ -397,4 +567,10 @@
   }
 
+  /**
+   * Free allocated memory of an elements.
+   * Require to call free on e after calling this function.
+   *
+   * @param e the iotype to free
+   */
   static void freeElements(elements** e){
     elements* tmp=*e;
@@ -423,4 +599,10 @@
   }
 
+  /**
+   * Free allocated memory of a service.
+   * Require to call free on e after calling this function.
+   *
+   * @param s the service to free
+   */
   static void freeService(service** s){
     service* tmp=*s;
@@ -443,4 +625,11 @@
   }
 
+  /**
+   * Add key value pair to an existing map.
+   *
+   * @param m the map to add the KVP
+   * @param n the key to add
+   * @param v the corresponding value to add
+   */
   static void addToMap(map* m,const char* n,const char* v){
     if(hasKey(m,n)==false){
@@ -459,4 +648,12 @@
   }
 
+  /**
+   * Add a key and a binary value to an existing map.
+   *
+   * @param m the map to add the KVP
+   * @param n the key to add
+   * @param v the corresponding value to add
+   * @param size the size of the given value
+   */
   static void addToMapWithSize(map* m,const char* n,const char* v,int size){
     if(hasKey(m,n)==false){
@@ -479,4 +676,10 @@
   }
 
+  /**
+   * Add a map at the end of another map.
+   *
+   * @param mo the map to add mi
+   * @param mi the map to add to mo
+   */
   static void addMapToMap(map** mo,map* mi){
     map* tmp=mi;
@@ -511,4 +714,10 @@
   }
 
+  /**
+   * Add a map to iotype.
+   *
+   * @param io the iotype to add the map
+   * @param mi the map to add to io
+   */
   static void addMapToIoType(iotype** io,map* mi){
     iotype* tmp=*io;
@@ -522,4 +731,12 @@
   }
 
+  /**
+   * Access a specific map or set its value.
+   *
+   * @param m the map to search for the key
+   * @param key the key to search/add in the map
+   * @param value the value to add if the key does not exist
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapOrFill(map** m,const char *key,const char* value){
     map* tmp=*m;
@@ -536,4 +753,11 @@
   }
 
+  /**
+   * Verify if a map is contained in another map.
+   *
+   * @param m the map to search for i
+   * @param i the map to search in m
+   * @return true if i was found in m, false in other case
+   */
   static bool contains(map* m,map* i){
     while(i!=NULL){      
@@ -552,4 +776,13 @@
   }
 
+  /**
+   * Access a specific iotype from an elements.
+   *
+   * @param e the elements to search for the name
+   * @param name the name to search in the elements e
+   * @param values the map to verify it was contained in the defaults or 
+   *  supported content of the elements e
+   * @return a pointer on the iotype found or NULL if not found
+   */
   static iotype* getIoTypeFromElement(elements* e,char *name, map* values){
     elements* cursor=e;
@@ -572,4 +805,11 @@
   }
 
+  /**
+   * Load binary values from a map (in) and add them to another map (out)
+   *
+   * @param out the map to add binaries values
+   * @param in the map containing the binary values to add ti out
+   * @param pos index of the binary in an array (in case of "MapArray")
+   */
   static void loadMapBinary(map** out,map* in,int pos){
     map* size=getMap(in,"size");
@@ -598,4 +838,12 @@
   }
   
+  /**
+   * Load binary values from a map (in) and add them to another map (out).
+   * This function will take care of MapArray.
+   * @see loadMapBinary
+   *
+   * @param out the map to add binaries values
+   * @param in the map containing the binary values to add ti out
+   */
   static void loadMapBinaries(map** out,map* in){
     map* size=getMap(in,"size");
@@ -613,4 +861,10 @@
   }
 
+  /**
+   * Duplicate a Maps
+   * 
+   * @param mo the maps to clone
+   * @return the allocated maps containing a copy of the mo maps
+   */
   static maps* dupMaps(maps** mo){
     maps* _cursor=*mo;
@@ -631,4 +885,11 @@
   }
 
+  /**
+   * Add a maps at the end of another maps.
+   *
+   * @see addMapToMap, dupMaps, getMaps
+   * @param mo the maps to add mi
+   * @param mi the maps to add to mo
+   */
   static void addMapsToMaps(maps** mo,maps* mi){
     maps* tmp=mi;
@@ -652,4 +913,12 @@
   }
 
+  /**
+   * Access a specific map array element
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @param index of the MapArray 
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapArray(map* m,const char* key,int index){
     char tmp[1024];
@@ -670,4 +939,13 @@
 
 
+  /**
+   * Add a key value in a MapArray for a specific index
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @param index the index of the MapArray 
+   * @param value the value to set in the MapArray 
+   * @return a pointer on the map found or NULL if not found
+   */
   static void setMapArray(map* m,const char* key,int index,const char* value){
     char tmp[1024];
@@ -697,4 +975,11 @@
   }
 
+  /**
+   * Access the map "type"
+   *
+   * @param mt the map
+   * @return a pointer on the map for mimeType/dataType/CRS if found, NULL in
+   *  other case
+   */
   static map* getMapType(map* mt){
     map* tmap=getMap(mt,(char *)"mimeType");
@@ -711,4 +996,13 @@
   }
 
+  /**
+   * Add a Maps containing a MapArray to a Maps
+   *
+   * @see getMapType
+   * @param mo the maps
+   * @param mi the maps
+   * @param typ the map "type"
+   * @return 
+   */
   static int addMapsArrayToMaps(maps** mo,maps* mi,char* typ){
     maps* tmp=mi;    
@@ -759,4 +1053,12 @@
   }
 
+  /**
+   * Set a key value pair to a map contained in a Maps
+   *
+   * @param m the maps
+   * @param key the maps name
+   * @param subkey the map name included in the maps corresponding to key
+   * @param value the corresponding value to add in the map
+   */
   static void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){
     maps* _tmpm=getMaps(m,key);
@@ -787,5 +1089,9 @@
   }
 
-
+  /**
+   * Dump an elements on stderr
+   *
+   * @param e the elements to dump
+   */
   static void dumpElements(elements* e){
     elements* tmp=e;
@@ -818,4 +1124,9 @@
   }
 
+  /**
+   * Dump an elements on stderr using the YAML syntaxe
+   *
+   * @param e the elements to dump
+   */
   static void dumpElementsAsYAML(elements* e){
     elements* tmp=e;
@@ -889,5 +1200,10 @@
   }
 
-
+  /**
+   * Duplicate an elements
+   * 
+   * @param e the elements to clone
+   * @return the allocated elements containing a copy of the elements e
+   */
   static elements* dupElements(elements* e){
     elements* cursor=e;
@@ -939,4 +1255,11 @@
   }
 
+  /**
+   * Add an elements to another elements.
+   *
+   * @see dupElements
+   * @param m the elements to add the e
+   * @param e the elements to be added to m
+   */
   static void addToElements(elements** m,elements* e){
     elements* tmp=e;
@@ -948,4 +1271,9 @@
   }
 
+  /**
+   * Dump a service on stderr
+   *
+   * @param s the service to dump
+   */
   static void dumpService(service* s){
     fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name);
@@ -967,4 +1295,9 @@
   }
 
+  /**
+   * Dump a service on stderr using the YAML syntaxe
+   *
+   * @param s the service to dump
+   */
   static void dumpServiceAsYAML(service* s){
     int i;
@@ -994,4 +1327,10 @@
   }
 
+  /**
+   * Convert a maps to a char*** (only used for Fortran support)
+   *
+   * @param m the maps to convert
+   * @param c the resulting array
+   */
   static void mapsToCharXXX(maps* m,char*** c){
     maps* tm=m;
@@ -1024,4 +1363,10 @@
   }
 
+  /**
+   * Convert a char*** to a maps (only used for Fortran support)
+   *
+   * @param c the array to convert
+   * @param m the resulting maps
+   */
   static void charxxxToMaps(char*** c,maps**m){
     maps* trorf=*m;
