Changeset 580 for trunk/zoo-project


Ignore:
Timestamp:
Feb 12, 2015, 11:18:07 PM (6 years ago)
Author:
djay
Message:

Continue adding initial doxygen documentation.

Location:
trunk/zoo-project/zoo-kernel
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r579 r580  
    641641  }
    642642  return (char*)"-1";
    643 }
    644 
    645 #endif
    646 
    647 #ifdef USE_JS
    648 
    649 JSBool
    650 JSUpdateStatus(JSContext *cx, uintN argc, jsval *argv1)
    651 {
    652   jsval *argv = JS_ARGV(cx,argv1);
    653   JS_MaybeGC(cx);
    654   int istatus=0;
    655   char *status=NULL;
    656   maps *conf;
    657   if(argc>2){
    658 #ifdef JS_DEBUG
    659     fprintf(stderr,"Number of arguments used to call the function : %i",argc);
    660 #endif
    661     return JS_FALSE;
    662   }
    663   conf=mapsFromJSObject(cx,argv[0]);
    664   if(JS_ValueToInt32(cx,argv[1],&istatus)==JS_TRUE){
    665     char tmpStatus[4];
    666     sprintf(tmpStatus,"%i",istatus);
    667     tmpStatus[3]=0;
    668     status=strdup(tmpStatus);
    669   }
    670   if(getMapFromMaps(conf,"lenv","status")!=NULL){
    671     if(status!=NULL){
    672       setMapInMaps(conf,"lenv","status",status);
    673       free(status);
    674     }
    675     else
    676       setMapInMaps(conf,"lenv","status","15");
    677     _updateStatus(conf);
    678   }
    679   freeMaps(&conf);
    680   free(conf);
    681   JS_MaybeGC(cx);
    682   return JS_TRUE;
    683643}
    684644
  • trunk/zoo-project/zoo-kernel/service_internal.h

    r579 r580  
    168168
    169169#ifdef USE_JS
    170   char* JSValToChar(JSContext*,jsval*);
    171   JSBool JSUpdateStatus(JSContext*,uintN,jsval *);
    172170#endif
    173171 
  • trunk/zoo-project/zoo-kernel/service_internal_java.c

    r539 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    2525#include "service_internal_java.h"
    2626
     27/**
     28 * Load a JAVA class then run the static public method corresponding to the
     29 * service by passing the conf, inputs and outputs parameters by reference.
     30 *
     31 * @param main_conf the conf maps containing the main.cfg settings
     32 * @param request the map containing the HTTP request
     33 * @param s the service structure
     34 * @param real_inputs the maps containing the inputs
     35 * @param real_outputs the maps containing the outputs
     36 */
    2737int zoo_java_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
    2838  maps* m=*main_conf;
     
    249259/**
    250260 * Error handling: display stack trace in an ExceptionReport Document
     261 *
     262 * @param env the JNI environment pointer
     263 * @param main_conf the conf maps containing the main.cfg settings
    251264 */
    252265void displayStack(JNIEnv *env,maps* main_conf){
     
    287300}
    288301
     302/**
     303 * Create a string containing the JVM -XX:* option for a given map
     304 * Depending on the map' name:
     305 *  - in case the value is minus then the reult will be : -XX:-name
     306 *  - in case the value is plus then the reult will be : -XX:+name
     307 *  - in other cases the reult will be : -XX:name=value
     308 *
     309 * @param m the map containing the option
     310 * @return a char* containing the valide JVM option (-XX:*)
     311 */
    289312char *parseJVMXXOption(map* m){
    290313  char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+5)*sizeof(char));
     
    298321}
    299322
     323/**
     324 * Create a string containing the JVM -X*:* option for a given map.
     325 * The reult will be in the following format: -Xname:value
     326 *
     327 * @param m the map containing the option
     328 * @return a char* containing the valide JVM option (-XX:*)
     329 */
    300330char *parseJVMXOption(map* m){
    301331  char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+5)*sizeof(char));
     
    304334}
    305335
     336/**
     337 * Convert a maps to a JAVA HashMap<String,HashMap<String,String>>
     338 *
     339 * @param env the JNI environment pointer
     340 * @param t the maps to convert
     341 * @param scHashMapClass the HashMap class
     342 * @param scHashMap_class the HashMap class
     343 * @param scHashMap_constructor the pointer to the hashMap constructor method
     344 * @return a created JAVA HashMap containing the converted maps
     345 * @warning make sure to free ressources returned by this function
     346 */
    306347jobject HashMap_FromMaps(JNIEnv *env,maps* t,jclass scHashMapClass,jclass scHashMap_class,jmethodID scHashMap_constructor){
    307348  jobject scObject,scObject1;
     
    439480}
    440481
     482/**
     483 * Convert a JAVA HashMap<String,HashMap<String,String>> to a maps
     484 *
     485 * @param env the JNI environment pointer
     486 * @param t the HashMap
     487 * @param scHashMapClass the hashMap class
     488 * @return a created maps containing the converted HashMap
     489 * @warning make sure to free ressources returned by this function
     490 */
    441491maps* mapsFromHashMap(JNIEnv *env,jobject t,jclass scHashMapClass){
    442492#ifdef DEBUG
  • trunk/zoo-project/zoo-kernel/service_internal_java.h

    r539 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r576 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    3131static char dbg[1024];
    3232
     33/**
     34 * The function used as alert from the JavaScript environment (ZOO-API)
     35 *
     36 * @param cx the JavaScript context
     37 * @param argc the number of parameters
     38 * @param argv1 the parameter values
     39 * @return true
     40 */
    3341JSBool
    3442JSAlert(JSContext *cx, uintN argc, jsval *argv1)
     
    4856}
    4957
     58/**
     59 * The function used as importScript from the JavaScript environment (ZOO-API)
     60 *
     61 * @param cx the JavaScript context
     62 * @param argc the number of parameters
     63 * @param argv1 the parameter values
     64 * @return true
     65 */
    5066JSBool
    5167JSLoadScripts(JSContext *cx, uintN argc, jsval *argv1)
     
    7995}
    8096
    81 
    82 int zoo_js_support(maps** main_conf,map* request,service* s,
    83                    maps **inputs,maps **outputs)
     97/**
     98 * Load a JavaScript file then run the function corresponding to the service by
     99 * passing the conf, inputs and outputs parameters by value as JavaScript
     100 * Objects.
     101 *
     102 * @param main_conf the conf maps containing the main.cfg settings
     103 * @param request the map containing the HTTP request
     104 * @param s the service structure
     105 * @param inputs the maps containing the inputs
     106 * @param outputs the maps containing the outputs
     107 * @return ZOO_SERVICE_SUCCEEDED or ZOO_SERVICE_FAILED if the service run, -1
     108 *  if the service failed to load or throw error at runtime.
     109 */
     110int zoo_js_support(maps** main_conf,map* request,service* s,maps **inputs,maps **outputs)
    84111{
    85112  maps* main=*main_conf;
     
    355382}
    356383
     384/**
     385 * Load a JavaScript file
     386 *
     387 * @param cx the JavaScript context
     388 * @param globale the global JavaScript object (not used)
     389 * @param filename the file name to load
     390 * @return a JavaScript Object on success, NULL if an errro occured
     391 */
    357392JSObject * loadZooApiFile(JSContext *cx,JSObject  *global, char* filename){
    358393  struct stat api_status;
     
    381416}
    382417
     418/**
     419 * Convert a maps to a JavaScript Object
     420 *
     421 * @param cx the JavaScript context
     422 * @param t the maps to convert
     423 * @return a new JavaScript Object
     424 */
    383425JSObject* JSObject_FromMaps(JSContext *cx,maps* t){
    384 
    385426  JSObject* res=JS_NewObject(cx, NULL, NULL, NULL);
    386427  //JSObject *res = JS_NewArrayObject(cx, 0, NULL);
     
    402443}
    403444
     445/**
     446 * Convert a map to a JavaScript Object
     447 *
     448 * @param cx the JavaScript context
     449 * @param t the map to convert
     450 * @return a new JavaScript Object
     451 */
    404452JSObject* JSObject_FromMap(JSContext *cx,map* t){
    405453  JSObject* res=JS_NewObject(cx, NULL, NULL, NULL);
     
    454502}
    455503
     504/**
     505 * Convert a JavaScript Object to a maps
     506 *
     507 * @param cx the JavaScript context
     508 * @param t the JavaScript Object to convert
     509 * @return a new maps containing the JavaScript Object
     510 */
    456511maps* mapsFromJSObject(JSContext *cx,jsval t){
    457512  maps *res=NULL;
     
    629684}
    630685
     686/**
     687 * Convert a JavaScript Object to a map
     688 *
     689 * @param cx the JavaScript context
     690 * @param t the JavaScript Object to convert
     691 * @return a new map containing the JavaScript Object
     692 */
    631693map* mapFromJSObject(JSContext *cx,jsval t){
    632694  map *res=NULL;
     
    684746}
    685747
    686 /* The error reporter callback. */
     748/**
     749 * Print debug information messages on stderr
     750 *
     751 * @param cx the JavaScript context
     752 * @param message the error message
     753 * @param report the JavaScript Error Report
     754 */
    687755void reportError(JSContext *cx, const char *message, JSErrorReport *report)
    688756{
     
    697765}
    698766
     767/**
     768 * Convert a JavaScript value to a char*
     769 *
     770 * @param context the JavaScript context
     771 * @param arg the JavaScript value
     772 * @return a new char*
     773 * @warning be sure to free the ressources returned by this function
     774 */
    699775char* JSValToChar(JSContext* context, jsval* arg) {
    700776  char *c;
     
    724800}
    725801
     802/**
     803 * Set the HTTP header of a request
     804 *
     805 * @param handle the HINTERNET handle
     806 * @param cx the JavaScript context
     807 * @param header the JavaScript Array containing the headers to send
     808 * @return the HINTERNET handle
     809 */
    726810HINTERNET setHeader(HINTERNET* handle,JSContext *cx,JSObject *header){
    727811  jsuint length=0;
     
    758842}
    759843
     844/**
     845 * The function used as ZOOTranslate from the JavaScript environment.
     846 * Use the ZOO-Services messages translation function from the Python
     847 * environment (ZOO-API)
     848 *
     849 * @param cx the JavaScript context
     850 * @param argc the number of parameters
     851 * @param argv1 the parameter values
     852 * @return true
     853 */
    760854JSBool
    761855JSTranslate(JSContext *cx, uintN argc, jsval *argv1)
     
    769863}
    770864
     865/**
     866 * The function used as ZOORequest from the JavaScript environment (ZOO-API)
     867 *
     868 * @param cx the JavaScript context
     869 * @param argc the number of parameters
     870 * @param argv1 the parameter values
     871 * @return true
     872 * @see setHeader
     873 */
    771874JSBool
    772875JSRequest(JSContext *cx, uintN argc, jsval *argv1)
     
    847950  return JS_TRUE;
    848951}
     952
     953/**
     954 * The function used as ZOOUpdateStatus from the JavaScript environment
     955 * (ZOO-API).
     956 *
     957 * @param cx the JavaScript context
     958 * @param argc the number of parameters
     959 * @param argv1 the parameter values
     960 * @return true
     961 * @see setHeader
     962 */
     963JSBool
     964JSUpdateStatus(JSContext *cx, uintN argc, jsval *argv1)
     965{
     966  jsval *argv = JS_ARGV(cx,argv1);
     967  JS_MaybeGC(cx);
     968  int istatus=0;
     969  char *status=NULL;
     970  maps *conf;
     971  if(argc>2){
     972#ifdef JS_DEBUG
     973    fprintf(stderr,"Number of arguments used to call the function : %i",argc);
     974#endif
     975    return JS_FALSE;
     976  }
     977  conf=mapsFromJSObject(cx,argv[0]);
     978  if(JS_ValueToInt32(cx,argv[1],&istatus)==JS_TRUE){
     979    char tmpStatus[4];
     980    sprintf(tmpStatus,"%i",istatus);
     981    tmpStatus[3]=0;
     982    status=strdup(tmpStatus);
     983  }
     984  if(getMapFromMaps(conf,"lenv","status")!=NULL){
     985    if(status!=NULL){
     986      setMapInMaps(conf,"lenv","status",status);
     987      free(status);
     988    }
     989    else
     990      setMapInMaps(conf,"lenv","status","15");
     991    _updateStatus(conf);
     992  }
     993  freeMaps(&conf);
     994  free(conf);
     995  JS_MaybeGC(cx);
     996  return JS_TRUE;
     997}
     998
  • trunk/zoo-project/zoo-kernel/service_internal_js.h

    r383 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    4848  JSBool JSTranslate(JSContext*, uintN, jsval*);
    4949  JSBool JSRequest(JSContext*, uintN, jsval*);
     50  JSBool JSUpdateStatus(JSContext*,uintN,jsval *);
    5051
    5152  void reportError(JSContext *cx, const char *message, JSErrorReport *report);
  • trunk/zoo-project/zoo-kernel/service_internal_otb.c

    r576 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    3131using namespace otb::Wrapper;
    3232
     33/**
     34 * The ZooWatcher list
     35 */
    3336WatcherListType m_WatcherList;
     37/**
     38 * A pointer to the conf maps containing the main.cfg settings
     39 */
    3440maps* m_Conf;
    3541
     42/**
     43 * The command to create a ZooWatcher and add it to the global m_WatcherList
     44 */
    3645class MyCommand : public itk::Command
    3746{
     
    4049 public:
    4150
     51  /**
     52   * The method that defines the action to be taken by the command.
     53   *
     54   * @param caller an itk::Object pointer
     55   * @param event an itk::EventObject pointer
     56   */
    4257  void Execute(itk::Object *caller, const itk::EventObject & event)
    4358  {
     
    4560  }
    4661 
    47   void Execute(const itk::Object * object, const itk::EventObject & event)
     62  /**
     63   * The method that defines the action to be taken by the command.
     64   * Create a new ZooWatcher instance then add it to the m_WatcherList.
     65   *
     66   * @param caller a const itk::Object pointer
     67   * @param event an itk::EventObject pointer
     68   * @see ZooWatcher,ZooWatcher::SetConf
     69   */
     70  void Execute(const itk::Object *caller, const itk::EventObject & event)
    4871  {
    4972    const AddProcessToWatchEvent* eventToWatch = dynamic_cast< const AddProcessToWatchEvent*> ( &event );
    5073    std::string m_CurrentDescription = eventToWatch->GetProcessDescription();
    51     std::cerr << "err_service_zooo start ccalled." << m_CurrentDescription << std::endl;
    5274    ZooWatcher * watch = new ZooWatcher(eventToWatch->GetProcess(),
    5375                                        eventToWatch->GetProcessDescription());
     
    5678  }
    5779
    58 
    59 
    6080};
    6181
    62 
     82/**
     83 * Replace all occurence of from by to in a str string
     84 *
     85 * @param str the string to transform
     86 * @param from the string to replace
     87 * @param to the string used as replacement
     88 * @return the resulting string
     89 */
    6390std::string ReplaceAll(std::string str, const std::string& from, const std::string& to) {
    6491    size_t start_pos = 0;
     
    7097}
    7198
     99/**
     100 * Load and run an OTB Application corresponding to the service by using inputs parameters.
     101 * Define the m_Conf
     102 *
     103 * @param main_conf the conf maps containing the main.cfg settings
     104 * @param request the map containing the HTTP request
     105 * @param s the service structure
     106 * @param real_inputs the maps containing the inputs
     107 * @param real_outputs the maps containing the outputs
     108 */
    72109int zoo_otb_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
    73110  maps* m=*main_conf;
  • trunk/zoo-project/zoo-kernel/service_internal_otb.h

    r561 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    4343#include <string>
    4444
     45/**
     46 * A vector to store the ZooWatcher
     47 */
    4548typedef std::vector<ZooWatcher *> WatcherListType;
     49
    4650int zoo_otb_support(maps**,map*,service*,maps**,maps**);
    4751
  • trunk/zoo-project/zoo-kernel/service_internal_php.c

    r556 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    4141map* php_map_from_HasTable(HashTable* t);
    4242
     43/**
     44 * Load a PHP script then run the function corresponding to the service by
     45 * passing the conf, inputs and outputs parameters by reference.
     46 *
     47 * @param main_conf the conf maps containing the main.cfg settings
     48 * @param request the map containing the HTTP request
     49 * @param s the service structure
     50 * @param real_inputs the maps containing the inputs
     51 * @param real_outputs the maps containing the outputs
     52 */
    4353int zoo_php_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){   
    4454  maps* m=*main_conf;
     
    101111}
    102112
     113/**
     114 * Convert a maps to a php Array
     115 *
     116 * @param t the maps to convert
     117 * @return the php Array
     118 */
    103119zval *php_Array_from_maps(maps* t){
    104120  zval *mapArray;
     
    115131}
    116132
     133/**
     134 * Convert a map to a php Array
     135 *
     136 * @param t the map to convert
     137 * @return the php Array
     138 */
    117139zval *php_Array_from_map(map* t){
    118140  zval *mapArray;
     
    135157}
    136158
     159/**
     160 * Convert a php Array to a maps
     161 *
     162 * @param t the php Array to convert
     163 * @return the created maps
     164 */
    137165maps* php_maps_from_Array(HashTable *t){
    138166  maps* final_res=NULL;
     
    201229}
    202230
     231/**
     232 * Convert a php Array to a map
     233 *
     234 * @param t the php Array to convert
     235 * @return the created map
     236 */
    203237map* php_map_from_HasTable(HashTable* t){
    204238#ifdef DEBUG
  • trunk/zoo-project/zoo-kernel/service_internal_php.h

    r556 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r579 r580  
    136136
    137137/**
    138  * Loading a Python module then run the function corresponding to the service
     138 * Load a Python module then run the function corresponding to the service
    139139 * by passing the conf, inputs and outputs parameters by reference.
    140140 *
     
    302302
    303303/**
    304  * Repport Python error which may occur on loading the Python module or at
     304 * Report Python error which may occur on loading the Python module or at
    305305 * runtime.
    306306 *
     
    608608
    609609/**
    610  * Use the ZOO-Services messages translation function  from the Python
     610 * Use the ZOO-Services messages translation function from the Python
    611611 * environment
    612612 *
  • trunk/zoo-project/zoo-kernel/service_yaml.c

    r490 r580  
    1 /**
     1/*
    22 * Author : Gérald FENOY
    33 *
     
    3131static map* current_content=NULL;
    3232static elements* current_element=NULL;
    33 static char* curr_key;
    34 
    35 /**
    36  * getServiceFromFile :
    37  * set service given as second parameter with informations extracted from the
    38  * definition file.
    39  */
     33
    4034#ifdef __cplusplus
    4135extern "C" {
    4236#endif
    4337
     38/**
     39 * Read and parse a ZCFG file in YAML format
     40 *
     41 * @param conf the conf maps containing the main.cfg settings
     42 * @param file the file name to read
     43 * @param service the service structure to fill
     44 * @param name the service name
     45 * @return 1 on success, -1 if error occured
     46 */
    4447int getServiceFromYAML(maps* conf, char* file,service** service,char *name){
    4548  FILE *fh = fopen("test.yml", "r");
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