Ignore:
Timestamp:
Feb 12, 2015, 5:01:11 PM (9 years ago)
Author:
djay
Message:

Add initial doxygen comments in some C files, for future documentation generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service.h

    r576 r579  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    6060}
    6161#else
     62/**
     63 * The crossplatform strdup alias
     64 */
    6265#define zStrdup strdup
     66/**
     67 * The crossplatform mkdir alias
     68 */
    6369#define zMkdir mkdir
     70/**
     71 * The crossplatform open alias
     72 */
    6473#define zOpen open
     74/**
     75 * The crossplatform write alias
     76 */
    6577#define zWrite write
     78/**
     79 * The crossplatform sleep alias
     80 */
    6681#define zSleep sleep
     82/**
     83 * The crossplatform gettimeofday alias
     84 */
    6785#define zGettimeofday gettimeofday
     86/**
     87 * The crossplatform timeval alias
     88 */
    6889#define ztimeval timeval
    6990#endif
     
    87108#endif
    88109#ifndef true
     110  /**
     111   * Local true definition
     112   */
    89113#define true 1
     114  /**
     115   * Local false definition
     116   */
    90117#define false -1
    91118#endif
    92119#endif
    93120
     121/**
     122 * The global accepted status for a service
     123 */
    94124#define SERVICE_ACCEPTED 0
     125/**
     126 * The global started status for a service
     127 */
    95128#define SERVICE_STARTED 1
     129/**
     130 * The global paused status for a service
     131 */
    96132#define SERVICE_PAUSED 2
     133/**
     134 * The global succeeded status for a service
     135 */
    97136#define SERVICE_SUCCEEDED 3
     137/**
     138 * The global failed status for a service
     139 */
    98140#define SERVICE_FAILED 4
    99141
     142/**
     143 * The memory size to create an elements
     144 */
    100145#define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*2)+sizeof(char*)+(((2*sizeof(char*))+sizeof(iotype*))*2)+sizeof(elements*))
     146/**
     147 * The memory size to create a map
     148 */
    101149#define MAP_SIZE (2*sizeof(char*))+sizeof(NULL)
     150/**
     151 * The memory size to create an iotype
     152 */
    102153#define IOTYPE_SIZE MAP_SIZE+sizeof(NULL)
     154/**
     155 * The memory size to create a maps
     156 */
    103157#define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE
     158/**
     159 * The memory size to create a service
     160 */
    104161#define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
    105162
     
    116173
    117174  /**
    118    * \struct map
    119    * \brief KVP linked list
     175   * KVP linked list
    120176   *
    121177   * Deal with WPS KVP (name,value).
     
    138194
    139195  /**
    140    * \struct maps
    141    * \brief linked list of map pointer
     196   * linked list of map pointer
    142197   *
    143198   * Small object to store WPS KVP set.
     
    154209
    155210  /**
    156    * \brief Dump a map on stderr
     211   * Dump a map on stderr
     212   *
     213   * @param t the map to dump
    157214   */
    158215  static void _dumpMap(map* t){
     
    166223  }
    167224
     225  /**
     226   * Dump a map on stderr, see _dumpMap()
     227   *
     228   * @param t the map to dump
     229   */
    168230  static void dumpMap(map* t){
    169231    map* tmp=t;
     
    174236  }
    175237
     238  /**
     239   * Dump a map to a file
     240   *
     241   * @param t the map to dump to file
     242   * @param file the file to store the map
     243   */
    176244  static void dumpMapToFile(map* t,FILE* file){
    177245    map* tmp=t;
     
    185253  }
    186254
     255  /**
     256   * Dump a maps on stderr, see dumpMap().
     257   *
     258   * @param m the map to dump
     259   */
    187260  static void dumpMaps(maps* m){
    188261    maps* tmp=m;
     
    194267  }
    195268
     269  /**
     270   * Dump a maps to a file, see dumpMapToFile().
     271   *
     272   * @param m the map to dump
     273   * @param file_path the full path to the file name to store the map
     274   */
    196275  static void dumpMapsToFile(maps* m,char* file_path){
    197276    FILE* file=fopen(file_path,"w");
     
    205284  }
    206285
     286  /**
     287   * Create a new map
     288   *
     289   * @param name the key to add to the map
     290   * @param value the corresponding value to add to the map
     291   * @return the allocated map
     292   */
    207293  static map* createMap(const char* name,const char* value){
    208294    map* tmp=(map *)malloc(MAP_SIZE);
     
    213299  }
    214300
     301  /**
     302   * Count number of map in a map
     303   *
     304   * @param m the maps to count
     305   * @return number of map in a map
     306   */
    215307  static int count(map* m){
    216308    map* tmp=m;
     
    223315  }
    224316   
     317  /**
     318   * Verify if a key exist in a map
     319   *
     320   * @param m the map to search for the key
     321   * @param key the key to search in the map
     322   * @return true if the key wwas found, false in other case
     323   */
    225324  static bool hasKey(map* m,const char *key){
    226325    map* tmp=m;
     
    236335  }
    237336
     337  /**
     338   * Access a specific maps
     339   *
     340   * @param m the maps to search for the key
     341   * @param key the key to search in the maps
     342   * @return a pointer on the maps found or NULL if not found
     343   */
    238344  static maps* getMaps(maps* m,const char *key){
    239345    maps* tmp=m;
     
    247353  }
    248354
     355  /**
     356   * Access a specific map
     357   *
     358   * @param m the map to search for the key
     359   * @param key the key to search in the map
     360   * @return a pointer on the map found or NULL if not found
     361   */
    249362  static map* getMap(map* m,const char *key){
    250363    map* tmp=m;
     
    259372
    260373
     374  /**
     375   * Access the last map
     376   *
     377   * @param m the map to search for the lastest map
     378   * @return a pointer on the lastest map found or NULL if not found
     379   */
    261380  static map* getLastMap(map* m){
    262381    map* tmp=m;
     
    270389  }
    271390
     391  /**
     392   * Access a specific map from a maps
     393   *
     394   * @param m the maps to search for the key
     395   * @param key the key to search in the maps
     396   * @param subkey the key to search in the map (found for the key, if any)
     397   * @return a pointer on the map found or NULL if not found
     398   */
    272399  static map* getMapFromMaps(maps* m,const char* key,const char* subkey){
    273400    maps* _tmpm=getMaps(m,key);
     
    279406  }
    280407
    281 
     408  /**
     409   * Free allocated memory of a map.
     410   * Require to call free on mo after calling this function.
     411   *
     412   * @param mo the map to free
     413   */
    282414  static void freeMap(map** mo){
    283415    map* _cursor=*mo;
     
    295427  }
    296428
     429  /**
     430   * Free allocated memory of a maps.
     431   * Require to call free on mo after calling this function.
     432   *
     433   * @param mo the maps to free
     434   */
    297435  static void freeMaps(maps** mo){
    298436    maps* _cursor=*mo;
     
    314452
    315453  /**
    316    * \brief Not named linked list
     454   * Not named linked list
    317455   *
    318456   * Used to store informations about formats, such as mimeType, encoding ...
     
    328466
    329467  /**
    330    * \brief Metadata information about input or output.
     468   * Metadata information about input or output.
    331469   *
    332470   * The elements are used to store metadata informations defined in the ZCFG.
    333471   *
    334    * An elements is defined as :
     472   * An elements is defined as:
    335473   *  - a name,
    336474   *  - a content map,
     
    351489  } elements;
    352490
     491  /**
     492   * Metadata informations about a full Service.
     493   *
     494   * An element is defined as:
     495   *  - a name,
     496   *  - a content map,
     497   *  - a metadata map,
     498   *  - an inputs elements
     499   *  - an outputs elements
     500   */
    353501  typedef struct service{
    354502    char* name;
     
    359507  } service;
    360508
     509  /**
     510   * Multiple services chained list.
     511   */
    361512  typedef struct services{
    362513    struct service* content;
     
    364515  } services;
    365516
     517  /**
     518   * Verify if an elements contains a name equal to the given key.
     519   *
     520   * @param e the elements to search for the key
     521   * @param key the elements name to search
     522   * @return true if the elements contains the name, false in other cases.
     523   */
    366524  static bool hasElement(elements* e,const char* key){
    367525    elements* tmp=e;
     
    374532  }
    375533
     534  /**
     535   * Access a specific elements named key.
     536   *
     537   * @param m the elements to search
     538   * @param key the elements name to search
     539   * @return a pointer to the specific element if found, NULL in other case.
     540   */
    376541  static elements* getElements(elements* m,char *key){
    377542    elements* tmp=m;
     
    384549  }
    385550
    386 
     551  /**
     552   * Free allocated memory of an iotype.
     553   * Require to call free on i after calling this function.
     554   *
     555   * @param i the iotype to free
     556   */
    387557  static void freeIOType(iotype** i){
    388558    iotype* _cursor=*i;
     
    397567  }
    398568
     569  /**
     570   * Free allocated memory of an elements.
     571   * Require to call free on e after calling this function.
     572   *
     573   * @param e the iotype to free
     574   */
    399575  static void freeElements(elements** e){
    400576    elements* tmp=*e;
     
    423599  }
    424600
     601  /**
     602   * Free allocated memory of a service.
     603   * Require to call free on e after calling this function.
     604   *
     605   * @param s the service to free
     606   */
    425607  static void freeService(service** s){
    426608    service* tmp=*s;
     
    443625  }
    444626
     627  /**
     628   * Add key value pair to an existing map.
     629   *
     630   * @param m the map to add the KVP
     631   * @param n the key to add
     632   * @param v the corresponding value to add
     633   */
    445634  static void addToMap(map* m,const char* n,const char* v){
    446635    if(hasKey(m,n)==false){
     
    459648  }
    460649
     650  /**
     651   * Add a key and a binary value to an existing map.
     652   *
     653   * @param m the map to add the KVP
     654   * @param n the key to add
     655   * @param v the corresponding value to add
     656   * @param size the size of the given value
     657   */
    461658  static void addToMapWithSize(map* m,const char* n,const char* v,int size){
    462659    if(hasKey(m,n)==false){
     
    479676  }
    480677
     678  /**
     679   * Add a map at the end of another map.
     680   *
     681   * @param mo the map to add mi
     682   * @param mi the map to add to mo
     683   */
    481684  static void addMapToMap(map** mo,map* mi){
    482685    map* tmp=mi;
     
    511714  }
    512715
     716  /**
     717   * Add a map to iotype.
     718   *
     719   * @param io the iotype to add the map
     720   * @param mi the map to add to io
     721   */
    513722  static void addMapToIoType(iotype** io,map* mi){
    514723    iotype* tmp=*io;
     
    522731  }
    523732
     733  /**
     734   * Access a specific map or set its value.
     735   *
     736   * @param m the map to search for the key
     737   * @param key the key to search/add in the map
     738   * @param value the value to add if the key does not exist
     739   * @return a pointer on the map found or NULL if not found
     740   */
    524741  static map* getMapOrFill(map** m,const char *key,const char* value){
    525742    map* tmp=*m;
     
    536753  }
    537754
     755  /**
     756   * Verify if a map is contained in another map.
     757   *
     758   * @param m the map to search for i
     759   * @param i the map to search in m
     760   * @return true if i was found in m, false in other case
     761   */
    538762  static bool contains(map* m,map* i){
    539763    while(i!=NULL){     
     
    552776  }
    553777
     778  /**
     779   * Access a specific iotype from an elements.
     780   *
     781   * @param e the elements to search for the name
     782   * @param name the name to search in the elements e
     783   * @param values the map to verify it was contained in the defaults or
     784   *  supported content of the elements e
     785   * @return a pointer on the iotype found or NULL if not found
     786   */
    554787  static iotype* getIoTypeFromElement(elements* e,char *name, map* values){
    555788    elements* cursor=e;
     
    572805  }
    573806
     807  /**
     808   * Load binary values from a map (in) and add them to another map (out)
     809   *
     810   * @param out the map to add binaries values
     811   * @param in the map containing the binary values to add ti out
     812   * @param pos index of the binary in an array (in case of "MapArray")
     813   */
    574814  static void loadMapBinary(map** out,map* in,int pos){
    575815    map* size=getMap(in,"size");
     
    598838  }
    599839 
     840  /**
     841   * Load binary values from a map (in) and add them to another map (out).
     842   * This function will take care of MapArray.
     843   * @see loadMapBinary
     844   *
     845   * @param out the map to add binaries values
     846   * @param in the map containing the binary values to add ti out
     847   */
    600848  static void loadMapBinaries(map** out,map* in){
    601849    map* size=getMap(in,"size");
     
    613861  }
    614862
     863  /**
     864   * Duplicate a Maps
     865   *
     866   * @param mo the maps to clone
     867   * @return the allocated maps containing a copy of the mo maps
     868   */
    615869  static maps* dupMaps(maps** mo){
    616870    maps* _cursor=*mo;
     
    631885  }
    632886
     887  /**
     888   * Add a maps at the end of another maps.
     889   *
     890   * @see addMapToMap, dupMaps, getMaps
     891   * @param mo the maps to add mi
     892   * @param mi the maps to add to mo
     893   */
    633894  static void addMapsToMaps(maps** mo,maps* mi){
    634895    maps* tmp=mi;
     
    652913  }
    653914
     915  /**
     916   * Access a specific map array element
     917   *
     918   * @param m the map to search for the key
     919   * @param key the key to search in the map
     920   * @param index of the MapArray
     921   * @return a pointer on the map found or NULL if not found
     922   */
    654923  static map* getMapArray(map* m,const char* key,int index){
    655924    char tmp[1024];
     
    670939
    671940
     941  /**
     942   * Add a key value in a MapArray for a specific index
     943   *
     944   * @param m the map to search for the key
     945   * @param key the key to search in the map
     946   * @param index the index of the MapArray
     947   * @param value the value to set in the MapArray
     948   * @return a pointer on the map found or NULL if not found
     949   */
    672950  static void setMapArray(map* m,const char* key,int index,const char* value){
    673951    char tmp[1024];
     
    697975  }
    698976
     977  /**
     978   * Access the map "type"
     979   *
     980   * @param mt the map
     981   * @return a pointer on the map for mimeType/dataType/CRS if found, NULL in
     982   *  other case
     983   */
    699984  static map* getMapType(map* mt){
    700985    map* tmap=getMap(mt,(char *)"mimeType");
     
    711996  }
    712997
     998  /**
     999   * Add a Maps containing a MapArray to a Maps
     1000   *
     1001   * @see getMapType
     1002   * @param mo the maps
     1003   * @param mi the maps
     1004   * @param typ the map "type"
     1005   * @return
     1006   */
    7131007  static int addMapsArrayToMaps(maps** mo,maps* mi,char* typ){
    7141008    maps* tmp=mi;   
     
    7591053  }
    7601054
     1055  /**
     1056   * Set a key value pair to a map contained in a Maps
     1057   *
     1058   * @param m the maps
     1059   * @param key the maps name
     1060   * @param subkey the map name included in the maps corresponding to key
     1061   * @param value the corresponding value to add in the map
     1062   */
    7611063  static void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){
    7621064    maps* _tmpm=getMaps(m,key);
     
    7871089  }
    7881090
    789 
     1091  /**
     1092   * Dump an elements on stderr
     1093   *
     1094   * @param e the elements to dump
     1095   */
    7901096  static void dumpElements(elements* e){
    7911097    elements* tmp=e;
     
    8181124  }
    8191125
     1126  /**
     1127   * Dump an elements on stderr using the YAML syntaxe
     1128   *
     1129   * @param e the elements to dump
     1130   */
    8201131  static void dumpElementsAsYAML(elements* e){
    8211132    elements* tmp=e;
     
    8891200  }
    8901201
    891 
     1202  /**
     1203   * Duplicate an elements
     1204   *
     1205   * @param e the elements to clone
     1206   * @return the allocated elements containing a copy of the elements e
     1207   */
    8921208  static elements* dupElements(elements* e){
    8931209    elements* cursor=e;
     
    9391255  }
    9401256
     1257  /**
     1258   * Add an elements to another elements.
     1259   *
     1260   * @see dupElements
     1261   * @param m the elements to add the e
     1262   * @param e the elements to be added to m
     1263   */
    9411264  static void addToElements(elements** m,elements* e){
    9421265    elements* tmp=e;
     
    9481271  }
    9491272
     1273  /**
     1274   * Dump a service on stderr
     1275   *
     1276   * @param s the service to dump
     1277   */
    9501278  static void dumpService(service* s){
    9511279    fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name);
     
    9671295  }
    9681296
     1297  /**
     1298   * Dump a service on stderr using the YAML syntaxe
     1299   *
     1300   * @param s the service to dump
     1301   */
    9691302  static void dumpServiceAsYAML(service* s){
    9701303    int i;
     
    9941327  }
    9951328
     1329  /**
     1330   * Convert a maps to a char*** (only used for Fortran support)
     1331   *
     1332   * @param m the maps to convert
     1333   * @param c the resulting array
     1334   */
    9961335  static void mapsToCharXXX(maps* m,char*** c){
    9971336    maps* tm=m;
     
    10241363  }
    10251364
     1365  /**
     1366   * Convert a char*** to a maps (only used for Fortran support)
     1367   *
     1368   * @param c the array to convert
     1369   * @param m the resulting maps
     1370   */
    10261371  static void charxxxToMaps(char*** c,maps**m){
    10271372    maps* trorf=*m;
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png