Ignore:
Timestamp:
May 31, 2011, 3:30:49 AM (13 years ago)
Author:
djay
Message:

Merge trunk r111:r216 into branch-1.2

Location:
branches/branch-1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1.2

  • branches/branch-1.2/zoo-kernel/service.h

    r109 r217  
    2828#pragma once
    2929
     30#ifdef WIN32
     31#define strncasecmp strnicmp
     32#define strcasecmp stricmp
     33#define snprintf sprintf_s
     34#endif
     35
    3036#ifdef __cplusplus
    3137extern "C" {
     
    5561#define SHMSZ     27
    5662
     63
     64  /**
     65   * \struct map
     66   * \brief KVP linked list
     67   *
     68   * Deal with WPS KVP (name,value).
     69   * A map is defined as:
     70   *  - name : a key,
     71   *  - value: a value,
     72   *  - next : a pointer to the next map if any.
     73   */
     74  typedef struct map{
     75    char* name;
     76    char* value;
     77    struct map* next;
     78  } map;
     79
     80#ifdef WIN32
     81#define NULLMAP ((map*) 0)
     82#else
     83#define NULLMAP NULL
     84#endif
     85
    5786  /**
    5887   * \struct maps
     
    6089   *
    6190   * Small object to store WPS KVP set.
     91   * Maps is defined as:
     92   *  - a name,
     93   *  - a content map,
     94   *  - a pointer to the next maps if any.
    6295   */
    6396  typedef struct maps{
     
    68101
    69102  /**
    70    * \struct map
    71    * \brief KVP linked list
    72    *
    73    * Deal with WPS KVP (name,value).
     103   * \brief Dump a map on stderr
    74104   */
    75   typedef struct map{
    76     char* name;       /* The key */
    77     char* value;      /* The value */
    78     struct map* next; /* Next couple */
    79   } map;
    80 
    81 #ifdef WIN32
    82 #define NULLMAP ((map*) 0)
    83 #else
    84 #define NULLMAP NULL
    85 #endif
    86 
    87105  static void _dumpMap(map* t){
    88106    if(t!=NULL){
     
    181199  }
    182200
    183   static map* getMapFromMaps(maps* m,char* key,char* subkey){
     201  static map* getLastMap(map* m){
     202    map* tmp=m;
     203    while(tmp!=NULL){
     204      if(tmp->next==NULL){
     205        return tmp;
     206      }
     207      tmp=tmp->next;
     208    }
     209    return NULL;
     210  }
     211
     212  static map* getMapFromMaps(maps* m,const char* key,const char* subkey){
    184213    maps* _tmpm=getMaps(m,key);
    185214    if(_tmpm!=NULL){
     
    189218    else return NULL;
    190219  }
     220
     221  static char* getMapsAsKVP(maps* m,int length,int type){
     222    char *dataInputsKVP=(char*) malloc(length*sizeof(char));
     223    maps* curs=m;
     224    int i=0;
     225    while(curs!=NULL){
     226      if(i==0)
     227        if(type==0)
     228          sprintf(dataInputsKVP,"%s=",curs->name);
     229        else
     230          sprintf(dataInputsKVP,"%s",curs->name);
     231      else{
     232        char *temp=strdup(dataInputsKVP);
     233        if(type==0)
     234          sprintf(dataInputsKVP,"%s;%s=",temp,curs->name);
     235        else
     236          sprintf(dataInputsKVP,"%s;%s",temp,curs->name);
     237        free(temp);
     238      }
     239      map* icurs=curs->content;
     240      if(type==0){
     241        map* tmp=getMap(curs->content,"value");
     242        char *temp=strdup(dataInputsKVP);
     243        if(getMap(m->content,"xlink:href")!=NULL)
     244          sprintf(dataInputsKVP,"%sReference",temp);
     245        else
     246          sprintf(dataInputsKVP,"%s%s",temp,icurs->value);
     247        free(temp);
     248      }
     249      int j=0;
     250      while(icurs!=NULL){
     251        if(strcasecmp(icurs->name,"value")!=0 &&
     252           strcasecmp(icurs->name,"Reference")!=0 &&
     253           strcasecmp(icurs->name,"minOccurs")!=0 &&
     254           strcasecmp(icurs->name,"maxOccurs")!=0 &&
     255           strcasecmp(icurs->name,"inRequest")!=0){
     256          char *itemp=strdup(dataInputsKVP);
     257          sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value);
     258          free(itemp);
     259        }
     260        icurs=icurs->next;
     261      }
     262      curs=curs->next;
     263      i++;
     264    }
     265    return dataInputsKVP;
     266  }
     267
    191268
    192269  static void freeMap(map** mo){
     
    224301  }
    225302
     303  /**
     304   * \brief Not named linked list
     305   *
     306   * Used to store informations about formats, such as mimeType, encoding ...
     307   *
     308   * An iotype is defined as :
     309   *  - a content map,
     310   *  - a pointer to the next iotype if any.
     311   */
    226312  typedef struct iotype{
    227313    struct map* content;
     
    229315  } iotype;
    230316
     317  /**
     318   * \brief Metadata information about input or output.
     319   *
     320   * The elements are used to store metadata informations defined in the ZCFG.
     321   *
     322   * An elements is defined as :
     323   *  - a name,
     324   *  - a content map,
     325   *  - a metadata map,
     326   *  - a format (possible values are LiteralData, ComplexData or
     327   * BoundingBoxData),
     328   *  - a default iotype,
     329   *  - a pointer to the next elements id any.
     330   */
    231331  typedef struct elements{
    232332    char* name;
     
    252352  } services;
    253353
    254   static bool hasElement(elements* e,char* key){
     354  static bool hasElement(elements* e,const char* key){
    255355    elements* tmp=e;
    256356    while(tmp!=NULL){
     
    476576
    477577
    478   static void setMapInMaps(maps* m,char* key,char* subkey,char *value){
     578  static void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){
    479579    maps* _tmpm=getMaps(m,key);
    480580    if(_tmpm!=NULL){
    481581      map* _ztmpm=getMap(_tmpm->content,subkey);
    482582      if(_ztmpm!=NULL){
    483         free(_ztmpm->value);
     583        if(_ztmpm->value!=NULL)
     584          free(_ztmpm->value);
    484585        _ztmpm->value=strdup(value);
    485586      }else{
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